public class JdbcMetadataConnector extends ReadOnlyConnector
Connector.ExtraProperties
Modifier and Type | Field and Description |
---|---|
protected boolean |
closeDataSourceOnShutdown
Whether to close the data source when the connector shuts down or not
|
protected DataSource |
dataSource |
protected String |
dataSourceJndiName
The JNDI name of the JDBC DataSource instance that should be used.
|
protected static String |
DEFAULT_NAME_OF_DEFAULT_CATALOG |
protected static String |
DEFAULT_NAME_OF_DEFAULT_SCHEMA |
protected String |
defaultCatalogName
The name to use for the catalog name if the database does not support catalogs or the database has a catalog with the empty string as a name.
|
protected String |
defaultSchemaName
The name to use for the schema name if the database does not support schemas or the database has a schema with the empty string as a name.
|
protected static String |
DELIMITER |
protected String |
driverClassName
The name of the JDBC driver class.
|
protected int |
idleTimeInSecondsBeforeTestingConnections
The number of seconds that a connection can remain idle before the connection should be tested to ensure it is still valid.
|
protected int |
maximumConnectionIdleTimeInSeconds
The maximum number of seconds that a connection can remain idle in the pool before it is closed.
|
protected int |
maximumConnectionsInPool
The maximum number of connections that may be in the connection pool.
|
protected int |
maximumSizeOfStatementCache
The maximum number of statements that should be cached.
|
protected MetadataCollector |
metadataCollector |
protected String |
metadataCollectorClassName
The name of a custom class to use for metadata collection.
|
protected List<? extends AbstractMetadataRetriever> |
metadataRetrievers |
protected int |
minimumConnectionsInPool
The minimum number of connections that will be kept in the connection pool.
|
protected int |
numberOfConnectionsToAcquireAsNeeded
The number of connections that should be added to the pool when there are not enough to be used.
|
protected String |
password
The password that should be used when creating JDBC connections using the JDBC driver class.
|
protected int |
retryLimit
The default number of times that a failed attempt to connect to a datasource should be retried
|
protected String |
url
The URL that should be used when creating JDBC connections using the JDBC driver class.
|
protected String |
username
The username that should be used when creating JDBC connections using the JDBC driver class.
|
DEFAULT_ROOT_ID
Constructor and Description |
---|
JdbcMetadataConnector() |
Modifier and Type | Method and Description |
---|---|
protected String |
getDefaultCatalogName() |
protected String |
getDefaultSchemaName() |
Document |
getDocumentById(String id)
Returns a
Document instance representing the document with a given id. |
String |
getDocumentId(String externalPath)
Returns the id of an external node located at the given external path within the connector's exposed tree of content.
|
Collection<String> |
getDocumentPathsById(String id)
Return the path(s) of the external node with the given identifier.
|
protected MetadataCollector |
getMetadataCollector() |
boolean |
hasDocument(String id)
Checks if a document with the given id exists in the end-source.
|
protected void |
initDataSource() |
void |
initialize(NamespaceRegistry registry,
NodeTypeManager nodeTypeManager)
Initialize the connector.
|
protected void |
initMetadataCollector() |
protected void |
initNodeTypes(NodeTypeManager nodeTypeManager) |
protected void |
initRetrievers() |
protected void |
setDefaultCatalogName(String defaultCatalogName) |
protected void |
setDefaultSchemaName(String defaultSchemaName) |
protected void |
setIdleTimeInSecondsBeforeTestingConnections(Integer idleTimeInSecondsBeforeTestingConnections) |
protected void |
setMaximumConnectionIdleTimeInSeconds(Integer maximumConnectionIdleTimeInSeconds) |
protected void |
setMaximumConnectionsInPool(Integer maximumConnectionsInPool) |
protected void |
setMaximumSizeOfStatementCache(Integer maximumSizeOfStatementCache) |
protected void |
setMetadataCollectorClassName(String metadataCollectorClassName) |
protected void |
setMinimumConnectionsInPool(Integer minimumConnectionsInPool) |
protected void |
setNumberOfConnectionsToAcquireAsNeeded(Integer numberOfConnectionsToAcquireAsNeeded) |
protected void |
setRetryLimit(Integer retryLimit) |
void |
shutdown()
Shutdown the connector by releasing all resources.
|
protected String |
trimPath(String externalPath) |
protected void |
tryToClose(Connection connection) |
isReadonly, newDocumentId, removeDocument, storeDocument, updateDocument
checkFieldNotNull, extraPropertiesFor, extraPropertiesStore, factories, getBinaryValue, getChildReference, getContext, getEnvironment, getLogger, getMimeTypeDetector, getRepositoryName, getRootDocumentId, getSourceName, getTransactionManager, isCacheable, isQueryable, log, moveExtraProperties, nameFrom, nameFrom, nameFrom, newChildReference, newConnectorChangedSet, newDocument, newPageDocument, pathFactory, pathFrom, pathFrom, propertyFactory, readDocument, setExtraPropertiesStore, translator, writeDocument
protected static final String DELIMITER
protected static final String DEFAULT_NAME_OF_DEFAULT_CATALOG
protected static final String DEFAULT_NAME_OF_DEFAULT_SCHEMA
protected String dataSourceJndiName
protected String username
protected String password
protected String url
protected String driverClassName
protected int retryLimit
protected int maximumConnectionsInPool
protected int minimumConnectionsInPool
protected int maximumConnectionIdleTimeInSeconds
protected int maximumSizeOfStatementCache
protected int numberOfConnectionsToAcquireAsNeeded
protected int idleTimeInSecondsBeforeTestingConnections
protected String defaultCatalogName
protected String defaultSchemaName
protected String metadataCollectorClassName
protected boolean closeDataSourceOnShutdown
protected DataSource dataSource
protected MetadataCollector metadataCollector
protected List<? extends AbstractMetadataRetriever> metadataRetrievers
public void initialize(NamespaceRegistry registry, NodeTypeManager nodeTypeManager) throws RepositoryException, IOException
Connector
Connector.context
,
Connector.logger
, Connector.name
, and Connector.repositoryName
plus any fields that match configuration properties for the
connector.
By default this method does nothing, so it should be overridden by implementations to do a one-time initialization of any
internal components. For example, connectors can use the supplied registry
and nodeTypeManager
objects to register custom namesapces and node types required by the external content.
This is an excellent place for connector to validate the connector-specific fields set by ModeShape via reflection during instantiation.
initialize
in class Connector
registry
- the namespace registry that can be used to register custom namespaces; never nullnodeTypeManager
- the node type manager that can be used to register custom node types; never nullRepositoryException
- if operations on the NamespaceRegistry
or NodeTypeManager
failIOException
- if any stream based operations fail (like importing cnd files)protected void initRetrievers()
protected void initNodeTypes(NodeTypeManager nodeTypeManager) throws RepositoryException, IOException
RepositoryException
IOException
protected void initDataSource()
protected void initMetadataCollector()
public Document getDocumentById(String id)
Connector
Document
instance representing the document with a given id. The document should have a "proper"
structure for it to be usable by ModeShape.getDocumentById
in class Connector
id
- a non-null
stringDocument
instance or null
protected void tryToClose(Connection connection)
public String getDocumentId(String externalPath)
Connector
getDocumentId
in class Connector
externalPath
- a non-null
string representing an external path, or "/" for the top-level node exposed by the
connectornull
public Collection<String> getDocumentPathsById(String id)
Connector
getDocumentPathsById
in class Connector
id
- a non-null
stringpublic boolean hasDocument(String id)
Connector
hasDocument
in class Connector
id
- a non-null
string.true
if such a document exists, false
otherwise.public void shutdown()
Connector
protected MetadataCollector getMetadataCollector()
protected String getDefaultCatalogName()
protected String getDefaultSchemaName()
protected void setRetryLimit(Integer retryLimit)
protected void setMaximumConnectionsInPool(Integer maximumConnectionsInPool)
protected void setMinimumConnectionsInPool(Integer minimumConnectionsInPool)
protected void setMaximumConnectionIdleTimeInSeconds(Integer maximumConnectionIdleTimeInSeconds)
protected void setMaximumSizeOfStatementCache(Integer maximumSizeOfStatementCache)
protected void setNumberOfConnectionsToAcquireAsNeeded(Integer numberOfConnectionsToAcquireAsNeeded)
protected void setIdleTimeInSecondsBeforeTestingConnections(Integer idleTimeInSecondsBeforeTestingConnections)
protected void setDefaultCatalogName(String defaultCatalogName)
protected void setDefaultSchemaName(String defaultSchemaName)
protected void setMetadataCollectorClassName(String metadataCollectorClassName)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.