com.ca.jcs.jdbc
Class JDBCMetaConnector

java.lang.Object
  extended by org.apache.directory.server.core.partition.AbstractPartition
      extended by com.ca.jcs.BaseConnector
          extended by com.ca.jcs.meta.MetaConnector
              extended by com.ca.jcs.jdbc.JDBCMetaConnector
All Implemented Interfaces:
Activatable, CachingConnector, Connector, PartitionOps, OpProcessorStyleFactory, QuoteStringHandler, Partition
Direct Known Subclasses:
ORAMetaConnector

public class JDBCMetaConnector
extends MetaConnector

A dynamic JDBC connector driven by metadata which specifies all mapping information for Account, Group and Connection (Endpoint) classes.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ca.jcs.meta.MetaConnector
MetaConnector.FilterAware, MetaConnector.SearchFinishedException
 
Field Summary
static String CONN_TABLE_SPACE
          Optional multi-valued attribute containing names of accessible tablespaces for database server instance connected to.
protected  String databaseVendor
           
protected  com.ca.commons.sql.Vendor vendor
           
protected  String vendorSequenceSyntax
           
 
Fields inherited from class com.ca.jcs.meta.MetaConnector
ALIAS_ACCOUNT_OBJECT, ALIAS_GROUP_OBJECT, CONN_BASE_DN_ATTR, CONN_DESCRIPTION_ATTR, CONN_HOST_ATTR, CONN_LOG_SEVERITY_ATTR, CONN_NAME_ATTR, CONN_PASSWORD_ATTR, CONN_PORT_ATTR, CONN_REMOTE_VERSION_ATTR, CONN_SECURE_ATTR, CONN_URL_ATTR, CONN_USERNAME_ATTR, dailyLog, DYNAMIC_ATTR_INFO_ATTR, logConnAttrs, READ_ONLY_VALIDATOR, virtualContainers
 
Fields inherited from class com.ca.jcs.BaseConnector
acceptedUnknownAttrIds, attributeStyleOpProcessor, CONN_ACTIVATION_TIMEOUT, CONN_DN, CONN_NAME, CONN_NAME_ID, CONN_PASS_THROUGH_SUFFIX, CONN_PASS_THROUGH_SUFFIX_LEN, CONN_ROLLBACK_CONNECTION_ATTRS, CONN_SKIP_PERSISTER_DELETE_ATTR, CONN_SPEC, CONN_SPEC_INTERNAL, CONNECTOR_ATTR_INDEX, connectorBaseDn, EMPTY_DN, LDAP_ATTR_INDEX, LDAP_CONN_DN, ldapExceptionPrefix, log, SEARCH_RESULTS_STREAMING
 
Fields inherited from interface com.ca.jcs.Connector
STATE_DELETING
 
Fields inherited from interface org.apache.directory.server.core.partition.Partition
ALIAS_ATTRIBUTE, ALIAS_OBJECT
 
Constructor Summary
JDBCMetaConnector(ConnectorType type, String name, Logger log, ConnectorConfig config)
           
 
Method Summary
 void activate()
          Calls super.activate() which creates and registers the connection manager, as well as notifying this connector instance of its metadata.
 AttributeStyleOpProcessor createAttributeStyleOpProcessor()
           
 ConnectionManager createConnectionManager()
          Not expected to to be used universally, see comments in JDBCConnectionManager.
 MethodStyleOpProcessor createMethodStyleOpProcessor()
          Must be overridden by connectors that support the concept of method-style op processing, return null unless overridden.
 ScriptStyleOpProcessor createScriptStyleOpProcessor()
          Must be overridden by connectors that support the concept of script-style op processing, return null unless overridden.
 TransactionManager createTransactionManager()
          Returns a transaction manager arranges for the transaction be used for all nested updates within the same thread.
 void deactivate()
          Deactivates this connector's connection manager if one exists.
 String getDatabaseVendor()
           
 DataSource getDataSource()
           
 Collection<? extends MetaConnector.FilterAware> getFilterAwareness()
          Identify supported search filter types
 JDBCMetaConnectorConfig getJDBCConnectorConfig()
           
 String getJDBCUsername()
          Returns the JDBC Username for this connection
 String getKeyForStreamableObject(String connClassName)
           
 com.ca.commons.sql.Vendor getVendor()
           
 boolean isBehaviourImperfectFilter()
           
 boolean isBehaviourSearchObjAsLookup()
          Behavioural method which should be overridden by derived classes if they want object-scope searches to be treated as lookup()s on the object referred to by the baseName.
 boolean isBehaviourSearchSingleClass()
          If a derived connector's implementational approach requires that it's OpProcessor.doSearch(com.ca.jcs.ObjectInfo, com.ca.jcs.filter.FilterInfo, java.util.Map, javax.naming.directory.SearchControls) method is called is only called for a single objectclass at a time, then they should override this method to return true.
 void notifyMetaData(MetaObjectClassMappings mappings, boolean opBindChange)
          Used to inform connector of new metadata, which may trigger the creation / destruction of various styles of op processors depending on the exact content of the new metadata (and whether concrete connector implements each style).
