com.ca.jcs.processor.script
Interface ScriptStyleOpProcessor

All Superinterfaces:
Activatable
All Known Implementing Classes:
AbstractScriptStyleOpProcessor, JDBCScriptStyleOpProcessor

public interface ScriptStyleOpProcessor
extends Activatable

Interface very closely related to OpProcessor except that its methods take native scripts targeting their host connector (eg SQL for JDBC) to be executed in order to carry out operations on their target managed objects. Note that activate() is called when processors for all styles have been assigned to the parent connector (which has been fully initialised and is ready to receive requests).

Implementing classes may well handle all updates (doAdd(), doModify(), doDelete(), doMove()) using the same underling script execution code because none return a value, but they are still presented as separate methods in this interface to offer the possibility of using "special case" Java code to assist execution of the script if required. Whilst possible such code should still be avoided where possible as it represents extra information which must be passed on to script authors.

An alternative approach would have been to use an interface based on MethodStyleOpProcessor with an additional scriptText argument, resulting in a single doUpdate() method. This was not done because, unlike the method-style case (e.g. Stored Procedures for JDBC), it is expected that supported scripting languages will be able to directly access Java objects and avoid the need for simplifying user-defined mappings for inbound and outbound attributes.

Refer to the cacom module's opbindings.xsd.


Method Summary
 void doAdd(ObjectInfo objInfo, Attributes attrs, String scriptText)
          Create a new object on the managed system with the provided attributes stored for it.
 void doDelete(ObjectInfo objInfo, String scriptText)
          Delete the object referenced by objInfo from a managed system.
 Attributes doLookup(ObjectInfo objInfo, String[] attrIds, String scriptText)
          Look up the provided attribute names on the managed object referenced by objInfo, attribute ids not mapped to connector-speak will either be discarded or cause an error depending on the level of strictness configured for the parent connector.
 void doModify(ObjectInfo objInfo, ModificationItem[] items, String scriptText)
          Apply the provided items to the object on the managed system referenced by objInfo.
 void doModifyRn(ObjectInfo objInfo, String newRdn, String scriptText)
          Rename the managed object referenced by objInfo so that it has the new Relative Distinguished Name (RDN) provided (an example newRdn might be nameAttrId=MyNewName).
 void doMove(ObjectInfo objInfo, Name newParentName, String scriptText)
          Move managed object to a new parent.
 void doMove(ObjectInfo objInfo, Name newParentName, String newRdn, String scriptText)
          Move the managed object referenced by objInfo to a new parent whilst also changing its RDN (of form "attr=value").
 NamingEnumeration<SearchResult> doSearch(ObjectInfo baseObjInfo, FilterInfo filterInfo, Map<String,String> environment, SearchControls searchControls, String scriptText)
          Perform search under specified baseName on managed system, using the standard JNDI interfaces and semantics.
 Opbindings getMetaData()
           
 void setMetaData(Opbindings opbindings)
          Called when metadata used to configure this connector is changed.
 
Methods inherited from interface com.ca.jcs.Activatable
activate, deactivate
 

Method Detail

getMetaData

Opbindings getMetaData()
Returns:
Metadata used to configure this connector.

setMetaData

void setMetaData(Opbindings opbindings)
                 throws NamingException
Called when metadata used to configure this connector is changed.

Parameters:
opbindings - New opBindings to be internalised, where only script payloads are included.
Throws:
NamingException

doDelete

void doDelete(ObjectInfo objInfo,
              String scriptText)
              throws NamingException
Delete the object referenced by objInfo from a managed system.

Parameters:
objInfo - References managed object to be deleted.
scriptText - Connector's native script to be executed to delete object.
Throws:
NamingException
See Also:
OpProcessor.doDelete(com.ca.jcs.ObjectInfo)

doAdd

void doAdd(ObjectInfo objInfo,
           Attributes attrs,
           String scriptText)
           throws NamingException
Create a new object on the managed system with the provided attributes stored for it.

Parameters:
objInfo - Contains information for the managed object which is to be created, where its connector-speak distinguished Name (DN) is dictated by objInfo.getConnectorDn() and its objectClass= is dictated by objInfo.getobjectClassMapping().
attrs - Attributes to be stored on the managed object.
scriptText - Connector's native script to be executed to add object.
Throws:
NamingException
See Also:
OpProcessor.doAdd(ObjectInfo, Attributes)

doModify

void doModify(ObjectInfo objInfo,
              ModificationItem[] items,
              String scriptText)
              throws NamingException
Apply the provided items to the object on the managed system referenced by objInfo.

Parameters:
objInfo - References managed object which is to be modified.
items - Modifications to be applied to the referenced object.
scriptText - Connector's native script to be executed to modify object.
Throws:
NamingException
See Also:
OpProcessor.doModify(ObjectInfo, ModificationItem[])

