Class EngineTypes
- java.lang.Object
-
- com.jstatcom.engine.EngineTypes
-
- Direct Known Subclasses:
- GaussEngineType, GRTEType, MatlabEngineType, MLabEngineType, OxEngineType, StubEngineType, StubMlabEngineType
public abstract class EngineTypes extends java.lang.ObjectThis class is a Mediator that binds the various classes and resources together that belong to an engine implementation. It also contains an enumeration of engine types that are implemented for convenience.Every
Engineimplementation define its corresponding concrete engine type. The name of an engine type must be unique. If it already exists for a different instance ofEngineTypes, the constructor will throw an exception.Engine types should always be implemented as Singletons.
The name of an engine type also defines the resource directory to be used for everything related to that engine. Therefore the conventions for variable names defined in
com.jstatcom.model.JSCConstantsare enforced for engine type names as well.This class implements the typesave enum pattern (Joshua Bloch, "Effective Java", Item 21) . If you compare
EngineTypes, always use the==operator.
-
-
Field Summary
Fields Modifier and Type Field and Description java.lang.StringDIR_NAMEstatic EngineTypesGAUSSReference to the GAUSS engine type.static EngineTypesGRTEReference to the Gauss Runtime Engine type.static EngineTypesMATLABReference to the newer Matlab Engine type.static EngineTypesMLABReference to the older Matlab Engine type.java.lang.StringnameThe name of this runtype.static EngineTypesOXReference to the Ox Engine type.static EngineTypesSTUBReference to the Stub Engine type.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description java.lang.StringcheckConfig(ConfigHolder configHolder)Checks all configuration data for validity.abstract java.lang.StringcheckSettings(ConfigHolder configHolder)This method should be overwritten by clients, if further checks of the settings have to be specified.static java.util.IteratorengineIterator()Gets an iterator over all loaded engines.booleanequals(java.lang.Object o)Override prevention method to enforcea.equals(b)if and onlyif a==b.java.lang.StringgetConfigFile()Returns the config file location for the respective engine.abstract java.util.Map<java.lang.String,ConfigKeys>getConfigKeys()Gets a map with all config keys for that specific engine.AbstractConfigPanelgetConfigPanel()Gets the configuration panel for the respective engine.abstract EnginegetEngine()Gets a concrete implementation of theEngineinterface.inthashCode()Override prevention method invokes super method.java.lang.StringtoString()Returns a string that represents the value of this object.static EngineTypesvalueOf(java.lang.String name)Gets the type for the given name.
-
-
-
Field Detail
-
name
public final java.lang.String name
The name of this runtype.
-
DIR_NAME
public final java.lang.String DIR_NAME
-
GAUSS
public static final EngineTypes GAUSS
Reference to the GAUSS engine type. This used to manage communication with the GAUSS software by Aptech. The software has to be installed on the machine.
-
GRTE
public static final EngineTypes GRTE
Reference to the Gauss Runtime Engine type. This can be used to execute GAUSS code that has been compiled with the matching Gauss Engine.
-
STUB
public static final EngineTypes STUB
Reference to the Stub Engine type. This can be used to execute methods in arbitrary system libraries without the need for a distinguished JNI wrapper.
-
MATLAB
public static final EngineTypes MATLAB
Reference to the newer Matlab Engine type. This can be used to execute methods in system libraries that have been generated from Matlab .m files with Matlab Compiler versions release 4 and later.
-
MLAB
public static final EngineTypes MLAB
Reference to the older Matlab Engine type. This can be used to execute methods in system libraries that have been generated from Matlab .m files with Matlab Compiler versions prior to release 4.
-
OX
public static final EngineTypes OX
Reference to the Ox Engine type. This can be used to execute methods in .ox or .oxo modules.
-
-
Method Detail
-
checkConfig
public final java.lang.String checkConfig(ConfigHolder configHolder)
Checks all configuration data for validity. This method performs a general check that should be true for all engines:- test whether all necessary keys are there
- test whether the self tests of all
ConfigKeysare ok
public String checkSettings()It is called from this method after all other checks succeeded and can be used to validate conditions between engine settings.
- Parameters:
configHolder- the config settings to check- Returns:
nullif ok, error string otherwise- Throws:
java.lang.IllegalArgumentException-if (configHolder == null)
-
checkSettings
public abstract java.lang.String checkSettings(ConfigHolder configHolder)
This method should be overwritten by clients, if further checks of the settings have to be specified.- Parameters:
configHolder- the config settings to check- Returns:
nullif ok, error string otherwise
-
equals
public final boolean equals(java.lang.Object o)
Override prevention method to enforcea.equals(b)if and onlyif a==b.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- object to compare with- Returns:
trueif equal,falseotherwise
-
getConfigFile
public java.lang.String getConfigFile()
Returns the config file location for the respective engine. The filename is constructed as:"j" + name.toLowerCase() + "/" + CONFIG_FILE;If the directory
"j" + name.toLowerCase()does not exist yet in the resource path, it will be created by this method.Subclasses can overwrite this method if this is not the desired behaviour.
- Returns:
- the relative location of the XML config file to the resource directory
-
getConfigKeys
public abstract java.util.Map<java.lang.String,ConfigKeys> getConfigKeys()
Gets a map with all config keys for that specific engine.Example:
Implementations of aFooengine this class could use:return ConfigKeys.getAllKeys(FooConfigKeys.class);where
Foostands for the name of the engine andFooConfigKeysis the engine specific implementation ofConfigKeys.- Returns:
Mapcontaining theConfigKeyswith the respective names as keys
-
getConfigPanel
public AbstractConfigPanel getConfigPanel()
Gets the configuration panel for the respective engine. This default implementation creates an edit dialog for the XML file. It works for all settings. This can be overwritten to provide a costumized settings dialogs for a specific engine.- Returns:
- the user panel containing the user input mask for configuration
-
getEngine
public abstract Engine getEngine()
Gets a concrete implementation of theEngineinterface.- Returns:
- engine that is initialized and ready to run
-
hashCode
public final int hashCode()
Override prevention method invokes super method.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hash code
-
toString
public final java.lang.String toString()
Returns a string that represents the value of this object.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of
this
-
valueOf
public static EngineTypes valueOf(java.lang.String name)
Gets the type for the given name. The case ofnamemakes no difference.- Parameters:
name- the name of the type- Returns:
- reference to an instance of
EngineTypeswithnameornullif it does not exist - Throws:
java.lang.IllegalArgumentException-if (name == null)
-
engineIterator
public static java.util.Iterator engineIterator()
Gets an iterator over all loaded engines.- Returns:
- iterator
-
-
DMelt 3.0 © DataMelt by jWork.ORG