Class StandardizerActionFactory

java.lang.Object
chemaxon.standardizer.StandardizerActionFactory

@PublicApi public class StandardizerActionFactory extends Object
Factory of 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
The schema of the definition XML is defined by the 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:
Example for Chemaxon's default configuration with pre-configured transformations and user-defined standardizers:
 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
  • Field Details

    • STANDARDIZERCONFIG_XML

      public static final String STANDARDIZERCONFIG_XML
      Chemaxon's default standardizer action configuration file name
      See Also:
    • USER_DEFINED_STANDARDIZERCONFIG_XML

      public static final String USER_DEFINED_STANDARDIZERCONFIG_XML
      Users standardizer action configuration file name
      See Also:
    • DEFAULT_CONFIGURATION_PATH

      public static final String DEFAULT_CONFIGURATION_PATH
      Chemaxon's default standardizer action configuration path
      See Also:
    • PRE_CONFIGURED_TRANSFORMATIONS

      public static final String PRE_CONFIGURED_TRANSFORMATIONS
      Pre-configured transformation configuration path
      See Also:
    • DEFAULT_CONFIGURATION_SCHEMA

      public static final String DEFAULT_CONFIGURATION_SCHEMA
      Chemaxon's default standardizer action configuration file schema path
      See Also:
    • DEFAULT

      public static final String DEFAULT
      default factory id
      See Also:
  • Constructor Details

    • StandardizerActionFactory

      public StandardizerActionFactory()
      Default constructor. Only the built in configuration file defined by DEFAULT_CONFIGURATION_PATH, and the USER_DEFINED_STANDARDIZERCONFIG_XML will be read, the default list of Standardizer Actions will be reachable by the factory
    • StandardizerActionFactory

      public StandardizerActionFactory(String path, String externalPath)
      With this constructor inner and external configuration location can be defined.
      Parameters:
      path - the location of the configuration XML for the inner standardizer action classes
      externalPath - the location of the configuration XML for the external standardizer action classes
  • Method Details

    • getAvailableStandardizerActions

      public List<StandardizerAction> 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) StandardizerAction instance with the give parameters
      Parameters:
      standardizerActionId - the Id of the standardizer action
      params - is a Map contains String pairs representing a property bag should be passed to the standardizer action instance
      Returns:
      a well configured StandardizerAction instance
    • writeConfiguration

      public void writeConfiguration(OutputStream outputstream)
      Writes the factory configuration to the output stream
      Parameters:
      outputstream - the target output stream