doSearch

NamingEnumeration<SearchResult> doSearch(ObjectInfo baseObjInfo,
                                         FilterInfo filterInfo,
                                         Map<String,String> environment,
                                         SearchControls searchControls,
                                         String scriptText)
                                         throws NamingException
Perform search under specified baseName on managed system, using the standard JNDI interfaces and semantics. All values (DN/filter/return attribute ids) have been mapped into connector-speak by the time this method is called.

Parameters:
baseObjInfo -
filterInfo - Information regarding the filter to be used for the search, including referenced objectClass= values. Note that attribute names have been converted to connector-speak and any required validators/converters have been run by the framework prior to this method being invoked. The filter's text can be retrieved via ExprNode.printToBuffer(StringBuffer) on contained mappedFilter. If required this mappedFilter can be converted to a different syntax, refer to SimpleFilterVisitor / FilterVisitor and related classes.
environment - Defines any values effecting how the search is performed (eg whether to follow referrals etc). Can usually be ignored.
searchControls - Defines important information about the search itself, for instance what scope the search should have under baseName and which attributes should be returned for each object matching the provided filter. Note that specifying a null String[] for the returned attributes will cause all non-expensive attributes to be returned for each matching objects, whereas specifying String[0] will cause no attributes to be returned except for the DNs of matching objects.
scriptText - Connector's native script to be executed to perform search.
Returns:
Enumeration of SearchResult objects, one per object falling within the specified scope under baseName which matches the provided filter. Results can be handled in two different manners depending on the connector's requirement (indeed, an advanced connector can implement both and choose the best one based on heuristics and a threshold):
  1. Pass back results "all at once" (faster, but impractical for very large numbers of matching objects) or
  2. "stream" results back one at a time by wrapping in a NamingEnumeration that actually extracts results after this doSearch() call has returned.
Throws:
NamingException
See Also:
OpProcessor.doSearch(com.ca.jcs.ObjectInfo,com.ca.jcs.filter.FilterInfo,Map,javax.naming.directory.SearchControls)

doLookup

Attributes doLookup(ObjectInfo objInfo,
                    String[] attrIds,
                    String scriptText)
                    throws NamingException
Look up the provided attribute names on the managed object referenced by objInfo, attribute ids not mapped to connector-speak will either be discarded or cause an error depending on the level of strictness configured for the parent connector. Extra attributes may also be returned.

Parameters:
objInfo - Managed object for which attributes are to be looked up.
attrIds - Connector-speak identifiers of attributes which are to be returned, null means return all attributes and a zero length array means return no attributes (just a way to check an object's existance).
scriptText - Connector's native script to be executed to perform lookup.
Returns:
Attributes values on specified managed object, where connector-speak mappings exist for specified attrIds.
Throws:
NamingException
See Also:
OpProcessor.doLookUp(ObjectInfo, String[])

doModifyRn

void doModifyRn(ObjectInfo objInfo,
                String newRdn,
                String scriptText)
                throws NamingException
Rename the managed object referenced by objInfo so that it has the new Relative Distinguished Name (RDN) provided (an example newRdn might be nameAttrId=MyNewName).

Parameters:
objInfo - References managed object.
newRdn - New terminal name (having form "attr=val") for managed object.
scriptText - Connector's native script to be executed to perform rename.
Throws:
NamingException
See Also:
OpProcessor.doModifyRn(com.ca.jcs.ObjectInfo,javax.naming.ldap.Rdn)

doMove

void doMove(ObjectInfo objInfo,
            Name newParentName,
            String newRdn,
            String scriptText)
            throws NamingException
Move the managed object referenced by objInfo to a new parent whilst also changing its RDN (of form "attr=value").

Parameters:
objInfo - References managed object to be moved.
newParentName - New parent for managed object.
newRdn - New relative distinguished name (RDN) for managed object, will be different from the object's current RDN or doMove(ObjectInfo, Name, String) will have been called instead.
scriptText - Connector's native script to be executed to perform move + rename.
Throws:
NamingException
See Also:
OpProcessor.doMove(com.ca.jcs.ObjectInfo,javax.naming.Name,javax.naming.ldap.Rdn)

doMove

void doMove(ObjectInfo objInfo,
            Name newParentName,
            String scriptText)
            throws NamingException
Move managed object to a new parent.

Parameters:
objInfo - References managed object to be moved.
newParentName - New parent for managed object.
scriptText - Connector's native script to be executed to perform move.
Throws:
NamingException
See Also:
com.ca.jcs.processor.OpProcessor#doMove(ObjectInfo, Name)


Created 2011-07-14 13:27 EST