protected  void setDatabaseVendor()
          Set database vendor name by looking it up from database's JDBC metadata.
 void setDataSource(DataSource dataSource)
           
 String toString()
          Returns a string of the form "class:name [suffix]".
 
Methods inherited from class com.ca.jcs.meta.MetaConnector
add, convertAttributes, convertAttributesFromConnector, convertDNFromConnector, convertDNToConnector, convertDNToConnector, convertModificationItems, convertToException, convertToException, delete, getAssocReverseConnectorAttrId, getAttributeStyleOpProcessorChain, getCacheableStatus, getClassMappingFromConnectorAttrs, getClassMappingFromConnectorObjectClass, getClassMappings, getConnectorAttributesProcessor, getConnectorClassMap, getConnectorObjectClass, getConnectorObjectClasses, getDefaultConnectorSearchAttrIds, getDefaultSearchLdapAttrIds, getDNAttrIds, getEhCacheManager, getErrClassId, getFilterInfo, getFilterInfo, getFilterInfo, getFilterInfo, getFilterInfo, getFilterInfo, getFilterInfo, getFilterObjClass, getIncludedDnLdapAttrId, getMetaConnectorConfig, getMetaConnectorType, getModifyMonitorCache, getObjectClassFromAmbiguousConnAttr, getObjectClassFromConnAttr, getObjectInfo, getObjectInfo, getObjectInfo, getObjectInfo, getObjectInfo, getOpProcessor, getOpProcessorForSearch, getPostQueryAttributesProcessor, getRequestedConnAttrIds, getRootObjectInfo, getSearchBaseObjectInfo, getSearchBaseObjectInfo, getVirtualContainers, hasMetaOpBindingsProxy, isAcceptedUnknownAttrId, isAmibguousLdapDn, isFilterSingleClassMatching, isLockedModify, isLockedModify, isRootDN, isRootDN, isSearchAsLookup, isSearchOutsideClassContainer, isValidContainmentSearchResult, lookup, mapAttributeIdsToConnector, mapAttributeIdsToConnector, mapAttributeIdToConnector, mapAttributeIdToLdap, mapAttributesIdsToConnector, mapAttributesIdsToLdap, mapModificationItems, mapObjectClassAttributeIdsToConnector, matchDNToClassMap, modify, modifyRn, move, move, normalizeConnDn, normalizeConnDnAttr, normalizeConnectorDn, normalizeConnectorDnAttrs, performLockedOperation, resolveObjectClass, search, search, searchImpl, searchObjectScopeAsLookup, searchOneClass, searchVirtualContainers, setAttributeStyleOpProcessor, setClassMappings, setConnectorAttributesProcessor, setMethodStyleOpProcessor, setScriptStyleOpProcessor, validateAttributes, validateAttributes, validateDNForSearchContainer
 
