|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ca.jcs.meta.MetaConnectorFactory
public class MetaConnectorFactory
Factory driven by metadata contained in attributes of ConnectorType objects (aka Endpoint Type, formerly Namespace). It's functions
include:
/conf/connector.xml files via Spring XML), and matching them to the LDAP requests they are designed to process.
| Field Summary | |
|---|---|
static String |
ATTR_NAMESPACE_FAMILY
Attribute name for a namespace family (used by ConnXp to determine dynamic connectors) |
static String |
ATTR_OBJECT_CLASS
Attribute name for the object class |
static String |
CUSTOM_METADATA_ATTR
connectorMapTo= value for sparse metadata to be merged over the top of static metadata, see ImplBundle.getCustomMetadataFile(). |
static String |
IMPL_BUNDLE_TAG
|
static String |
LOG_DEST_ATTR
|
static String |
SKIP_PERSISTER_DELETE_LDAP_ATTR
Mapping for BaseConnector.CONN_SKIP_PERSISTER_DELETE_ATTR on Connector Types/Connectors. |
static String |
STR_VALUE_TAG
|
static String |
VALUE_NAMESPACE_FAMILY_DYNAMIC
Namespace family value for dynamic connector types |
static String |
VALUE_OBJECT_CLASS_DYN_NAMESPACE
Object class value for a dynamic namespace |
| Constructor Summary | |
|---|---|
MetaConnectorFactory()
|
|
| Method Summary | |
|---|---|
ImplBundle |
addConnectorTypeStaticAttributes(String connTypeName,
Attributes attrs)
Adds the static attributes (metadata, op bindings) of a connector type to an existing group of attributes. |
void |
addImplBundle(ImplBundle implBundle,
boolean replaceExisting)
Add a single implBundle, replacing any old bundle with the same name |
void |
clearMetadataAttributesValues(Attributes attrs,
ModificationItem[] items)
When modifying the metadata and opbinding metadata attributes, sometimes the clients like JX sends down the multi-valued modification form (in Add mode) to JCS, hence JCS adds the replaced attribute value at the end of the existing values. |
DataModel |
convertMetadata(String connTypeName,
Attributes attrs)
|
protected DataModel |
convertMetadata(String connTypeName,
String metaData,
String customMetaData)
|
Opbindings |
convertOpBindingMetadata(String connTypeName,
String metadata)
Convert XML opbindings containing at least one of method-style and script-style bindings for operations. |
Connector |
createConnector(ConnectorType connType,
String namingAttr,
String name,
LdapDN suffix,
Attributes attrs)
Create a connector based on parent type's metadata, the provided attrs and the default connector config stored on parent connType. |
ConnectorType |
createConnectorType(String connTypeName,
Attributes attrs)
Creates a MetaConnectorType capable of broadcasting
metadata changes to contained connectors. |
ImplBundle |
createImplBundle(String connectorXML)
Dynamically create a bundle from connector.xml content and register it for use |
ImplBundle |
createImplBundle(String connTypeName,
DataModel model)
Dynamically create a bundle for an endpoint type from connector.xml content in metadata if present |
Logger |
createLogger(String connTypeName,
String connName)
Create logger for connector, which also means creating an appender for it which uses the connector's connName. |
void |
destroyConnectorType(String connTypeName)
Destroys a MetaConnectorType instance identified by name. |
void |
destroyLogger(Logger connLog)
|
ImplBundle |
findImplBundle(String connTypeName,
Attributes attrs)
Attempt to find a suitable ImplBundle amongst statically registered ones |
List<String> |
getAcceptedUnknownAttrIds()
|
String |
getConfDirectory()
|
String |
getConnectorFilePath(String connTypeName,
String connName)
|
ConnectorPersister |
getConnectorPersister()
|
String |
getConnectorTypeFilePath(String connTypeName)
|
ConverterManager |
getConverterManager()
|
DataModel |
getDataModel(String connTypeName,
Attributes attrs)
Get the datamodel representation of any metadata set in the connectorType's attributes |
String |
getDynamicConnectorXML(DataModel datamodel)
Given DataModel instance for the metadata on endpointType, string representation of any embedded connectorXML metadata |
ImplBundle |
getImplBundleFromConnectorTypeName(String connTypeName)
|
ImplBundle |
getImplBundleFromName(String name)
|
ImplBundle |
getImplBundleFromObjectClass(Attribute objClassAttr)
|
ImplBundle |
getImplBundleFromObjectClass(String connTypeObjClass)
|
ImplBundle |
getImplBundleFromString(String connectorXML)
Given a string representing connectorXML file content, return the corresponding implBundle bean |
String[] |
getImplBundleNames()
Get all names for currently installed JCS connectors. |
List<ImplBundle> |
getImplBundles()
List[ ImplBundle]. |
protected void |
getImplBundleStaticOpbindingsMetadata(ImplBundle implBundle,
Attributes attrs)
|
String |
getLogLevelAttr()
|
org.springframework.context.MessageSource |
getMessageSource()
|
String |
getMetadata(Attributes attrs)
|
String |
getMetaDataAttr()
|
String |
getMetaDataTimestampAttr()
|
String |
getOpBindingMetadata(Attributes attrs)
|
String |
getOpBindingMetaDataAttr()
|
String |
getOpBindingMetaDataTimestampAttr()
|
ValidatorManager |
getValidatorManager()
|
boolean |
isAllowMetadataModify(ImplBundle implBundle)
To determine if the metadata files (eTMetadata and eTOpbindingMetadata) are allowed to modify based on the settings in isAllowMetadataModifyGlobally defined in server_jcs.xml and isAllowMetadataModify in connector.xml. |
boolean |
isAllowMetadataModifyGlobally()
|
static boolean |
isDynamicConnectorType(Attributes attrs)
Method to check if a connector type is dynamic based on it's attributes alone. |
boolean |
isDynamicConnectorType(LdapDN connTypeDn)
Method to check if a connector type is dynamic based on it's DN. |
boolean |
isMetadataChange(Attributes currAttrs,
Attributes newAttrs,
String attrId,
String tsAttrId)
Compare modification times for metadata in current and new attributes to see if it has changed, return true if either doesn't have a timestamp or if an error occurs trying to access it. |
void |
proxyAttributeStyleOpProcessorProxy(MetaConnector conn,
AttributeStyleOpProcessor proc)
Queue any required proxy handler classes to conn's proxy chain to be interposed when the chain is activated. |
MethodStyleOpProcessor |
proxyMethodStyleOpProcessor(MetaConnector conn,
MethodStyleOpProcessor proc)
Return a proxy for one of the given connector's processors if: The connector's implementation bundle has a resilientProxyClass class defined AND
The connector's configuration has resilientDelay > 0
|
ScriptStyleOpProcessor |
proxyScriptStyleOpProcessor(MetaConnector conn,
ScriptStyleOpProcessor proc)
Return a proxy for one of the given connector's processors if: The connector's implementation bundle has a resilientProxyClass class defined AND
The connector's configuration has resilientDelay > 0
|
void |
setAcceptedUnknownAttrIds(List<String> acceptedUnknownAttrIds)
When ConnectorConfig.isFailOnUnknownAttrIds() is true then this list can be used to define
global attribute ids which aren't mapped, but shouldn't cause an add() or modify() operation
to fail when they are mentioned (individual connector configs can add their own ones too if they
wish). |
void |
setAllowMetadataModifyGlobally(boolean allowMetadataModifyGlobally)
|
void |
setConfDirectory(String confDirectory)
|
void |
setConnectorPersister(ConnectorPersister persister)
Accessed internally as passed down to created ConnectorTypes and
Connectors for use when they are changed. |
void |
setConverterManager(ConverterManager converterManager)
|
void |
setImplBundles(List<ImplBundle> implBundles)
|
void |
setLogLevel(ConnectorType connType,
Logger logger,
Attributes attrs)
Set logging level on a connector's logger using metadata (and possibly static configuration) combined with values contained in attrs, or do nothing if no logging related
attributes are present in attrs. |
void |
setLogLevelAttr(String logLevelAttr)
|
void |
setMessageSource(org.springframework.context.MessageSource msgSrc)
|
void |
setMetaDataAttr(String metaDataAttr)
|
void |
setMetaDataTimestampAttr(String metaDataTimestampAttr)
|
void |
setOpBindingMetaDataAttr(String opBindingMetaDataAttr)
|
void |
setOpBindingMetaDataTimestampAttr(String opBindingMetaDataTimestampAttr)
|
void |
setValidatorManager(ValidatorManager validatorManager)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String STR_VALUE_TAG
public static final String IMPL_BUNDLE_TAG
public static String CUSTOM_METADATA_ATTR
ImplBundle.getCustomMetadataFile().
public static final String LOG_DEST_ATTR
public static final String ATTR_OBJECT_CLASS
public static final String ATTR_NAMESPACE_FAMILY
public static final String VALUE_OBJECT_CLASS_DYN_NAMESPACE
public static final String VALUE_NAMESPACE_FAMILY_DYNAMIC
public static final String SKIP_PERSISTER_DELETE_LDAP_ATTR
BaseConnector.CONN_SKIP_PERSISTER_DELETE_ATTR on Connector Types/Connectors.
| Constructor Detail |
|---|
public MetaConnectorFactory()
| Method Detail |
|---|
public String getConfDirectory()
getConfDirectory in interface ConnectorFactorypublic void setConfDirectory(String confDirectory)
setConfDirectory in interface ConnectorFactorypublic List<String> getAcceptedUnknownAttrIds()
public void setAcceptedUnknownAttrIds(List<String> acceptedUnknownAttrIds)
ConnectorConfig.isFailOnUnknownAttrIds() is true then this list can be used to define
global attribute ids which aren't mapped, but shouldn't cause an add() or modify() operation
to fail when they are mentioned (individual connector configs can add their own ones too if they
wish).
acceptedUnknownAttrIds - List of legal, but never-the-less unmapped, LDAP attribute ids.public ValidatorManager getValidatorManager()
public void setValidatorManager(ValidatorManager validatorManager)
public ConverterManager getConverterManager()
public void setConverterManager(ConverterManager converterManager)
public ConnectorPersister getConnectorPersister()
getConnectorPersister in interface ConnectorFactorypublic org.springframework.context.MessageSource getMessageSource()
getMessageSource in interface ConnectorFactorypublic void setMessageSource(org.springframework.context.MessageSource msgSrc)
setMessageSource in interface ConnectorFactorypublic void setConnectorPersister(ConnectorPersister persister)
ConnectorFactoryConnectorTypes and
Connectors for use when they are changed.
setConnectorPersister in interface ConnectorFactorypublic List<ImplBundle> getImplBundles()
ImplBundle].
getImplBundles in interface ConnectorFactorypublic String[] getImplBundleNames()
getImplBundleNames in interface ConnectorFactorypublic ImplBundle getImplBundleFromName(String name)
getImplBundleFromName in interface ConnectorFactorypublic ImplBundle getImplBundleFromConnectorTypeName(String connTypeName)
getImplBundleFromConnectorTypeName in interface ConnectorFactorypublic ImplBundle getImplBundleFromObjectClass(String connTypeObjClass)
getImplBundleFromObjectClass in interface ConnectorFactorypublic ImplBundle getImplBundleFromObjectClass(Attribute objClassAttr)
public void addImplBundle(ImplBundle implBundle,
boolean replaceExisting)
public void setImplBundles(List<ImplBundle> implBundles)
public String getMetaDataAttr()
public void setMetaDataAttr(String metaDataAttr)
public String getMetaDataTimestampAttr()
public void setMetaDataTimestampAttr(String metaDataTimestampAttr)
public String getOpBindingMetaDataAttr()
public void setOpBindingMetaDataAttr(String opBindingMetaDataAttr)
public String getOpBindingMetaDataTimestampAttr()
public void setOpBindingMetaDataTimestampAttr(String opBindingMetaDataTimestampAttr)
public String getLogLevelAttr()
public void setLogLevelAttr(String logLevelAttr)
public String getConnectorFilePath(String connTypeName,
String connName)
getConnectorFilePath in interface ConnectorFactorypublic String getConnectorTypeFilePath(String connTypeName)
getConnectorTypeFilePath in interface ConnectorFactory
public boolean isMetadataChange(Attributes currAttrs,
Attributes newAttrs,
String attrId,
String tsAttrId)
currAttrs - Currently stored attributes.newAttrs - New attributes to be assigned.
public void clearMetadataAttributesValues(Attributes attrs,
ModificationItem[] items)
attrs - items - public String getMetadata(Attributes attrs)
public String getOpBindingMetadata(Attributes attrs)
public boolean isAllowMetadataModify(ImplBundle implBundle)
ConnectorFactory
isAllowMetadataModify in interface ConnectorFactoryimplBundle -
public ConnectorType createConnectorType(String connTypeName,
Attributes attrs)
throws LdapConfigurationException
MetaConnectorType capable of broadcasting
metadata changes to contained connectors.
createConnectorType in interface ConnectorFactoryconnTypeName - Name of connector type.attrs - Attributes passed in through the LDAP front-end,
possibly written over the top of attrs persisted previously
if there are any.
LdapConfigurationException
public ImplBundle addConnectorTypeStaticAttributes(String connTypeName,
Attributes attrs)
throws NamingException
connTypeName - the connector type name.attrs - the connector type attributes.
NamingException
public void destroyConnectorType(String connTypeName)
throws LdapConfigurationException
MetaConnectorType instance identified by name.
destroyConnectorType in interface ConnectorFactoryconnTypeName - Name of connector type.
LdapConfigurationExceptionpublic String getDynamicConnectorXML(DataModel datamodel)
public ImplBundle getImplBundleFromString(String connectorXML)
public DataModel getDataModel(String connTypeName,
Attributes attrs)
public ImplBundle createImplBundle(String connTypeName,
DataModel model)
connTypeName - model -
public ImplBundle createImplBundle(String connectorXML)
public ImplBundle findImplBundle(String connTypeName,
Attributes attrs)
public void setLogLevel(ConnectorType connType,
Logger logger,
Attributes attrs)
ConnectorFactoryattrs, or do nothing if no logging related
attributes are present in attrs. Note the signature of this
method may seem a little odd, but this is to handle the usescase where logger must be configured
for a connector prior to it actually being created so that any problems encountered during its
creation also end up in its dedicated log file.
setLogLevel in interface ConnectorFactoryconnType - Parent type for connector which owns (or will later be made to own) the
provided logger which is to be configured.logger - Logger on which level should be updated.attrs - Attributes containing attribute associated with logging (either it has
MetaDataDefs.MD_CONN_MAP_TO=MetaConnector.CONN_LOG_SEVERITY_ATTR
or it's name was statically assigned via
setLogLevelAttr(String)) from which new level
will be taken (other attributes also come into play in this case).
public Logger createLogger(String connTypeName,
String connName)
Note that the logger and appender are created by cloning the log4j.properties file and getting the NLOG4J library to create the actual objects (this was the only way to get it to work as each appender must have its own Layout instance or log messages are corrupted).
createLogger in interface ConnectorFactorypublic void destroyLogger(Logger connLog)
public void proxyAttributeStyleOpProcessorProxy(MetaConnector conn,
AttributeStyleOpProcessor proc)
public MethodStyleOpProcessor proxyMethodStyleOpProcessor(MetaConnector conn,
MethodStyleOpProcessor proc)
resilientProxyClass class defined AND
resilientDelay > 0
conn - Connector, which might be proxied.
MethodStyleOpProcessor if
conditions described above are true, otherwise null.
public ScriptStyleOpProcessor proxyScriptStyleOpProcessor(MetaConnector conn,
ScriptStyleOpProcessor proc)
resilientProxyClass class defined AND
resilientDelay > 0
conn - Connector, which might be proxied.
MethodStyleOpProcessor if
conditions described above are true, otherwise null.
public Connector createConnector(ConnectorType connType,
String namingAttr,
String name,
LdapDN suffix,
Attributes attrs)
throws LdapConfigurationException
createConnector in interface ConnectorFactoryconnType - Parent connector type grouping all connector instances
implemented by a common custom option, or sharing a common
dynamic configuration.namingAttr - Passed in so a sanity check can be done against
the implementation bundle on the original DN.name - Name specified for connector by end-user.attrs - Attributes for this connector.
type.
LdapConfigurationException
@Nullable
public DataModel convertMetadata(@NotNull
String connTypeName,
@NotNull
Attributes attrs)
throws NamingException
NamingException
@NotNull
protected DataModel convertMetadata(@NotNull
String connTypeName,
@NotNull
String metaData,
@Nullable
String customMetaData)
throws LdapConfigurationException
LdapConfigurationException
public Opbindings convertOpBindingMetadata(String connTypeName,
String metadata)
throws javax.xml.bind.JAXBException
connTypeName - Target connectorType namemetadata - XML text to be converted.
javax.xml.bind.JAXBExceptionpublic boolean isAllowMetadataModifyGlobally()
public void setAllowMetadataModifyGlobally(boolean allowMetadataModifyGlobally)
protected void getImplBundleStaticOpbindingsMetadata(ImplBundle implBundle,
Attributes attrs)
public static boolean isDynamicConnectorType(Attributes attrs)
Note: Static connectors that use a DYN schema appear dynamic based on attributes alone.
attrs - the attributes of the connector type.
public boolean isDynamicConnectorType(LdapDN connTypeDn)
This method uses information from the connector type ImplBundle.
isDynamicConnectorType in interface ConnectorFactoryconnTypeDn - the connector type DN.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||