Class ScriptComponent

  • All Implemented Interfaces:
    java.util.Map

    public class ScriptComponent
    extends AssemblyLineComponent
    This class is used by the AssemblyLine for scripts.
    • Constructor Detail

      • ScriptComponent

        public ScriptComponent​(AssemblyLine parent,
                               java.lang.String name,
                               ScriptConfig config,
                               ConnectorInterface conn)
                        throws java.lang.Exception
        Constructor.
        Parameters:
        parent - the AssemblyLine using this component
        name - the name of hte component
        config - script configuration of this component
        conn - an optional connector to use if needed
        Throws:
        java.lang.Exception - if problem occurs
      • ScriptComponent

        public ScriptComponent​(AssemblyLine parent,
                               java.lang.String name,
                               ConnectorConfig config,
                               ConnectorInterface conn)
                        throws java.lang.Exception
        Constructor for the script component object.
        Parameters:
        parent - the parent AssemblyLine.
        name - the component's name given by the AssemblyLine.
        config - the configuration.
        conn - an optional connector to use if needed
        Throws:
        java.lang.Exception - if problem occurs
    • Method Detail

      • initialize

        public void initialize()
                        throws java.lang.Exception
        This method initializes the script engine.
        Overrides:
        initialize in class AssemblyLineComponent
        Throws:
        java.lang.Exception - if initialization encounters problems
      • getScriptConfiguration

        public ScriptConfig getScriptConfiguration()
        This method returns the Script configuration.
        Returns:
        the script configuration
        Since:
        7.0
      • getType

        public int getType()
        Returns ServerConstants.TYPE_SCRIPT
        Overrides:
        getType in class AssemblyLineComponent
        Returns:
        the ServerConstants.TYPE_SCRIPT value
      • add

        public void add​(Entry meta)
                 throws java.lang.Exception
        This method executes the script. If an error occurs, it will also declare the error bean.
        Overrides:
        add in class AssemblyLineComponent
        Parameters:
        meta - Entry parameter
        Throws:
        java.lang.Exception - if error occurs
      • add1

        public void add1​(Entry meta)
                  throws java.lang.Exception
        This method executes the script.
        Parameters:
        meta - Entry parameter
        Throws:
        java.lang.Exception - if error occurs
      • trigger

        public boolean trigger​(java.lang.String oper)
        Calls the hook named oper.
        Overrides:
        trigger in class AssemblyLineComponent
        Parameters:
        oper - Name of the hook to call.
        Returns:
        True if the hook was executed, false if the hook is not defined or disabled.
      • trigger

        public boolean trigger​(java.lang.String oper,
                               Entry work)
        Calls the hook named oper, declaring work as the corresponding bean. The trigger function calls one of the AssemblyLine hooks defined for this Connector using the provided work.
        Overrides:
        trigger in class AssemblyLineComponent
        Parameters:
        oper - Name of the hook to call.
        work - This will be the work bean in the hook.
        Returns:
        True if the hook was executed, false if the hook is not defined or disabled.
      • trigger

        public boolean trigger​(java.lang.String oper,
                               Entry work,
                               Entry conn)
        Calls the hook named oper, declaring work and conn as the corresponding beans. The trigger function calls one of the AssemblyLine hooks defined for this Connector using the provided conn/work.
        Overrides:
        trigger in class AssemblyLineComponent
        Parameters:
        oper - Name of the hook to call.
        work - This will be the work bean in the hook.
        conn - This will be the conn bean in the hook
        Returns:
        True if the hook was executed, false if the hook is not defined or disabled.
      • willExecute

        public boolean willExecute​(Entry work)
                            throws java.lang.Exception
        Return true/false if this component should be executed.
        Overrides:
        willExecute in class AssemblyLineComponent
        Parameters:
        work - the work Entry object
        Returns:
        true if this component should be executed, otherwise false
        Throws:
        java.lang.Exception - if problem occurs