GitHubContribute in GitHub: Open doc issue|Edit online

Using properties

During the lifetime of the AssemblyLine, the IBM® Security Verify Directory Integrator Server makes available a number of component Properties, related to the execution environment of the AssemblyLine, that you can query in your scripts: either from Script Components or Component Hooks. One property (lastCallStatus) can even be set.

You access the properties by using an AssemblyLine object, for example, a Connector and call its method get(property_name) to extract the property_name value; alternatively, use the put(property_name, property_value) method to set the property to the required value. When setting properties, the property name or property value cannot be null; if one of them is null an Exception with an appropriate message will be thrown.

The set of properties available is as follows:

Property Usage
numErrors The number of errors occurred.
numAdd Total number of entries the AssemblyLine has added (performed by Connectors in AddOnly mode).
numModify Total number of entries the AssemblyLine has modified (performed by Connectors in Update mode).
numDelete Total number of entries the AssemblyLine has deleted (performed by Connectors in Delete mode).
numGet Total number of entries the AssemblyLine has retrieved (performed by Connectors in Iterator mode).
numGetTries Total number of times the AssemblyLine has attempted to retrieve an entry (performed by Connectors in Iterator mode).
numGetClient Total number of accepted Clients (available for Connectors in Server mode).
numGetClientTries Total number of times the AssemblyLine has attempted to get the next connected client (performed by Connectors in Server mode).
numCallreply Total number of Call/Reply operations the AssemblyLine has executed (performed by Connectors in CallReply mode).
numLookup Total number of Lookup operations the AssemblyLine has executed (performed by Connectors in Update/Delete/Lookup mode).
numNoChange Total number of entries the AssemblyLine processed but left unchanged.
numSkipped Total number of entries the AssemblyLine has skipped.
numIgnored Total number of entries the AssemblyLine has ignored (performed by Connectors in Update/Delta mode).
lastCallStatus Contains the status for the AL execution. It is not just a read-only property and can be modified by you. The value of this property is “fail” or “success” dependant on the AL execution.
lastConn The Conn entry from the last Connector operation. Before the first Connector operation, lastConn has a value of null.
lastError The last error as a Java™ object.
hooksInvoked A java.util.List of the names of the hooks invoked the last time the Component was invoked. The names are internal names.
success This property is set to true if the last operation was a success, and false otherwise.
endOfData True when the Iterator Component has reached End of Data, false otherwise. Changing this property has no effect.

Table 1. Component properties available during AssemblyLine Execution

Note: If an attempt is made to change a read-only property then an Exception with appropriate message will be thrown.

Example

To illustrate the use of these Component Properties, let's assume you have a FileSystem Connector called FS, and some Script Components. The following JavaScript Code is in the "GetNext Successful" hook of FS:

if(work.getString("ID") == null)
throw new java.lang.Exception("Missing ID");
//for the AL Cycle to execute properly I need an ID, so throw an Exception

And this JavaScript Code is in the "DefaultOnError" hook of FS:

if(FS.get("lastError").getMessage().equals(“Missing ID”)) {
//I could fix this by adding an ID which would help AL execution
    work.setAttribute(“ID”, “SomeID”); //add the ID
    if(FS.get("fixErrors") == null) {
        var vector = new java.util.Vector();
        vector.add(FS.get("lastError"));
        FS.put("fixErrors", vector);//save all fixed errors in my custom property
    } else {//I have previously fixed similar error
        var vector = FS.get("fixErrors");
        vector.add(FS.get("lastError"));
        FS.put("fixErrors", vector); //save all fixed errors in my custom property
    }
    FS.put("lastCallStatus", "success");
} else {//I could not fix this error
    if(FS.get("notFixErrors") == null) {
        var vector = new java.util.Vector();
        vector.add(FS.get("lastError"));
        FS.put("notFixErrors", vector); //save all not fixed errors in my custom property
    } else {
        var vector = FS.get("notFixErrors");
        vector.add(FS.get("lastError"));
        FS.put("notFixErrors", vector); //save all not fixed errors in my custom property
    }
    FS.put("lastCallStatus", "fail");
}

Finally, in a Script Component, consider the following code:

main.logmsg("AL Cycle status: " + FS.get("lastCallStatus"));
//print the AL status for this AL Cycle
//I can also report all errors which have occurred
// during the AL Execution through my custom property, "vector"