org.jboss.dna.connector.jdbc
Class JdbcRepositorySource

java.lang.Object
  extended by org.jboss.dna.connector.jdbc.JdbcRepositorySource
All Implemented Interfaces:
Serializable, Referenceable, ObjectFactory, RepositorySource

public class JdbcRepositorySource
extends Object
implements RepositorySource, ObjectFactory

A description of a JDBC resource that can be used to access database information.

Author:
Sergiy Litsenko
See Also:
Serialized Form

Field Summary
static int DEFAULT_RETRY_LIMIT
          The default limit is 0 for retrying connection calls to the underlying source.
static String DEFAULT_ROOT_NODE_UUID
          The default UUID that is used for root nodes in a JDBC connector.
static boolean DEFAULT_SUPPORTS_UPDATES
          This source supports updates by default, but each instance may be configured to be read-only or updateable.
 
Constructor Summary
JdbcRepositorySource()
          default constructor
 
Method Summary
 boolean equals(Object obj)
          
 RepositorySourceCapabilities getCapabilities()
          Get the capabilities for this source.
 RepositoryConnection getConnection()
          Get a connection from this source.
 String getDatabaseUrl()
          Gets database URL as string
 String getDataSourceName()
          Sets data source JNDI name
 CachePolicy getDefaultCachePolicy()
          Get the default cache policy for this source, or null if the global default cache policy should be used
 String getDriverClassName()
          Gets JDBC driver class name
 String getName()
          Get the name for this repository source.
 Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)
          
 String getPassword()
          Get user's password
 Reference getReference()
          
 int getRetryLimit()
          Get the maximum number of retries that may be performed on a given operation when using connections created by this source.
 String getRootNodeUuid()
           
 boolean getSupportsUpdates()
          Get whether this source supports updates.
 String getUserName()
          Gets the user name
 void initialize(RepositoryContext context)
          Initialize this source to use the supplied RepositoryContext, from which this source can obtain the configuration defining this source, connections to other sources, and the execution context.
 void setDatabaseUrl(String databaseUrl)
          Sets the database URL as string
 void setDataSourceName(String dataSourceName)
          Sets data source JNDI name
 void setDefaultCachePolicy(CachePolicy defaultCachePolicy)
           
 void setDriverClassName(String driverClassName)
          Sets JDBC driver class name
 void setName(String name)
          Set the name of this source
 void setPassword(String password)
          Sets the user's password
 void setRetryLimit(int limit)
          Set the maximum number of retries that may be performed on a given operation when using connections created by this source.
 void setRootNodeUuid(String rootNodeUuid)
           
 void setSupportsUpdates(boolean supportsUpdates)
          Set whether this source supports updates.
 void setUserName(String userName)
          Sets the user name
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RETRY_LIMIT

public static final int DEFAULT_RETRY_LIMIT
The default limit is 0 for retrying connection calls to the underlying source.

See Also:
Constant Field Values

DEFAULT_SUPPORTS_UPDATES

public static final boolean DEFAULT_SUPPORTS_UPDATES
This source supports updates by default, but each instance may be configured to be read-only or updateable.

See Also:
Constant Field Values

DEFAULT_ROOT_NODE_UUID

public static final String DEFAULT_ROOT_NODE_UUID
The default UUID that is used for root nodes in a JDBC connector.

See Also:
Constant Field Values
Constructor Detail

JdbcRepositorySource

public JdbcRepositorySource()
default constructor

Method Detail

getCapabilities

public RepositorySourceCapabilities getCapabilities()
Get the capabilities for this source.

Specified by:
getCapabilities in interface RepositorySource
Returns:
the capabilities for this source; never null
See Also:
RepositorySource.getCapabilities()

getConnection

public RepositoryConnection getConnection()
                                   throws RepositorySourceException
Get a connection from this source.

Specified by:
getConnection in interface RepositorySource
Returns:
a connection
Throws:
RepositorySourceException - if there is a problem obtaining a connection
See Also:
RepositorySource.getConnection()

getName

public String getName()
Get the name for this repository source.

