com.ca.jcs.jdbc
Class JDBCScriptStyleOpProcessor

java.lang.Object
  extended by com.ca.jcs.processor.AbstractBaseProcessor
      extended by com.ca.jcs.processor.AbstractScriptStyleOpProcessor
          extended by com.ca.jcs.jdbc.JDBCScriptStyleOpProcessor
All Implemented Interfaces:
Activatable, ScriptStyleOpProcessor

public class JDBCScriptStyleOpProcessor
extends AbstractScriptStyleOpProcessor

Executes SQL scripts generated by scripts via MetaOpBindingsProxyHandler using configured opbindings.


Field Summary
protected  JDBCMetaConnector connector
           
 
Fields inherited from class com.ca.jcs.processor.AbstractBaseProcessor
ldapExceptionPrefix, log
 
Constructor Summary
JDBCScriptStyleOpProcessor(BaseConnector connector)
          Transaction management works without needing to explicitly refer to connector's transactionManager because managed implicitly using datasource and JDBCStoredProcedure.
 
Method Summary
 void activate()
          This method is called when the target object has been fully initialised, and is ready to receive requests.
 void deactivate()
          This method is called when the target object is no longer needed and should tidy-up any connections / resources it holds.
 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()
           
 Opbindings getOpBindings()
           
 void setMetaData(Opbindings opbindings)
          Called when metadata used to configure this connector is changed.
 void setOpBindings(Opbindings opBindings)
           
 
Methods inherited from class com.ca.jcs.processor.AbstractBaseProcessor
getBaseConnector, makeNamingException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connector

protected final JDBCMetaConnector connector
Constructor Detail

JDBCScriptStyleOpProcessor

public JDBCScriptStyleOpProcessor(BaseConnector connector)
Transaction management works without needing to explicitly refer to connector's transactionManager because managed implicitly using datasource and JDBCStoredProcedure.

Method Detail

activate

public void activate()
              throws NamingException
Description copied from interface: Activatable
This method is called when the target object has been fully initialised, and is ready to receive requests.

Throws:
NamingException

deactivate

public void deactivate()
                throws NamingException
Description copied from interface: Activatable
This method is called when the target object is no longer needed and should tidy-up any connections / resources it holds.

Throws:
NamingException

getOpBindings

public Opbindings getOpBindings()

setOpBindings

public void setOpBindings(Opbindings opBindings)
                   throws NamingException
Throws:
NamingException

getMetaData

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

setMetaData

public void setMetaData(Opbindings opbindings)
                 throws NamingException
Description copied from interface: ScriptStyleOpProcessor
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

public void doDelete(ObjectInfo objInfo,
                     String scriptText)
              throws NamingException
Description copied from interface: ScriptStyleOpProcessor
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

public void doAdd(ObjectInfo objInfo,
                  Attributes attrs,
                  String scriptText)
           throws NamingException
Description copied from interface: ScriptStyleOpProcessor
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

public void doModify(ObjectInfo objInfo,
                     ModificationItem[] items,
                     String scriptText)
              throws NamingException
Description copied from interface: ScriptStyleOpProcessor
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[])

doModifyRn

public void doModifyRn(ObjectInfo objInfo,
                       String newRdn,
                       String scriptText)
                throws NamingException
Description copied from interface: ScriptStyleOpProcessor
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

public void doMove(ObjectInfo objInfo,
                   Name newParentName,
                   String newRdn,
                   String scriptText)
            throws NamingException
Description copied from interface: ScriptStyleOpProcessor
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 ScriptStyleOpProcessor.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

public void doMove(ObjectInfo objInfo,
                   Name newParentName,
                   String scriptText)
            throws NamingException
Description copied from interface: ScriptStyleOpProcessor
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)

doSearch

public NamingEnumeration<SearchResult> doSearch(ObjectInfo baseObjInfo,
                                                FilterInfo filterInfo,
                                                Map<String,String> environment,
                                                SearchControls searchControls,
                                                String scriptText)
                                         throws NamingException
Description copied from interface: ScriptStyleOpProcessor
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.

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

public Attributes doLookup(ObjectInfo objInfo,
                           String[] attrIds,
                           String scriptText)
                    throws NamingException
Description copied from interface: ScriptStyleOpProcessor
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[])


Created 2011-07-14 13:27 EST