org.modeshape.connector.meta.jdbc
Class JdbcMetadataSource

java.lang.Object
  extended by org.modeshape.graph.connector.path.AbstractPathRepositorySource
      extended by org.modeshape.connector.meta.jdbc.JdbcMetadataSource
All Implemented Interfaces:
Serializable, Referenceable, ObjectFactory, PathRepositorySource, RepositorySource

@ThreadSafe
public class JdbcMetadataSource
extends AbstractPathRepositorySource
implements ObjectFactory

See Also:
Serialized Form

Field Summary
static String DEFAULT_NAME_OF_DEFAULT_CATALOG
          The initial catalog name for databases that do not support catalogs is ""default" ", unless otherwise specified.
static String DEFAULT_NAME_OF_DEFAULT_SCHEMA
          The initial schema name for databases that do not support schemas is ""default" ", unless otherwise specified.
static String DEFAULT_NAME_OF_DEFAULT_WORKSPACE
          The initial name of the default workspace is ""default" ", unless otherwise specified.
static boolean SUPPORTS_CREATING_WORKSPACES
          This source does not support creating workspaces.
static boolean SUPPORTS_UPDATES
          This source does not support updates.
 
Fields inherited from class org.modeshape.graph.connector.path.AbstractPathRepositorySource
DEFAULT_CACHE_POLICY, DEFAULT_RETRY_LIMIT, DEFAULT_ROOT_NODE_UUID
 
Constructor Summary
JdbcMetadataSource()
           
 
Method Summary
 void close()
          Signal this source that it is no longer needed and should begin the process of reclaiming or closing all resources that it has acquired.
 RepositorySourceCapabilities getCapabilities()
          Get the capabilities for this source.
 RepositoryConnection getConnection()
          Get a connection from this source.
 String getDataSourceJndiName()
           
 String getDefaultCatalogName()
          Get the name of the default catalog.
 String getDefaultSchemaName()
          Get the name of the default schema.
 String getDefaultWorkspaceName()
          Get the name of the default workspace.
 String getDriverClassloaderName()
           
 String getDriverClassName()
           
 int getIdleTimeInSecondsBeforeTestingConnections()
           
 int getMaximumConnectionIdleTimeInSeconds()
           
 int getMaximumConnectionsInPool()
           
 int getMaximumSizeOfStatementCache()
           
 MetadataCollector getMetadataCollector()
          Returns the metadata collector instance
 String getMetadataCollectorClassName()
          Get the class name of the metadata collector.
 int getMinimumConnectionsInPool()
           
 int getNumberOfConnectionsToAcquireAsNeeded()
           
 Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)
           
 String getPassword()
           
 Reference getReference()
           
 String getUrl()
           
 String getUsername()
           
 void setDataSourceJndiName(String dataSourceJndiName)
           
 void setDefaultCatalogName(String defaultCatalogName)
          Set the name of the catalog that should be used when the database does not support catalogs.
 void setDefaultSchemaName(String defaultSchemaName)
          Set the name of the schema that should be used when the database does not support schemas.
 void setDefaultWorkspaceName(String nameOfDefaultWorkspace)
          Set the name of the workspace that should be used when clients don't specify a workspace.
 void setDriverClassloaderName(String driverClassloaderName)
           
 void setDriverClassName(String driverClassName)
           
 void setIdleTimeInSecondsBeforeTestingConnections(int idleTimeInSecondsBeforeTestingConnections)
           
 void setMaximumConnectionIdleTimeInSeconds(int maximumConnectionIdleTimeInSeconds)
           
 void setMaximumConnectionsInPool(int maximumConnectionsInPool)
           
 void setMaximumSizeOfStatementCache(int maximumSizeOfStatementCache)
           
 void setMetadataCollectorClassName(String metadataCollectorClassName)
          Set the class name of the metadata collector and instantiates a new metadata collector object for that class
 void setMinimumConnectionsInPool(int minimumConnectionsInPool)
           
 void setNumberOfConnectionsToAcquireAsNeeded(int numberOfConnectionsToAcquireAsNeeded)
           
 void setPassword(String password)
           
 void setUpdatesAllowed(boolean updatesAllowed)
          In-memory connectors aren't shared and cannot be loaded from external sources if updates are not allowed.
 void setUrl(String url)
           
 void setUsername(String username)
           
 
Methods inherited from class org.modeshape.graph.connector.path.AbstractPathRepositorySource
areUpdatesAllowed, getCachePolicy, getName, getPathRepositoryCache, getRepositoryContext, getRetryLimit, getRootNodeUuid, initialize, setCachePolicy, setName, setRetryLimit, setRootNodeUuid
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPPORTS_UPDATES