Methods inherited from class com.ca.jcs.BaseConnector
addConnectorBaseDN, appQuoted, appQuoted, bind, convertConnectorDNFromNativeName, convertConnectorDNToNativeName, createConnectorDn, createConnectorDn, createObjectInfo, doInit, formatConnectorPassThroughAttrId, formatConnectorPassThroughValue, getAcceptedUnknownAttrIds, getAttributes, getAttributeStyleOpProcessor, getAttributeTypeRegistry, getAutoDirectAssocExlusions, getCacheManager, getConnectionManager, getConnectorBaseDn, getConnectorConfig, getConnectorDnRdn, getConnectorPassThroughValue, getLdapExceptionPrefix, getLdapNamingAttr, getLdapObjectClass, getLogger, getMethodStyleOpProcessor, getName, getPartition, getPassThroughAttrIdToConnector, getScriptStyleOpProcessor, getStateFlags, getStoredSuffix, getTransactionManager, getType, getUpSuffix, isActivated, isAutoDirectAssocRequired, isBehaviourCachingRequired, isBehaviourStrictConnectorDns, isCachingActive, isCachingPossible, isCachingRequired, isCheckObjectExistenceForDeletion, isConnectorPassThrough, isHiddenLdapBaseDn, isIndirectAssociations, isObjectClassRequired, isSuffix, list, mapAttributeIdsToConnector, modifyAttributes, noQuote, passThroughAttrIdToConnector, postProcessLdapSearchResult, removeConnectorBaseDN, setAcceptedUnknownAttrIds, setActivated, setAttributes, setCacheManager, setCachingRequired, setConnectionManager, setConnectorBaseDn, setConnectorConfig, setLdapNamingAttr, setLdapObjectClass, setLogger, setName, setQuoteString, setStateFlags, setStoredSuffix, setTransactionManager, setType, splitConnectorPassThroughAttrId, unbind, upName
 
Methods inherited from class org.apache.directory.server.core.partition.AbstractPartition
destroy, doDestroy, getConfiguration, getFactoryConfiguration, getSuffix, hasEntry, init, isInitialized, lookup, modify, sync
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ca.jcs.PartitionOps
lookup, modify, sync
 
Methods inherited from interface org.apache.directory.server.core.partition.Partition
destroy, getSuffix, hasEntry, init, isInitialized, lookup, modify, sync
 

Field Detail

databaseVendor

protected String databaseVendor

vendor

protected com.ca.commons.sql.Vendor vendor

vendorSequenceSyntax

protected String vendorSequenceSyntax

CONN_TABLE_SPACE

public static final String CONN_TABLE_SPACE
Optional multi-valued attribute containing names of accessible tablespaces for database server instance connected to.

See Also:
Constant Field Values
Constructor Detail

JDBCMetaConnector

public JDBCMetaConnector(ConnectorType type,
                         String name,
                         Logger log,
                         ConnectorConfig config)
Method Detail

isBehaviourSearchObjAsLookup

public boolean isBehaviourSearchObjAsLookup()
Description copied from class: BaseConnector
Behavioural method which should be overridden by derived classes if they want object-scope searches to be treated as lookup()s on the object referred to by the baseName.

Overrides:
isBehaviourSearchObjAsLookup in class BaseConnector
Returns:
True if object-scope searches are to be implemented as lookups, false (the default) otherwise.

isBehaviourImperfectFilter

public boolean isBehaviourImperfectFilter()

isBehaviourSearchSingleClass

public boolean isBehaviourSearchSingleClass()
Description copied from class: BaseConnector
If a derived connector's implementational approach requires that it's OpProcessor.doSearch(com.ca.jcs.ObjectInfo, com.ca.jcs.filter.FilterInfo, java.util.Map, javax.naming.directory.SearchControls) method is called is only called for a single objectclass at a time, then they should override this method to return true. This will cause the framework, for example, to decompose a subtree search with a filter like (objectclass=*) into a separate doSearch() call for each defined objectclass.

Overrides:
isBehaviourSearchSingleClass in class BaseConnector

getJDBCConnectorConfig

public JDBCMetaConnectorConfig getJDBCConnectorConfig()

getVendor

