Functions

You can implement the functions provided here by the Script Connector. Even though some functions might never be called, it is recommended that you insert the functions with an error-signaling code that notifies the caller that the function is unsupported.

initialize
This function initializes the Connector. It is called before any of the other functions and should contain code that initializes basic parameters, establishes connections, and so forth.
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 must 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 must 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, then the Connector populates the entry object. If no entries are found, the Connector must set the error code in the result object to signal a failure to find the entry. If more than one entry is found, then the Connector might populate the array of duplicate entries. Otherwise, the same procedure is followed as when there are no entries found.
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 might silently ignore the search object, and use the entry object to determine which entry to modify.
putEntry
This function adds 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 might silently ignore the search object, and use the entry object to determine which entry to delete.
queryReply
This function is called when the Connector is used in Call/Reply mode.
querySchema
The querySchema() function is used to discover schema for this Connector. If implemented, a vector of Entry objects is returned for each column/attribute it discovered. The querySchema() function is only called when you "Open/Query" in the attribute map (not when you click the quick discovery button).
In order to support Schema discovery your Script Connector or -FC can contain code like this:
function querySchema() {
		config.getSchema(true).newItem("name-in");
		config.getSchema(true).newItem("address-in");
		config.getSchema(false).newItem("name-out");
		config.getSchema(false).newItem("address-out");
	}
This would create two items in the input and output schemas respectively. Check the SchemaConfig and SchemaItemConfig API (in the Javadocs) for more details.
terminate
This function is called when the Connector has finished its task. It should contain code that frees up any resources (for example, locks, connections) taken during its work.
According to the various modes, these are the minimum required functions you need to implement:
Table 1. Required functions
Mode Function you must implement
Iterator

selectEntries()
getNextEntry()

AddOnly putEntry()
Lookup findEntry()
Delete

findEntry()
deleteEntry()

Update

findEntry()
putEntry()
modEntry()

CallReply queryReply()