public static final boolean SUPPORTS_UPDATES
This source does not support updates.

See Also:
Constant Field Values

SUPPORTS_CREATING_WORKSPACES

public static final boolean SUPPORTS_CREATING_WORKSPACES
This source does not support creating workspaces.

See Also:
Constant Field Values

DEFAULT_NAME_OF_DEFAULT_WORKSPACE

public static final String DEFAULT_NAME_OF_DEFAULT_WORKSPACE
The initial name of the default workspace is ""default" ", unless otherwise specified.

See Also:
Constant Field Values

DEFAULT_NAME_OF_DEFAULT_CATALOG

public static final String DEFAULT_NAME_OF_DEFAULT_CATALOG
The initial catalog name for databases that do not support catalogs is ""default" ", unless otherwise specified.

See Also:
Constant Field Values

DEFAULT_NAME_OF_DEFAULT_SCHEMA

public static final String DEFAULT_NAME_OF_DEFAULT_SCHEMA
The initial schema name for databases that do not support schemas is ""default" ", unless otherwise specified.

See Also:
Constant Field Values
Constructor Detail

JdbcMetadataSource

public JdbcMetadataSource()
Method Detail

close

public void close()
Description copied from class: AbstractPathRepositorySource
Signal this source that it is no longer needed and should begin the process of reclaiming or closing all resources that it has acquired. Because connections may still be in use, this method may not necessarily close all resources immediately.

This is a required method, and must be called when this source is no longer needed if one or more connections have been obtained since the previous call to this method.

Note that calling this method also does not preclude obtaining more connections after this method is called. If that happens, this source should simply reacquire any resources necessary to provide additional connections, and this method needs to be called once again.

Specified by:
close in interface RepositorySource
Overrides:
close in class AbstractPathRepositorySource
See Also:
RepositorySource.close()

getCapabilities

public RepositorySourceCapabilities getCapabilities()
Description copied from interface: RepositorySource
Get the capabilities for this source.

Specified by:
getCapabilities in interface RepositorySource
Returns:
the capabilities for this source; never null

getConnection

public RepositoryConnection getConnection()
                                   throws RepositorySourceException
Description copied from interface: RepositorySource
Get a connection from this source. Even though each RepositorySource need not be thread safe, this method should be safe to be called concurrently by multiple threads.

Specified by:
getConnection in interface RepositorySource
Returns:
a connection
Throws:
RepositorySourceException - if there is a problem obtaining a connection

getReference

public Reference getReference()
Specified by:
getReference in interface Referenceable

getObjectInstance

public Object getObjectInstance(Object obj,
                                Name name,
                                Context nameCtx,
                                Hashtable<?,?> environment)
                         throws Exception
Specified by:
getObjectInstance in interface ObjectFactory
Throws:
Exception

getDataSourceJndiName

public String getDataSourceJndiName()
Returns:
dataSourceJndiName

setDataSourceJndiName

public void setDataSourceJndiName(String dataSourceJndiName)
Parameters:
dataSourceJndiName - Sets dataSourceJndiName to the specified value.

getDriverClassName

public String getDriverClassName()
Returns:
driverClassName

setDriverClassName

public void setDriverClassName(String driverClassName)
Parameters:
driverClassName - Sets driverClassName to the specified value.

getDriverClassloaderName

public String getDriverClassloaderName()
Returns:
driverClassloaderName

setDriverClassloaderName

public void setDriverClassloaderName(String driverClassloaderName)
Parameters:
driverClassloaderName - Sets driverClassloaderName to the specified value.

getUsername

public String getUsername()
Returns:
username

setUsername

public void setUsername(String username)
Parameters:
username - Sets username to the specified value.

getPassword

public String getPassword()
Returns:
password

setPassword

public void setPassword(String password)
Parameters:
password - Sets password to the specified value.

getUrl

public String getUrl()
Returns:
url

setUrl

public void setUrl(String url)
Parameters:
url - Sets url to the specified value.

getMaximumConnectionsInPool

public int getMaximumConnectionsInPool()
Returns:
maximumConnectionsInPool

setMaximumConnectionsInPool

public void setMaximumConnectionsInPool(int maximumConnectionsInPool)
Parameters:
maximumConnectionsInPool - Sets maximumConnectionsInPool to the specified value.

getMinimumConnectionsInPool

public int getMinimumConnectionsInPool()
Returns:
minimumConnectionsInPool

setMinimumConnectionsInPool

public void setMinimumConnectionsInPool(int minimumConnectionsInPool)
Parameters:
minimumConnectionsInPool - Sets minimumConnectionsInPool to the specified value.

getMaximumConnectionIdleTimeInSeconds