public com.ca.commons.sql.Vendor getVendor()

getDatabaseVendor

public String getDatabaseVendor()

setDatabaseVendor

protected void setDatabaseVendor()
                          throws NamingException
Set database vendor name by looking it up from database's JDBC metadata. We provide it at this level, rather than in attribute style processor, so that it is available to all styles of processor (and to reduce activate timing sensitivities between them).

Throws:
NamingException

activate

public void activate()
              throws NamingException
Description copied from class: MetaConnector
Calls super.activate() which creates and registers the connection manager, as well as notifying this connector instance of its metadata.

Specified by:
activate in interface Activatable
Specified by:
activate in interface Connector
Overrides:
activate in class MetaConnector
Throws:
NamingException

deactivate

public void deactivate()
                throws NamingException
Description copied from class: BaseConnector
Deactivates this connector's connection manager if one exists.

Specified by:
deactivate in interface Activatable
Specified by:
deactivate in interface Connector
Overrides:
deactivate in class MetaConnector
Throws:
NamingException

createAttributeStyleOpProcessor

public AttributeStyleOpProcessor createAttributeStyleOpProcessor()

createMethodStyleOpProcessor

public MethodStyleOpProcessor createMethodStyleOpProcessor()
Description copied from class: BaseConnector
Must be overridden by connectors that support the concept of method-style op processing, return null unless overridden.

Specified by:
createMethodStyleOpProcessor in interface OpProcessorStyleFactory
Overrides:
createMethodStyleOpProcessor in class BaseConnector

createScriptStyleOpProcessor

public ScriptStyleOpProcessor createScriptStyleOpProcessor()
Description copied from class: BaseConnector
Must be overridden by connectors that support the concept of script-style op processing, return null unless overridden.

Specified by:
createScriptStyleOpProcessor in interface OpProcessorStyleFactory
Overrides:
createScriptStyleOpProcessor in class BaseConnector

getDataSource

public DataSource getDataSource()

setDataSource

public void setDataSource(DataSource dataSource)

getJDBCUsername

public String getJDBCUsername()
                       throws NamingException
Returns the JDBC Username for this connection

Returns:
User name
Throws:
NamingException

createConnectionManager

public ConnectionManager createConnectionManager()
Not expected to to be used universally, see comments in JDBCConnectionManager.

Specified by:
createConnectionManager in interface Connector
Overrides:
createConnectionManager in class BaseConnector
Returns:
Connection manager instance.

createTransactionManager

public TransactionManager createTransactionManager()
Returns a transaction manager arranges for the transaction be used for all nested updates within the same thread.

Specified by:
createTransactionManager in interface Connector
Overrides:
createTransactionManager in class BaseConnector

toString

public String toString()
Description copied from class: BaseConnector
Returns a string of the form "class:name [suffix]".

Overrides:
toString in class BaseConnector

notifyMetaData

public void notifyMetaData(MetaObjectClassMappings mappings,
                           boolean opBindChange)
                    throws NamingException
Description copied from class: MetaConnector
Used to inform connector of new metadata, which may trigger the creation / destruction of various styles of op processors depending on the exact content of the new metadata (and whether concrete connector implements each style). Also sets BaseConnector.setCachingRequired(boolean) to true if mappings has one more objectclasses in it with connectorMapToAmbiguous= set on their naming attributes. Also sets nonFilterableAttrs if any attributes have the flag MD_IS_CONNECTOR_FILTERABLE set false.

Overrides:
notifyMetaData in class MetaConnector
Parameters:
mappings - New attribute-style mappings calculated by parent connector type.
opBindChange - True if op bindings changed (which may effect method-style or script-style processors or both).
Throws:
NamingException

getKeyForStreamableObject

public String getKeyForStreamableObject(String connClassName)

getFilterAwareness

public Collection<? extends MetaConnector.FilterAware> getFilterAwareness()
Identify supported search filter types

Overrides:
getFilterAwareness in class MetaConnector
Returns:
Collection of FilterAware levels corresponding to the state of connector's filter support


Created 2011-07-14 13:27 EST