JaRMoS
1.1
Java Reduced Model Simulations
|
A wrapper class that takes any AModelManager as source and a FileModelManager as target. More...
Public Member Functions | |
CachingModelManager (AModelManager source, FileModelManager dest) | |
Creates a new caching model manager with overwriteFlag set to false. More... | |
CachingModelManager (AModelManager source, FileModelManager dest, boolean overwriteFlag) | |
Creates a new caching model manager. More... | |
void | addMessageHandler (IMessageHandler h) |
ClassLoader | getClassLoader () |
MathObjectReader | getMathObjReader () |
List< ModelDescriptor > | getModelDescriptors (IProgressReporter pr) throws ModelManagerException |
String | getModelDir () |
ModelType | getModelType () |
URI | getModelURI () |
Returns an URI for the current model location/directory. More... | |
String | getModelXMLAttribute (String attrib_name) |
String | getModelXMLAttribute (String attrib_name, String tagname) |
String | getModelXMLTagValue (String tagname) |
String | getModelXMLTagValue (String tagname, String default_value) |
Parameters | getParameters () |
boolean | isValidModelDir (String dir) |
boolean | modelFileExists (String filename) |
Returns whether the specified file exists in the current model folder. More... | |
void | removeMessageHandler (IMessageHandler h) |
void | useModel (String dir) throws ModelManagerException |
boolean | deleteCachedFiles () |
boolean | xmlTagExists (String tagname) |
Public Member Functions inherited from jarmos.io.AModelManager | |
AModelManager () | |
Constructs a new ModelManager and a private DocumentBuilder and SchemaFactory. More... | |
void | addMessageHandler (IMessageHandler h) |
Object | loadModelClass (String name) throws ModelManagerException |
Loads a class available in the precompiled classes associated with the current model. More... | |
BufferedReader | getBufReader (String filename) throws IOException |
ClassLoader | getClassLoader () |
This method yields access to any specialized class loaders in subclasses. More... | |
final InputStream | getInStream (String filename) throws IOException |
Returns an InputStream instance streaming the contents of the file given by filename. More... | |
MathObjectReader | getMathObjReader () |
Use this method in order to get a MathObjectReader instance fitted for the current selected model. More... | |
List< ModelDescriptor > | getModelDescriptors () throws ModelManagerException |
Scans all directories given by getFolderList() for valid models and returns a list of model descriptors for each valid model. More... | |
List< ModelDescriptor > | getModelDescriptors (IProgressReporter pr) throws ModelManagerException |
Scans all directories given by getFolderList() for valid models and returns a list of model descriptors for each valid model. More... | |
String | getModelDir () |
FieldDescriptor[] | getModelFieldTypes () |
ModelType | getModelType () |
Returns the model type as given in the model.xml attribute "type" of the "model" tag. More... | |
String | getModelXMLAttribute (String attrib_name) |
Returns the attribute value of any attributes of the "model" tag in the model.xml file. More... | |
String | getModelXMLAttribute (String attrib_name, String tagname) |
Returns the attribute value of any attributes of the tag given by tagname in the model.xml file. More... | |
String | getModelXMLTagValue (String tagname) |
Works as the overload with default value, but returns null if no matchin element is found. More... | |
String | getModelXMLTagValue (String tagname, String default_value) |
Returns the text content of a tag inside the model.xml file. More... | |
String | getModelPackageStr () |
Returns the package of any java source files associated with this model. More... | |
Parameters | getParameters () |
Reads the parameters from the model XML file and returns a Parameters object. More... | |
boolean | isValidModelDir (String dir) |
Checks if a model.xml file exists in the specified directory and performs xsd-validation. More... | |
void | removeMessageHandler (IMessageHandler h) |
void | useModel (String location) throws ModelManagerException |
Sets the specified source as current model path. More... | |
boolean | xmlTagExists (String tagname) |
Checks if a specified tag exists inside the current models model.xml file. More... | |
Protected Member Functions | |
String[] | getFolderList () throws IOException |
Returns the list of all models directories available at the ModelManagers source location. More... | |
InputStream | getInStreamImpl (String filename) throws IOException |
Template method. More... | |
void | sendMessage (String msg) |
String | getLoadingMessage () |
A short message that writes "loading SD models" dependent on the actual instance. More... | |
Protected Member Functions inherited from jarmos.io.AModelManager | |
void | sendMessage (String msg) |
Additional Inherited Members | |
Static Public Attributes inherited from jarmos.io.AModelManager | |
static final String | CLASSES_JARFILE = "classes.jar" |
The name of the jar file inside a models directory containing .class files in java bytecode. More... | |
static final String | info_filename = "site_info.html" |
The model's info html file name (imported from rbappmit, might change later) More... | |
A wrapper class that takes any AModelManager as source and a FileModelManager as target.
Any calls to the CachingModelManager are forwarded to the given AModelManager instance, the data is read and added to the FileModelManager's location. Then, the files are served from there.
This is implemented to allow simple caching of models from web locations at e.g. the local hard drive or SD-card (Android).
TODO: Delete half-downloaded models if loading fails!
Definition at line 30 of file CachingModelManager.java.
jarmos.io.CachingModelManager.CachingModelManager | ( | AModelManager | source, |
FileModelManager | dest | ||
) |
Creates a new caching model manager with overwriteFlag set to false.
source | |
dest |
Definition at line 44 of file CachingModelManager.java.
jarmos.io.CachingModelManager.CachingModelManager | ( | AModelManager | source, |
FileModelManager | dest, | ||
boolean | overwriteFlag | ||
) |
Creates a new caching model manager.
source | The source model manager |
dest | The target model manager |
overwriteFlag | Sets if existent model files should be overwritten or not |
Definition at line 58 of file CachingModelManager.java.
void jarmos.io.CachingModelManager.addMessageHandler | ( | IMessageHandler | h | ) |
Definition at line 65 of file CachingModelManager.java.
boolean jarmos.io.CachingModelManager.deleteCachedFiles | ( | ) |
Definition at line 237 of file CachingModelManager.java.
ClassLoader jarmos.io.CachingModelManager.getClassLoader | ( | ) |
Definition at line 100 of file CachingModelManager.java.
|
protectedvirtual |
Returns the list of all models directories available at the ModelManagers source location.
At this stage, no validity checks have to be performed regarding if a returned folder actually contains a valid model.
IOException |
Implements jarmos.io.AModelManager.
Definition at line 110 of file CachingModelManager.java.
|
protectedvirtual |
Template method.
Implementations of this method must locate the given file inside the current model directory and return an input stream pointing to it.
filename | The model file to return a stream for |
IOException |
Implements jarmos.io.AModelManager.
Definition at line 120 of file CachingModelManager.java.
|
protectedvirtual |
A short message that writes "loading SD models" dependent on the actual instance.
Implements jarmos.io.AModelManager.
Definition at line 247 of file CachingModelManager.java.
MathObjectReader jarmos.io.CachingModelManager.getMathObjReader | ( | ) |
Definition at line 130 of file CachingModelManager.java.
List<ModelDescriptor> jarmos.io.CachingModelManager.getModelDescriptors | ( | IProgressReporter | pr | ) | throws ModelManagerException |
Definition at line 135 of file CachingModelManager.java.
String jarmos.io.CachingModelManager.getModelDir | ( | ) |
Definition at line 141 of file CachingModelManager.java.
ModelType jarmos.io.CachingModelManager.getModelType | ( | ) |
Definition at line 146 of file CachingModelManager.java.
|
virtual |
Returns an URI for the current model location/directory.
Implements jarmos.io.AModelManager.
Definition at line 151 of file CachingModelManager.java.
String jarmos.io.CachingModelManager.getModelXMLAttribute | ( | String | attrib_name | ) |
Definition at line 156 of file CachingModelManager.java.
String jarmos.io.CachingModelManager.getModelXMLAttribute | ( | String | attrib_name, |
String | tagname | ||
) |
Definition at line 161 of file CachingModelManager.java.
String jarmos.io.CachingModelManager.getModelXMLTagValue | ( | String | tagname | ) |
Definition at line 166 of file CachingModelManager.java.
String jarmos.io.CachingModelManager.getModelXMLTagValue | ( | String | tagname, |
String | default_value | ||
) |
Definition at line 171 of file CachingModelManager.java.
Parameters jarmos.io.CachingModelManager.getParameters | ( | ) |
Definition at line 176 of file CachingModelManager.java.
boolean jarmos.io.CachingModelManager.isValidModelDir | ( | String | dir | ) |
Definition at line 181 of file CachingModelManager.java.
|
virtual |
Returns whether the specified file exists in the current model folder.
filename |
Implements jarmos.io.AModelManager.
Definition at line 192 of file CachingModelManager.java.
void jarmos.io.CachingModelManager.removeMessageHandler | ( | IMessageHandler | h | ) |
Definition at line 197 of file CachingModelManager.java.
|
protected |
Definition at line 202 of file CachingModelManager.java.
void jarmos.io.CachingModelManager.useModel | ( | String | dir | ) | throws ModelManagerException |
Definition at line 207 of file CachingModelManager.java.
boolean jarmos.io.CachingModelManager.xmlTagExists | ( | String | tagname | ) |
Definition at line 242 of file CachingModelManager.java.