Class CommandLineConnector

  • All Implemented Interfaces:
    ConnectorInterface, VersionInfoInterface

    public class CommandLineConnector
    extends Connector
    implements ConnectorInterface
    The command line Connector enables you to read the output from a command line or pipe data to a command line's standard input. Every command argument is separated by a space character, and quotes are ignored. The command is executed on the local machine. The Connector supports Iterator and AddOnly mode, as well as CallReply mode.
    • Field Detail

      • ATTR_COMMAND_LINE

        public static final java.lang.String ATTR_COMMAND_LINE
        The name of the attribute in which the command line has to be put in CallReply mode
        See Also:
        Constant Field Values
      • ATTR_COMMAND_OUTPUT

        public static final java.lang.String ATTR_COMMAND_OUTPUT
        The name of the attribute in which the result of the executed command in CallReply mode is stored
        See Also:
        Constant Field Values
    • Constructor Detail

      • CommandLineConnector

        public CommandLineConnector()
        Constructor. Initializes the connector to work in AddOnly, Iterator and CallReply modes
    • Method Detail

      • initialize

        public void initialize​(java.lang.Object o)
                        throws java.lang.Exception
        Initialize the connector. The connector may be passed a parameter of any kind by the user. It is up to the connector to determine whether this object can be used or not. The parameter is typically provided by a user script. When an AssemblyLine initializes it's Connectors, they are passed a ConnectorMode object.
        Specified by:
        initialize in interface ConnectorInterface
        Overrides:
        initialize in class Connector
        Parameters:
        o - Expects the ConnectorMode
        Throws:
        java.lang.Exception - if the initialization of this connector fails.
      • terminate

        public void terminate()
                       throws java.lang.Exception
        Terminate the connector. If a parser exists it is being closed.
        Specified by:
        terminate in interface ConnectorInterface
        Overrides:
        terminate in class Connector
        Throws:
        java.lang.Exception - if an error occurs.
      • putEntry

        public void putEntry​(Entry entry)
                      throws java.lang.Exception
        Add a new entry to the data source
        Specified by:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        Parameters:
        entry - The entry data to add
        Throws:
        java.lang.Exception - if an error occurs.
      • queryReply

        public Entry queryReply​(Entry aEntry)
                         throws java.lang.Exception
        In a CallReply mode executes the command stored in the attribute of the given Entry with name CommandLineConnector.ATTR_COMMAND_LINE and stores the result in the returned Entry in an attribute with name CommandLineConnector.ATTR_COMMAND_OUTPUT.
        Specified by:
        queryReply in interface ConnectorInterface
        Overrides:
        queryReply in class Connector
        Parameters:
        aEntry - The Entry with the command line to be executed.
        Returns:
        an Entry containing the result from the executed command line.
        Throws:
        java.lang.Exception - if an error occurs.
      • getVersion

        public java.lang.String getVersion()
        Version information.
        Specified by:
        getVersion in interface VersionInfoInterface
        Returns:
        version information