3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.net.MalformedURLException;
8 import java.net.URLClassLoader;
9 import java.util.ArrayList;
10 import java.util.List;
11 import java.util.Scanner;
38 this.rooturl = rooturl;
59 return new URLClassLoader(
new URL[] { url }, super.getClassLoader());
60 }
catch (MalformedURLException e) {
61 return super.getClassLoader();
72 URL u =
new URL(rooturl +
"/" +
getModelDir() +
"/" + filename);
73 return u.openStream();
79 Scanner s =
new Scanner(u.openStream());
80 List<String> folders =
new ArrayList<String>();
81 while (s.hasNextLine()) {
82 folders.add(s.nextLine());
85 if (folders.size() > 0) {
86 return folders.toArray(
new String[0]);
100 }
catch (IOException e) {
107 return URI.create(rooturl.toString());
112 return "Reading remote models";
URI getModelURI()
Returns an URI for the current model location/directory.
ClassLoader getClassLoader()
static final String CLASSES_JARFILE
The name of the jar file inside a models directory containing .class files in java bytecode...
This class serves as base class for accessing various types of models at different locations...
String getLoadingMessage()
A short message that writes "loading SD models" dependent on the actual instance. ...
InputStream getInStreamImpl(String filename)
Template method.
static final String DIRLIST_FILE
The file containing the model folders to consider per line.
A model manager reading models from a remote web location.
String[] getFolderList()
Returns the list of all models directories available at the ModelManagers source location.
WebModelManager(String url)
boolean modelFileExists(String filename)
WebModelManager(URL rooturl)