|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ca.jcs.processor.AbstractBaseProcessor
com.ca.jcs.processor.AbstractAttributeStyleOpProcessor
com.ca.jcs.processor.AbstractAttributeStyleOpProcessorAssocDirect
com.ca.jcs.assoc.DefaultAssocDirectAttributeOpProcessor
com.ca.jcs.sdk.SDKAttributeStyleOpProcessor
public class SDKAttributeStyleOpProcessor
Implements the mapping of LDAP account/group attributes onto local flat or hierarchical files, and back again when querying.
Note that for educational reasons this class includes examples of how association related attributes can be
processed separately from normal attributes, but such code is unlikely to be required in custom
connectors due to the framework support offered by AssocAttributeOpProcessorProxy
which can make all these calls automatically for you (note the SDKSCRIPT connector makes use of this support).
Making these calls explicitly also provides the opportunity to show the use of
AbstractAttributeStyleOpProcessor.proxiedSelf and
AbstractAttributeStyleOpProcessorAssocDirect.proxiedAssocSelf
so that if any opbindings are registered, then they will be run.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.ca.jcs.assoc.DefaultAssocDirectAttributeOpProcessor |
|---|
DefaultAssocDirectAttributeOpProcessor.AssocAttrValue, DefaultAssocDirectAttributeOpProcessor.AssociationStyle |
| Nested classes/interfaces inherited from interface com.ca.jcs.processor.OpProcessor |
|---|
OpProcessor.MethodName |
| Field Summary | |
|---|---|
static String |
ACCOUNT_EXT
Extension used for file storing information about an account. |
static String |
ACCOUNT_TYPE
|
static String |
CONTAINER_TYPE
|
static String |
FILE_SEP_REPLACEMENT
|
static String |
GROUP_EXT
Extension used for file storing information about a group. |
static String |
GROUP_TYPE
|
boolean |
isStreaming
Change this value and recompile to use the streaming approach to searching. |
static HashMap<String,String> |
TYPE_TO_EXT
|
| Fields inherited from class com.ca.jcs.assoc.DefaultAssocDirectAttributeOpProcessor |
|---|
metaConnector |
| Fields inherited from class com.ca.jcs.processor.AbstractAttributeStyleOpProcessorAssocDirect |
|---|
proxiedAssocSelf |
| Fields inherited from class com.ca.jcs.processor.AbstractAttributeStyleOpProcessor |
|---|
proxiedSelf |
| Fields inherited from class com.ca.jcs.processor.AbstractBaseProcessor |
|---|
ldapExceptionPrefix |
| Constructor Summary | |
|---|---|
SDKAttributeStyleOpProcessor(SDKMetaConnector connector)
Create connector. |
|
| Method Summary | |
|---|---|
void |
activate()
Sets proxiedSelf to OpBindings-aware proxy if any OpBindings are configured, otherwise left assigned to "this". |
void |
deactivate()
We also define this for symmetry as activate() is defined. |
void |
doAdd(ObjectInfo objInfo,
Attributes attrs)
Create an account or a group by creating a properties file and and persisting the provided attributes to it (account files have the extension .sdk eand groups file the .grp extention. |
void |
doDelete(ObjectInfo objInfo)
Deletes account or group by removing its file. |
Attributes |
doLookUp(ObjectInfo objInfo,
String[] attrIds)
Handles base level searches. |
Attribute |
doLookupExpensiveStub(ObjectInfo objInfo,
String attrId)
In some cases it may be possible to test for a value for an expensive attribute's presence without retrieving its full value, in which case this method can be used to populate stub with the matching number of values cheaply. |
void |
doModify(ObjectInfo objInfo,
ModificationItem[] modItems)
Modify an account or a group object, and persist changes to a .properties file. |
void |
doModifyRn(ObjectInfo objInfo,
Rdn newRdn)
Delete an account or a group by removing its file, and then add it again with a new name. |
void |
doMove(ObjectInfo objInfo,
Name newParentName,
Rdn newRn)
Note: You only implement this method if you are creating a hierarchical connector such as a directory that supports moving objects to different containers in the tree structure. |
NamingEnumeration<SearchResult> |
doSearch(ObjectInfo baseObjInfo,
FilterInfo filterInfo,
Map<String,String> environment,
SearchControls searchControls)
Handles all searches, or only onelevel and subtree searches if the connector defines isBehaviourSearchObjAsLookup() to return true (which SDKMetaConnector
does). |
DataModel |
getMetaData()
Just a stub as this processor has no specific requirement to store metadata. |
static String |
namingValueToFileName(String nameValue)
Convert provided name to valid file name, i.e. handle file system separator specially. |
void |
searchFiles(File parentDir,
FilenameFilter filenameFilter,
ArrayList<File> list,
SearchControls searchControls)
recursively look through all levels in the parentDir when the isSubtree flag is true, otherwise only search one level. |
void |
setMetaData(DataModel dataModel)
Just a stub as this processor has no specific requirement to store metadata. |
static Map<String,String> |
toSimpleRegexMap(FilterInfo filterInfo)
Similar to FilterUtil.toSimpleMap, but prepares a map containing regex expressions from the given filter to perform matching on. |
| Methods inherited from class com.ca.jcs.processor.AbstractAttributeStyleOpProcessorAssocDirect |
|---|
convertConnectorDNToKey, convertConnectorDNToKeys, convertKeyToConnectorDN |
| Methods inherited from class com.ca.jcs.processor.AbstractAttributeStyleOpProcessor |
|---|
isPostQueryPocessingActive, processPostQueryAttributes, processPostQuerySearchResult, setPostQueryPocessingActive |
| 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 |
|---|
public boolean isStreaming
public static final String ACCOUNT_TYPE
public static final String GROUP_TYPE
public static final String CONTAINER_TYPE
public static final String ACCOUNT_EXT
public static final String GROUP_EXT
public static final String FILE_SEP_REPLACEMENT
public static final HashMap<String,String> TYPE_TO_EXT
| Constructor Detail |
|---|
public SDKAttributeStyleOpProcessor(SDKMetaConnector connector)
AbstractBaseProcessor.ldapExceptionPrefix should be prefixed onto any
LdapNameingExceptions thrown so that clients can easily distinguish between exceptions
raised (and hence understand the exception more clearly):
connector - | Method Detail |
|---|
public DataModel getMetaData()
getMetaData in interface AttributeStyleOpProcessorgetMetaData in class DefaultAssocDirectAttributeOpProcessorpublic void setMetaData(DataModel dataModel)
dataModel - New metadata to be internalised.
public Attribute doLookupExpensiveStub(ObjectInfo objInfo,
String attrId)
throws NamingException
doLookupExpensiveStub in interface AttributeStyleOpProcessordoLookupExpensiveStub in class DefaultAssocDirectAttributeOpProcessorobjInfo - Object for which attribute should be looked up.attrId - Id for expensive attribute.
NamingExceptionValidationLazyAttributesProxy
public void activate()
throws NamingException
AbstractAttributeStyleOpProcessor
activate in interface Activatableactivate in interface AttributeStyleOpProcessoractivate in class AbstractAttributeStyleOpProcessorAssocDirectNamingException
public void deactivate()
throws NamingException
AbstractAttributeStyleOpProcessor
deactivate in interface Activatabledeactivate in interface AttributeStyleOpProcessordeactivate in class AbstractAttributeStyleOpProcessorNamingExceptionpublic static String namingValueToFileName(String nameValue)
public void doAdd(ObjectInfo objInfo,
Attributes attrs)
throws NamingException
.sdk eand groups file the .grp extention.
objInfo - Contains the target object's class type information. Use it to distinguish account objects and group
objects or other types of objects, as well as accessing metadata settings (and fields calculated
from them allowing fast lookup) via objInfo.getObjectClassMapping() where required.attrs - Attributes to be persisted for the target object.
LdapNameAlreadyBoundException - Should be thrown if an object
with the specified name already exists, other NamingExceptions (preferably
implementing LdapException) may also be thrown. Pay attention to
retriable exceptions as documented in RetryOpProcessorProxy.
NamingException - (usually exception should implement
LdapException or arrangements to map it into
such an exception should be in place). Pay attention to
retriable exceptions as documented in RetryOpProcessorProxy.
public void doDelete(ObjectInfo objInfo)
throws NamingException
objInfo - References managed object to be deleted.
LdapNameNotFoundException - (or
NameNotFoundException) when target object doesn't exist.
NamingException - (usually exception should implement
LdapException or arrangements to map it into
such an exception should be in place). Pay attention to
retriable exceptions as documented in RetryOpProcessorProxy.
public void doModify(ObjectInfo objInfo,
ModificationItem[] modItems)
throws NamingException
.properties file. For the
multi-valued eTSDKGroupMembers attribute, the forceModificationMode=REPLACE
metadata setting (refer to sdk_metadata.xml) means the attribute values received
here are the complete list of required REPLACE values (not the equivalent ADD or REMOVE deltas against the
existing set of values). Also all of these values have been concatenated into a single string value
through the triggering of DemoFlattenPropertyConverter via the flattenSeparator
setting in sdk_metadata.xml combined with the related plug-in configuration in
conf/connector.xml, which is done because Properties files don't accept duplicated
keys.
objInfo - References managed object which is to be modified.modItems - Items to be modified.
LdapNameNotFoundException - (or
NameNotFoundException) when target object doesn't exist.
NamingException - (usually exception should implement
LdapException or arrangements to map it into
such an exception should be in place). Pay attention to
retriable exceptions as documented in RetryOpProcessorProxy.public static Map<String,String> toSimpleRegexMap(FilterInfo filterInfo)
filterInfo -
public NamingEnumeration<SearchResult> doSearch(ObjectInfo baseObjInfo,
FilterInfo filterInfo,
Map<String,String> environment,
SearchControls searchControls)
throws NamingException
isBehaviourSearchObjAsLookup() to return true (which SDKMetaConnector
does). See the super class OpProcessor Java Doc for details.
Note that normally enumerations extending RawNamingEnumeration are returned as it
handles the case where searchControls specifies a size limit and / or time limit.
In such cases search results are returned back to the LDAP client up until the limit is
exceeded and then a non-fatal informative exception is thrown *after* these results have already
been delivered back to the client.
baseObjInfo - Specifies base object for the search, scope in searchControls
is relative to this object.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 not attributes to be returned except for the DNs of matching objects.
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):doSearch() call has returned.LdapNameNotFoundException - (or
NameNotFoundException) when target object doesn't exist.
NamingException - (usually exception should implement
LdapException or arrangements to map it into
such an exception should be in place). Pay attention to
retriable exceptions as documented in RetryOpProcessorProxy.
public void searchFiles(File parentDir,
FilenameFilter filenameFilter,
ArrayList<File> list,
SearchControls searchControls)
parentDir - directory in which files should be found.filenameFilter - filter to be applied to files under parentDirlist - the list passed by the callersearchControls - specifies parameters for search, such as scope and count limit.
public Attributes doLookUp(ObjectInfo objInfo,
String[] attrIds)
throws NamingException
OpProcessor Java Doc for detials
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).
attrIds, can be null when the target object exists
but has none of the requested
LdapNameNotFoundException - (or
NameNotFoundException) when target object doesn't exist.
NamingException - (usually exception should implement
LdapException or arrangements to map it into
such an exception should be in place). Pay attention to
retriable exceptions as documented in RetryOpProcessorProxy.
public void doModifyRn(ObjectInfo objInfo,
Rdn newRdn)
throws NamingException
newRdn has format attribute=value.
objInfo - References managed object.newRdn - New terminal name (having form "attr=val") for managed object.
LdapNameNotFoundException - (or
NameNotFoundException) when target object doesn't exist.
NamingException - (usually exception should implement
LdapException or arrangements to map it into
such an exception should be in place). Pay attention to
retriable exceptions as documented in RetryOpProcessorProxy.
public void doMove(ObjectInfo objInfo,
Name newParentName,
Rdn newRn)
throws NamingException
objInfo - Information about target object to be moved.newParentName - DN of container to which target object should be moved.newRn - Null when object is simply being moved to a new container, otherwise
object is being both moved and renamed in one operation.
NamingException
LdapNameNotFoundException - (or
NameNotFoundException) when target object doesn't exist.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||