Class AbstractScriptlet

    • Field Detail

      • m_DataProvider

        protected DataProvider m_DataProvider
        the data provider to use.
      • m_Stopped

        protected boolean m_Stopped
        whether the scriptlet has been stopped.
    • Constructor Detail

      • AbstractScriptlet

        public AbstractScriptlet()
        Initializes the action.
    • Method Detail

      • setOwner

        public void setOwner​(AbstractCommandProcessor value)
        Sets the owning command processor.
        Parameters:
        value - the command processor
      • initialize

        protected void initialize()
        For initializing the member variables.
      • getOwner

        public AbstractCommandProcessor getOwner()
        Returns the owning command processor.
        Returns:
        the command processor, null if none set
      • hasOwner

        public boolean hasOwner()
        Checks whether an owner is set.
        Returns:
        true if owner available
        See Also:
        getOwner()
      • setParameter

        public void setParameter​(String key,
                                 Object value)
        Sets the parameter and the associated value.
        Parameters:
        key - the name of the parameter
        value - the value of the parameter
      • hasParameter

        public boolean hasParameter​(String key)
        Checks whether a parameter is present.
        Parameters:
        key - the name of the parameter to check
        Returns:
        true if present
      • getParameter

        public Object getParameter​(String key,
                                   Object defValue)
        Returns the associated value of the parameter.
        Parameters:
        key - the name of the parameter to retrieve
        defValue - the default value
        Returns:
        the stored value or, if parameter not found, the default value
      • setDataProvider

        public void setDataProvider​(DataProvider value)
        Sets the data provider to use for accessing the database.
        Parameters:
        value - the data provider
      • getDataProvider

        public DataProvider getDataProvider()
        Returns the current data provider.
        Returns:
        the data provider, can be null if not set
      • getBasePanel

        public BasePanel getBasePanel()
        Returns the underlying BasePanel if available.
        Returns:
        the current BasePanel, if any
      • showStatus

        protected void showStatus​(String msg)
        Displays the status, if the owner is a StatusMessageHandler, otherwise it just prints the status on the commandline.
        Parameters:
        msg - the message to display
        See Also:
        AbstractCommandProcessor.showStatus(String)
      • getAction

        public abstract String getAction()
        Returns the action string used in the command processor.
        Returns:
        the action string
      • getParameterDescription

        public String getParameterDescription()
        Returns a one-line listing of the parameters.
        Returns:
        the command format
      • getOptionsDescription

        protected String getOptionsDescription()
        Returns a one-line listing of the options of the action.

        Default implementation returns null.
        Returns:
        the options or null if none
      • getDescription

        public abstract String getDescription()
        Returns the full description of the action.
        Returns:
        the full description
      • getRequirements

        public Class[] getRequirements()
        Returns the class(es) of an object that must be present for this action to be executed.

        The default implementation returns null.
        Returns:
        the class(es) of which an instance must be present for execution, null if none necessary
      • doProcess

        protected abstract String doProcess​(String options)
                                     throws Exception
        Processes the options.
        Parameters:
        options - additional/optional options for the action
        Returns:
        null if no error, otherwise error message
        Throws:
        Exception - if something goes wrong
      • process

        public String process​(String options)
                       throws Exception
        Processes the options.
        Parameters:
        options - additional/optional options for the action
        Returns:
        null if no error, otherwise error message
        Throws:
        Exception - if something goes wrong
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface Stoppable
      • isStopped

        public boolean isStopped()
        Whether the execution has been stopped.
        Specified by:
        isStopped in interface StoppableWithFeedback
        Returns:
        true if stopped
      • compareTo

        public int compareTo​(Object o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

        Only compares the action name of the two objects.
        Specified by:
        compareTo in interface Comparable
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object o)
        Returns whether the two objects are the same.

        Only compares the action name of the two objects.
        Overrides:
        equals in class Object
        Parameters:
        o - the object to be compared
        Returns:
        true if the object is the same as this one
      • hashCode

        public int hashCode()
        Hashcode so can be used as hashtable key. Returns the hashcode of the getAction() string.
        Overrides:
        hashCode in class Object
        Returns:
        the hashcode
      • toString

        public String toString()
        Returns a string representation of the action.
        Overrides:
        toString in class Object
        Returns:
        the string representation
      • getScriptlets

        public static String[] getScriptlets()
        Returns a list with classnames of filters.
        Returns:
        the filter classnames
      • forName

        public static AbstractScriptlet forName​(String classname)
        Instantiates the scriptlet.
        Parameters:
        classname - the classname of the scriptlet to instantiate
        Returns:
        the instantiated scriptlet or null if an error occurred