Specified by:
getName in interface RepositorySource
Returns:
the name; never null or empty
See Also:
RepositorySource.getName()

setName

public void setName(String name)
Set the name of this source

Parameters:
name - the name for this source

getRetryLimit

public int getRetryLimit()
Get the maximum number of retries that may be performed on a given operation when using connections created by this source. This value does not constitute a minimum number of retries; in fact, the connection user is not required to retry any operations.

Specified by:
getRetryLimit in interface RepositorySource
Returns:
the maximum number of allowable retries, or 0 if the source has no limit
See Also:
RepositorySource.getRetryLimit()

initialize

public void initialize(RepositoryContext context)
                throws RepositorySourceException
Initialize this source to use the supplied RepositoryContext, from which this source can obtain the configuration defining this source, connections to other sources, and the execution context.

This method may be called each time the configuration changes, allowing the source to update itself.

Specified by:
initialize in interface RepositorySource
Throws:
RepositorySourceException
See Also:
RepositorySource.initialize(org.jboss.dna.graph.connector.RepositoryContext)

setRetryLimit

public void setRetryLimit(int limit)
Set the maximum number of retries that may be performed on a given operation when using connections created by this source. This value does not constitute a minimum number of retries; in fact, the connection user is not required to retry any operations.

Specified by:
setRetryLimit in interface RepositorySource
Parameters:
limit - the maximum number of allowable retries, or 0 if the source has no limit
See Also:
RepositorySource.setRetryLimit(int)

getSupportsUpdates

public boolean getSupportsUpdates()
Get whether this source supports updates.

Returns:
true if this source supports updates, or false if this source only supports reading content.

setSupportsUpdates

public void setSupportsUpdates(boolean supportsUpdates)
Set whether this source supports updates.

Parameters:
supportsUpdates - true if this source supports updating content, or false if this source only supports reading content.

getDefaultCachePolicy

public CachePolicy getDefaultCachePolicy()
Get the default cache policy for this source, or null if the global default cache policy should be used

Returns:
the default cache policy, or null if this source has no explicit default cache policy

setDefaultCachePolicy

public void setDefaultCachePolicy(CachePolicy defaultCachePolicy)
Parameters:
defaultCachePolicy - Sets defaultCachePolicy to the specified value.

getRootNodeUuid

public String getRootNodeUuid()
Returns:
rootNodeUuid

setRootNodeUuid

public void setRootNodeUuid(String rootNodeUuid)
Parameters:
rootNodeUuid - Sets rootNodeUuid to the specified value.
Throws:
IllegalArgumentException - if the string value cannot be converted to UUID

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

getDriverClassName

public String getDriverClassName()
Gets JDBC driver class name

Returns:
the JDBC driver class name if any

setDriverClassName

public void setDriverClassName(String driverClassName)
Sets JDBC driver class name

Parameters:
driverClassName - the JDBC driver class name

getDatabaseUrl

public String getDatabaseUrl()
Gets database URL as string

Returns:
database URL as string

setDatabaseUrl

public void setDatabaseUrl(String databaseUrl)
Sets the database URL as string

Parameters:
databaseUrl - the database URL as string

getUserName

public String getUserName()
Gets the user name

Returns:
the user name

setUserName

public void setUserName(String userName)
Sets the user name

Parameters:
userName - the user name

getPassword

public String getPassword()
Get user's password

Returns:
user's password

setPassword

public void setPassword(String password)
Sets the user's password

Parameters:
password - the user's password

getDataSourceName

public String getDataSourceName()
Sets data source JNDI name

Returns:
data source JNDI name

setDataSourceName

public void setDataSourceName(String dataSourceName)
Sets data source JNDI name

Parameters:
dataSourceName - the data source JNDI name

getReference

public Reference getReference()

Specified by:
getReference in interface Referenceable
See Also:
Referenceable.getReference()

getObjectInstance

public Object getObjectInstance(Object obj,
                                Name name,
                                Context nameCtx,
                                Hashtable<?,?> environment)
                         throws Exception

Specified by:
getObjectInstance in interface ObjectFactory
Throws:
Exception
See Also:
ObjectFactory.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)


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