Class FWProcessor

java.lang.Object
net.simplace.pipe.control.FWProcessor
Direct Known Subclasses:
AsciiToDatabaseTableProcessor, AsciiToMapProcessor, BrowseFolderProcessor, ConsoleOutProcessor, CopyFilesProcessor, CopyFolderProcessor, CopyTableProcessor, CreateDBConnectionProcessor, CreateFileListProcessor, CreateScenarioToLoopProcessor, DatasetLoaderProcessor, DateListCreatorProcessor, DateTableCreatorProcessor, DB2HSSFWorkbookProcessor, DeleteFilesProcessor, DownloadFileProcessor, EncodingConverterProcessor, FillParameterProcessor, FilterParameterProcessor, FWLoopProcessor, GetXLSValueProcessor, HashValueFromFileProcessor, HSSFWorkbook2DBProcessor, JDOMParserProcessor, JDOMUnparseProcessor, ListReducerProcessor, ListToDatabaseTableProcessor, LoadScenarioProcessor, MathCalculatorProcessor, MoveFileProcessor, ReadFileProcessor, ReadHSSFWorkbookProcessor, ReadXLSValueProcessor, RecalcXLSProcessor, ReleaseDBConnectionProcessor, RequestSimplaceServerProcessor, RunAppProcessor, SaveProjectTemplateProcessor, SaveScenarioProcessor, SetXLSValueProcessor, SolutionToXMLProcessor, SQLResultToCsvProcessor, SQLStatementProcessor, UnzipFolderProcessor, WriteFileProcessor, WriteProjectXMLProcessor, XSLTTransformerProcessor

