|
|
Script ConnectorOverviewThe Script Connector allows you to write your own Connector using a script you are familiar with. A Script Connector must implement a few functions in order to operate. If you plan to use it for iteration purposes only (i.e. reading not searching/updating) you get by with two functions alone. If you plan to use it as a fully qualified Connector you must implement all functions. The functions do not use parameters. The reason for this is that some scripting languages will not necessarily support this. Passing data between the hosting Connector and the script is obtained by using predefined objects. One of these predefined objects is the result object which is used to communicate status information. Upon entry in either function the status field is set to "normal" which will cause the hosting Connector to continue calls. Signaling end-of-input or errors is done by setting the status and message fields in this object. Two other script objects are defined upon function entry. These are the entry object and the search object. Predefined Script ObjectsThe result object
The entry objectPlease refer to the entry object page for a description of the entry object. The search objectPlease refer to the search criteria object page for a description of the search object. FunctionsThe following functions must be implemented by the Connector. Even though some functions may never be called it is recommended that you insert the functions with a error signaling code that notifies that caller the function is unsupported. selectEntries This function is called to prepare the Connector for sequential read. When this function is called it is typically because the Connector is used as an Iterator in an AssemblyLine. getNextEntry This function should populate the entry object with attributes and values from the next entry in the input set. When the Connector has no more entries to return it should use the result object to signal end of input back to the caller. findEntry The findEntry function is called to find an entry in the connected system that matches the criteria specified in the search object. If the Connector finds a single matching entry it is expected that the Connector populates the entry object. If no entries were found the Connector should set the error code in the result object to signal a failure to find the entry. If more than one entry were found then the Connector may populate the array of duplicate entries. Otherwise, the same procedure as no entries found should be followed. modEntry This function is called to modify an existing entry in the connected system. The new entry data is given by the entry object, and the search object specifies which entry to modify. Some connectors may silently ignore the search object, and use the entry object to determine which entry to modify. putEntry This function should add the entry object to the connected system. deleteEntry This function is called to delete an existing entry in the connected system. The search object specifies which entry to delete. Some connectors may silently ignore the search object, and use the entry object to determine which entry to delete. ConfigurationThe Connector needs the following parameters:
NoteWhen you use a Script Connector (or Parser), the script gets copied from the Library where it resides and into your configuration file. This has the advantage of you being able to customise the script, but the caveat that new versions will not be known to your AssemblyLine. Removing the old script Connector from the AssemblyLine and re-introducing it will get you around this (but remember to copy over code from your hooks!) ExampleDemo package containing a ready to run configuration for a Script Connector in JavaScript. See Also
|
|
|