Package chemaxon.standardizer
Class StandardizerActionFactory
java.lang.Object
chemaxon.standardizer.StandardizerActionFactory
Factory of
Initializes the list of available standardizer action based on the provided factory configuration XML files, defining the factory:
The schema defines a factory identifier and the class name for each standardizer actions. The actions can be reached by the following methods:
StandardizerAction objects Initializes the list of available standardizer action based on the provided factory configuration XML files, defining the factory:
- Internal list: the factory configuration XML containing the definitions of internal (Chemaxon defined) standardizer actions, that should be available using the factory
- External list: the factory configuration XML containing the definitions of external (user defined) standardizer actions, that should be available using the factory
DEFAULT_CONFIGURATION_SCHEMA:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="configuration">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:element name="bundle">
<xsd:complexType>
<xsd:attribute name="base" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="standardizer-action-list">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded" minOccurs="0">
<xsd:element name="standardizer-action">
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string" use="required"/>
<xsd:attribute name="class" type="xsd:string" use="required"/>
<xsd:attribute name="editor-class" type="xsd:string" use="optional"/>
<xsd:attribute name="jar" type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
The schema defines a factory identifier and the class name for each standardizer actions. The actions can be reached by the following methods:
- All actions can be accessed by the method
getAvailableStandardizerActions()or, -
each action can be accessed by the factory identifier by the method
getStandardizerAction(String, Map), however with this functionality the action can be initialized with special parameters.
StandardizerActionFactory.Builder builder = new StandardizerActionFactory.Builder();
builder.add(StandardizerTest.class.getResourceAsStream(StandardizerActionFactory.DEFAULT_CONFIGURATION_PATH));
try {
builder.add(DotfileUtil.open(StandardizerActionFactory.USER_DEFINED_STANDARDIZERCONFIG_XML));
} catch (IOException e) {
// no user defined standardizer configuration found
}
builder.add(StandardizerTest.class.getResourceAsStream(StandardizerActionFactory.PRE_CONFIGURED_TRANSFORMATIONS));
StandardizerActionFactory factory = builder.build();
- Since:
- 5.11
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class forStandardizerActionFactory.static classDescriptor of a standardizer class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringdefault factory idstatic final StringChemaxon's default standardizer action configuration pathstatic final StringChemaxon's default standardizer action configuration file schema pathstatic final StringPre-configured transformation configuration pathstatic final StringChemaxon's default standardizer action configuration file namestatic final StringUsers standardizer action configuration file name -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.StandardizerActionFactory(String path, String externalPath) With this constructor inner and external configuration location can be defined. -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of standardizer actions that are availablegetStandardizerAction(String standardizerActionId, Map<String, String> params) This method creates a requested (type represented in actionId)StandardizerActioninstance with the give parametersvoidwriteConfiguration(OutputStream outputstream) Writes the factory configuration to the output stream
-
Field Details
-
STANDARDIZERCONFIG_XML
Chemaxon's default standardizer action configuration file name- See Also:
-
USER_DEFINED_STANDARDIZERCONFIG_XML
Users standardizer action configuration file name- See Also:
-
DEFAULT_CONFIGURATION_PATH
Chemaxon's default standardizer action configuration path- See Also:
-
PRE_CONFIGURED_TRANSFORMATIONS
Pre-configured transformation configuration path- See Also:
-
DEFAULT_CONFIGURATION_SCHEMA
Chemaxon's default standardizer action configuration file schema path- See Also:
-
DEFAULT
default factory id- See Also:
-
-
Constructor Details
-
StandardizerActionFactory
public StandardizerActionFactory()Default constructor. Only the built in configuration file defined byDEFAULT_CONFIGURATION_PATH, and theUSER_DEFINED_STANDARDIZERCONFIG_XMLwill be read, the default list of Standardizer Actions will be reachable by the factory -
StandardizerActionFactory
With this constructor inner and external configuration location can be defined.- Parameters:
path- the location of the configuration XML for the inner standardizer action classesexternalPath- the location of the configuration XML for the external standardizer action classes
-
-
Method Details
-
getAvailableStandardizerActions
Returns the list of standardizer actions that are available- Returns:
- the list of standardizer actions that are available with default parameters
-
getStandardizerAction
public StandardizerAction getStandardizerAction(String standardizerActionId, Map<String, String> params) This method creates a requested (type represented in actionId)StandardizerActioninstance with the give parameters- Parameters:
standardizerActionId- the Id of the standardizer actionparams- is aMapcontainsStringpairs representing a property bag should be passed to the standardizer action instance- Returns:
- a well configured
StandardizerActioninstance
-
writeConfiguration
Writes the factory configuration to the output stream- Parameters:
outputstream- the target output stream
-