public abstract class FWProcessor extends Object
Abstract superclass for all standard and custom processors.
Author:
Andreas Enders
  • Field Details

    • iContainer

      protected FWPipeLinesContainer iContainer
      Holds an instance of the Kernel.
    • iProgressTasks

      protected ArrayList<FWProgressTask> iProgressTasks
      The progressTasks of this Processor.
    • iInObservable

      protected FWObservable iInObservable
      Map of parameters worked with in this processor.
    • iObservable

      protected FWObservable iObservable
      Map of parameters put to output for next processor.
    • iAllreadyLoopedCount

      protected int iAllreadyLoopedCount
      Indicates the count of loops this Processor was run through: -1
  • Constructor Details

    • FWProcessor

      public FWProcessor()
  • Method Details

    • createProcessor

      public static FWProcessor createProcessor(org.jdom2.Element aProcessorElement, FWPipeLinesContainer aContainer) throws PipeLineCreationException
      Creates a processor by dynamically instancing the class given in the JDM element.
      Parameters:
      aProcessorElement -
      aContainer -
      Returns:
      the created Processor
      Throws:
      PipeLineCreationException
    • createProcessor

      public static FWProcessor createProcessor(String aClassName) throws PipeLineCreationException
      Creates a processor by dynamically instancing the class given in the JDM element.
      Parameters:
      aClassName -
      Returns:
      the created Processor
      Throws:
      PipeLineCreationException
    • clone

      public FWProcessor clone()
      Creates a connectlet by dynamically instancing the class given in the JDM element.
      Overrides:
      clone in class Object
    • setInitialParameters

      protected void setInitialParameters(Map<String,Object> aInitialParameterMap)
      Parameters:
      aInitialParameterMap -
    • getInitialParameters

      protected Map<String,Object> getInitialParameters()
      Returns:
      the initial parameters of this processor
    • process

      protected abstract boolean process() throws PipeLineException
      Must be overridden to implement concrete pipe procedure.
      Returns:
      success
      Throws:
      PipeLineException
    • checkInParameterMap

      protected boolean checkInParameterMap()
      Can be overridden to perform semantic checks on the pipeline Input.
      Returns:
      true if not overridden by implementations
    • containsParameter

      protected boolean containsParameter(String aSourceKey)
      Parameters:
      aSourceKey -
      Returns:
      if the source is contained in In-Parameter set
    • setEndOfPipeFlag

      protected void setEndOfPipeFlag()
      Sets the end of pipe flag. Pipe line is aborted after this processor.
    • isEndOfPipe

      public boolean isEndOfPipe()
      Sets the end of pipe flag. Pipeline is aborted after this processor.
      Returns:
      if pipe has ended
    • checkOutParameterMap

      protected boolean checkOutParameterMap()
      Can be overridden to perform semantic checks on the pipeline Input.
      Returns:
      true if not overridden
    • getInParameter

      protected Object getInParameter(String aKey)
      Returns the value of specified parameter or null if not set.
      Parameters:
      aKey -
      Returns:
      the object from the in parameter map
    • getInParameters

      protected FWObservable getInParameters()
      Returns the map of all parameters.
      Returns:
      the in parameter map
    • getInParameter

      protected Object getInParameter(String aKey, Object aDefault)
      Returns the value of specified parameter. Returns aDefault if the parameter is null.
      Parameters:
      aKey -
      aDefault -
      Returns:
      the object from the in parameter map
    • getStringInParameter

      protected String getStringInParameter(String aKey, String aDefault)
      Returns the value of specified key as string. Returns aDefault if the key is null or not a string.
      Parameters:
      aKey -
      aDefault -
      Returns:
      the object from the in parameter map if it is a string, else the default
    • getAllStringInParameters

      protected Map<String,String> getAllStringInParameters(String aKeyPrefix, boolean aElimKeyPrefix)
      Returns all string in parameters, whose keys start with a given prefix.
      Parameters:
      aKeyPrefix - prefix the "wanted" parameters must start with
      aElimKeyPrefix - if false the keys of the found parameters are used unchanged for the returned map. If true the prefix is eliminated for the use in the destination map.
      Returns:
      an empty map, when aKeyPrefix is null
    • getStringInParameter

      protected String getStringInParameter(String aKey)
      Returns the value of specified channel as string. Returns aDefault if the parameter is null or not a string.
      Parameters:
      aKey -
      Returns:
      the In parameter as string from observable
    • setOutParameter

      protected void setOutParameter(String aKey, Object aValue)
      sets a parameter to the output map.
      Parameters:
      aKey -
      aValue -
    • setInParameterMap

      protected void setInParameterMap(FWObservable aObservable)
      Parameters:
      aObservable -
    • getOutParameter

      protected Object getOutParameter(String aKey)
      gets a parameter from the output map.
      Parameters:
      aKey -
      Returns:
      the out parameter
    • getOutParameterKeys

      protected Set<String> getOutParameterKeys()
      gets a keySet of parameters in the output map.
      Returns:
      out parameter keys
    • removeOutParameter

      protected void removeOutParameter(String aElement)
      removes a Parameter form Map
      Parameters:
      aElement - of OutParameterMap
    • pipe

      public FWObservable pipe(FWObservable aObservabe, Integer aAllreadyLoopedCount) throws PipeLineException
      Pipes aIncommingObject through this pipe element.
      Parameters:
      aObservabe -
      aAllreadyLoopedCount -
      Returns:
      the resulting observable
      Throws:
      PipeLineException
    • getConfiguration

      protected org.jdom2.Element getConfiguration()
      gets the detailed configuration of the Processor.
      Returns:
      the processors configration element
    • setConfiguration

      protected void setConfiguration(String aClassname, org.jdom2.Element aConfigurationElement)
      sets the detailed configuration of a Processor.
      Parameters:
      aClassname -
      aConfigurationElement -
    • hasConfiguration

      protected boolean hasConfiguration()
      gets the detailed configuration of the Processor.
      Returns:
      if has additional configuration
    • fireTaskEvent

      protected void fireTaskEvent(JPanel aSourcePanel)
      fires TaskEvent to listening Panels.
      Parameters:
      aSourcePanel -
    • getNewProgressTask

      public FWProgressTask getNewProgressTask()
      Returns:
      the progressTask for given LoopCount (1-n)
    • getProgressTask

      public FWProgressTask getProgressTask()
      Returns:
      the progressTask for integrated LoopCount
    • getPipeLine

      protected FWPipeLine getPipeLine(String aPipeLineID)
      Parameters:
      aPipeLineID -
      Returns:
      the the count of loops, invoked by this processor
    • getSystemID

      protected String getSystemID()
      Returns:
      the SystemID from PipelineContainer
    • setStateProgressing

      protected void setStateProgressing(int aPercentDone, String aMessage)
      Parameters:
      aPercentDone -
      aMessage -
      the - statusOfTask is set to progressing. percentDone (0-100).
    • setStateOfTask

      protected void setStateOfTask(String aStatusOfTask)
      Parameters:
      aStatusOfTask - the statusOfTask to set - use Variables in class State
    • setLoopedCount

      protected void setLoopedCount(int aNumberOfAllreadyLooped)
      Parameters:
      aNumberOfAllreadyLooped -
      aLoopedCount - - has to be set from the looping processor because of thread safety
    • toXML

      public org.jdom2.Element toXML()
      Returns:
      the Element explaining which processor this is