public int getMaximumConnectionIdleTimeInSeconds()
Returns:
maximumConnectionIdleTimeInSeconds

setMaximumConnectionIdleTimeInSeconds

public void setMaximumConnectionIdleTimeInSeconds(int maximumConnectionIdleTimeInSeconds)
Parameters:
maximumConnectionIdleTimeInSeconds - Sets maximumConnectionIdleTimeInSeconds to the specified value.

getMaximumSizeOfStatementCache

public int getMaximumSizeOfStatementCache()
Returns:
maximumSizeOfStatementCache

setMaximumSizeOfStatementCache

public void setMaximumSizeOfStatementCache(int maximumSizeOfStatementCache)
Parameters:
maximumSizeOfStatementCache - Sets maximumSizeOfStatementCache to the specified value.

getNumberOfConnectionsToAcquireAsNeeded

public int getNumberOfConnectionsToAcquireAsNeeded()
Returns:
numberOfConnectionsToAcquireAsNeeded

setNumberOfConnectionsToAcquireAsNeeded

public void setNumberOfConnectionsToAcquireAsNeeded(int numberOfConnectionsToAcquireAsNeeded)
Parameters:
numberOfConnectionsToAcquireAsNeeded - Sets numberOfConnectionsToAcquireAsNeeded to the specified value.

getIdleTimeInSecondsBeforeTestingConnections

public int getIdleTimeInSecondsBeforeTestingConnections()
Returns:
idleTimeInSecondsBeforeTestingConnections

setIdleTimeInSecondsBeforeTestingConnections

public void setIdleTimeInSecondsBeforeTestingConnections(int idleTimeInSecondsBeforeTestingConnections)
Parameters:
idleTimeInSecondsBeforeTestingConnections - Sets idleTimeInSecondsBeforeTestingConnections to the specified value.

getDefaultWorkspaceName

public String getDefaultWorkspaceName()
Get the name of the default workspace.

Specified by:
getDefaultWorkspaceName in interface PathRepositorySource
Returns:
the name of the workspace that should be used by default, or null if there is no default workspace

setDefaultWorkspaceName

public void setDefaultWorkspaceName(String nameOfDefaultWorkspace)
Set the name of the workspace that should be used when clients don't specify a workspace.

Parameters:
nameOfDefaultWorkspace - the name of the workspace that should be used by default, or null if the default name should be used

getDefaultCatalogName

public String getDefaultCatalogName()
Get the name of the default catalog.

Returns:
the name that should be used as the catalog name when the database does not support catalogs

setDefaultCatalogName

public void setDefaultCatalogName(String defaultCatalogName)
Set the name of the catalog that should be used when the database does not support catalogs.

Parameters:
defaultCatalogName - the name that should be used as the catalog name by default, or null if the default name should be used

getDefaultSchemaName

public String getDefaultSchemaName()
Get the name of the default schema.

Returns:
the name that should be used as the schema name when the database does not support schemas

setDefaultSchemaName

public void setDefaultSchemaName(String defaultSchemaName)
Set the name of the schema that should be used when the database does not support schemas.

Parameters:
defaultSchemaName - the name that should be used as the schema name by default, or null if the default name should be used

getMetadataCollectorClassName

public String getMetadataCollectorClassName()
Get the class name of the metadata collector.

Returns:
the name the class name of the metadata collector

setMetadataCollectorClassName

public void setMetadataCollectorClassName(String metadataCollectorClassName)
                                   throws ClassNotFoundException,
                                          IllegalAccessException,
                                          InstantiationException
Set the class name of the metadata collector and instantiates a new metadata collector object for that class

Parameters:
metadataCollectorClassName - the class name for the metadata collector, or null if the default metadata collector should be used
Throws:
ClassNotFoundException - if the the named metadata collector class cannot be located
IllegalAccessException - if the metadata collector class or its nullary constructor is not accessible.
InstantiationException - if the metadata collector class represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
ClassCastException - if the given class cannot be cast to MetadataCollector.
See Also:
Class.forName(String), Class.newInstance()

getMetadataCollector

public MetadataCollector getMetadataCollector()
Returns the metadata collector instance

Returns:
the metadata collector

setUpdatesAllowed

public void setUpdatesAllowed(boolean updatesAllowed)
In-memory connectors aren't shared and cannot be loaded from external sources if updates are not allowed. Therefore, in order to avoid setting up an in-memory connector that is permanently empty (presumably, not a desired outcome), all in-memory connectors must allow updates.

Specified by:
setUpdatesAllowed in interface PathRepositorySource
Parameters:
updatesAllowed - must be true
Throws:
RepositorySourceException - if updatesAllowed != true.
See Also:
PathRepositorySource.areUpdatesAllowed()


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.