org.modeshape.connector.store.jpa
Class JpaSource

java.lang.Object
  extended by org.modeshape.connector.store.jpa.JpaSource
All Implemented Interfaces:
Serializable, Referenceable, ObjectFactory, RepositorySource

@ThreadSafe
public class JpaSource
extends Object
implements RepositorySource, ObjectFactory

The RepositorySource for the connector that stores content in a (custom) relational database. This connector uses Java Persistence API as the interface to the database, with Hibernate as the JPA implementation. (Note that some Hibernate-specific features are used.)

See Also:
Serialized Form

Nested Class Summary
static class JpaSource.Models
          This source is capable of using different database schemas
 
Field Summary
protected static String ALLOW_CREATING_WORKSPACES
           
protected static String AUTO_GENERATE_SCHEMA
           
static String AUTO_GENERATE_SCHEMA_DISABLE
          The automatic schema generation setting that should be used in production is ""disable" ".
protected static String CACHE_CONCURRENCY_STRATEGY
           
protected static String CACHE_MANAGER
           
protected static String CACHE_PROVIDER_CLASS_NAME
           
protected static String CACHE_TIME_TO_LIVE_IN_MILLISECONDS
           
protected static String COMPRESS_DATA
           
protected static String DATA_SOURCE_JNDI_NAME
           
static boolean DEFAULT_ALLOWS_UPDATES
          This source supports updates by default, but each instance may be configured to be read-only or updateable.
static String DEFAULT_AUTO_GENERATE_SCHEMA
          The default automatic schema generation setting is ""validate" ", unless otherwise specified.
static String DEFAULT_CACHE_CONCURRENCY_STRATEGY
          The cache concurrency strategy is ""read-write" ", unless otherwise specified.
static String DEFAULT_CACHE_MANAGER_LOOKUP
          The cache manager lookup name is " ", unless otherwise specified.
static String DEFAULT_CACHE_PROVIDER_CLASS_NAME
          The class name of the JPA cache provider is " ", unless otherwise specified.
protected static int DEFAULT_MAXIMUM_FETCH_DEPTH
           
static String DEFAULT_NAME_OF_DEFAULT_WORKSPACE
          The initial name of the default workspace is ""default" ", unless otherwise specified.
static String DEFAULT_ROOT_NODE_UUID
          The default UUID that is used for root nodes in a store.
static String DEFAULT_SCHEMA_NAME
           
static boolean DEFAULT_SHOW_SQL
          This source does not output executed SQL by default, but this can be overridden by calling setShowSql(boolean).
static boolean DEFAULT_SUPPORTS_CREATING_WORKSPACES
          This source does support creating workspaces.
protected static String DEFAULT_WORKSPACE
           
protected static String DIALECT
           
protected static String DRIVER_CLASS_NAME
           
protected static String DRIVER_CLASSLOADER_NAME
           
protected static String ENFORCE_REFERENTIAL_INTEGRITY
           
protected static String IDLE_TIME_IN_SECONDS_BEFORE_TESTING_CONNECTIONS
           
protected static String ISOLATION_LEVEL
           
protected static String LARGE_VALUE_SIZE_IN_BYTES
           
protected static String MAXIMUM_CONNECTION_IDLE_TIME_IN_SECONDS
           
protected static String MAXIMUM_CONNECTIONS_IN_POOL
           
protected static String MAXIMUM_SIZE_OF_STATEMENT_CACHE
           
protected static String MINIMUM_CONNECTIONS_IN_POOL
           
protected static String MODEL_NAME
           
protected static String NUMBER_OF_CONNECTIONS_TO_BE_ACQUIRED_AS_NEEDED
           
protected static String PASSWORD
           
protected static String PREDEFINED_WORKSPACE_NAMES
           
protected static String RETRY_LIMIT
           
protected static String ROOT_NODE_UUID
           
protected static String SCHEMA_NAME
           
protected static String SOURCE_NAME
           
protected static boolean SUPPORTS_AUTOMATIC_GARBAGE_COLLECTION
          This source does not support automatic garbage collection.
protected static boolean SUPPORTS_EVENTS
          This source supports events.
protected static boolean SUPPORTS_REFERENCES
          This source supports creating references.
protected static boolean SUPPORTS_SAME_NAME_SIBLINGS
          This source supports same-name-siblings.
protected static String URL
           
protected static String USERNAME
           
 
Constructor Summary
JpaSource()
           
 
Method Summary
 boolean areUpdatesAllowed()
          Get whether this source allows updates.
 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.
 String getAutoGenerateSchema()
          Get the Hibernate setting dictating what it does with the database schema upon first connection.
 String getCacheConcurrencyStrategy()
          Get the cache concurrency strategy.
 String getCacheManagerLookup()
          Get the value specifying where the cache manager should be found.
 CachePolicy getCachePolicy()
          Returns the current cache policy
 String getCacheProviderClassName()
          Get the name of the implementation class for the JPA cache provider or region factory.
 int getCacheTimeToLiveInMilliseconds()
          Get the time in milliseconds that content returned from this source may used while in the cache.
 RepositorySourceCapabilities getCapabilities()
          Get the capabilities for this source.
 RepositoryConnection getConnection()
          Get a connection from this source.
 String getDataSourceJndiName()
           
 String getDefaultWorkspaceName()
          Get the name of the default workspace.
 String getDialect()
           
 String getDriverClassloaderName()
           
 String getDriverClassName()
           
 EntityManagers getEntityManagers()
          Returns the current EntityManagers reference.
 int getIdleTimeInSecondsBeforeTestingConnections()
           
 Integer getIsolationLevel()
          Get the JDBC transaction isolation level that should be used.
 long getLargeValueSizeInBytes()
           
protected  Logger getLogger()
           
 int getMaximumConnectionIdleTimeInSeconds()
           
 int getMaximumConnectionsInPool()
           
 int getMaximumSizeOfStatementCache()
           
 int getMinimumConnectionsInPool()
           
 String getModel()
          Get the model that will be used.
 String getName()
          Get the name for this repository source.
 int getNumberOfConnectionsToAcquireAsNeeded()
           
 Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)
          
 String getPassword()
           
 String[] getPredefinedWorkspaceNames()
          Gets the names of the workspaces that are available when this source is created.
 Reference getReference()
          
 RepositoryContext getRepositoryContext()
          Returns the current repository context for the source, as set with a call to initialize(RepositoryContext).
 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()
           
 UUID getRootUuid()
           
 String getSchemaName()
           
 boolean getShowSql()
          Get whether this source outputs the SQL that it executes
 String getUrl()
           
 String getUsername()
           
 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.
 boolean isCompressData()
           
 boolean isCreatingWorkspacesAllowed()
          Get whether this source allows workspaces to be created dynamically.
 boolean isGarbageCollectionEnabled()
          Get whether this source garbage collects unused large values (BINARY and large STRING values) automatically, in the background.
 boolean isReferentialIntegrityEnforced()
           
 void setAllowsUpdates(boolean allowsUpdates)
          Set whether this source allows updates.
 void setAutoGenerateSchema(String autoGenerateSchema)
          Sets the setting dictating what the JPA implementation should do with the database schema upon first connection.
 void setCacheConcurrencyStrategy(String cacheConcurrencyStrategy)
          Set the cache concurrency strategy.
 void setCacheManagerLookup(String cacheManagerLookup)
          Set the value specifying where the cache manager should be found.
 void setCacheProviderClassName(String cacheProviderClassName)
          Set the class name of the JPA cache provider or region factory that should be used.
 void setCacheTimeToLiveInMilliseconds(int cacheTimeToLive)
          Set the time in milliseconds that content returned from this source may used while in the cache.
 void setCompressData(boolean compressData)
           
 void setCreatingWorkspacesAllowed(boolean allowWorkspaceCreation)
          Set whether this source allows workspaces to be created dynamically.
 void setDataSourceJndiName(String dataSourceJndiName)
           
 void setDefaultWorkspaceName(String nameOfDefaultWorkspace)
          Set the name of the workspace that should be used when clients don't specify a workspace.
 void setDialect(String dialect)
           
 void setDriverClassloaderName(String driverClassloaderName)
           
 void setDriverClassName(String driverClassName)
           
 void setGarbageCollectionEnabled(boolean garbageCollectionEnabled)
          Set whether this source garbage collects unused large values (BINARY and large STRING values) automatically, in the background.
 void setIdleTimeInSecondsBeforeTestingConnections(int idleTimeInSecondsBeforeTestingConnections)
           
 void setIsolationLevel(Integer isolationLevel)
          Set the JDBC transaction isolation level that should be used.
 void setLargeValueSizeInBytes(long largeValueSizeInBytes)
           
 void setMaximumConnectionIdleTimeInSeconds(int maximumConnectionIdleTimeInSeconds)
           
 void setMaximumConnectionsInPool(int maximumConnectionsInPool)
           
 void setMaximumSizeOfStatementCache(int maximumSizeOfStatementCache)
           
 void setMinimumConnectionsInPool(int minimumConnectionsInPool)
           
 void setModel(String modelName)
          Set the model that should be used for this store.
 void setName(String name)
          Set the name for the source
 void setNumberOfConnectionsToAcquireAsNeeded(int numberOfConnectionsToAcquireAsNeeded)
           
 void setPassword(String password)
           
 void setPredefinedWorkspaceNames(String[] predefinedWorkspaceNames)
          Sets the names of the workspaces that are available when this source is created.
 void setReferentialIntegrityEnforced(boolean referentialIntegrityEnforced)
           
 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 setSchemaName(String schemaName)
           
 void setShowSql(boolean showSql)
          Sets whether this source should output the SQL that it executes
 void setUrl(String url)
           
 void setUsername(String username)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE_NAME

protected static final String SOURCE_NAME
See Also:
Constant Field Values

ROOT_NODE_UUID

protected static final String ROOT_NODE_UUID
See Also:
Constant Field Values

DATA_SOURCE_JNDI_NAME

protected static final String DATA_SOURCE_JNDI_NAME
See Also:
Constant Field Values

DIALECT

protected static final String DIALECT
See Also:
Constant Field Values

USERNAME

protected static final String USERNAME
See Also:
Constant Field Values

PASSWORD

protected static final String PASSWORD
See Also:
Constant Field Values

SCHEMA_NAME

protected static final String SCHEMA_NAME
See Also:
Constant Field Values

URL

protected static final String URL
See Also:
Constant Field Values

DRIVER_CLASS_NAME

protected static final String DRIVER_CLASS_NAME
See Also:
Constant Field Values

DRIVER_CLASSLOADER_NAME

protected static final String DRIVER_CLASSLOADER_NAME
See Also:
Constant Field Values

ISOLATION_LEVEL

protected static final String ISOLATION_LEVEL
See Also:
Constant Field Values

MAXIMUM_CONNECTIONS_IN_POOL

protected static final String MAXIMUM_CONNECTIONS_IN_POOL
See Also:
Constant Field Values

MINIMUM_CONNECTIONS_IN_POOL

protected static final String MINIMUM_CONNECTIONS_IN_POOL
See Also:
Constant Field Values

MAXIMUM_CONNECTION_IDLE_TIME_IN_SECONDS

protected static final String MAXIMUM_CONNECTION_IDLE_TIME_IN_SECONDS
See Also:
Constant Field Values

MAXIMUM_SIZE_OF_STATEMENT_CACHE

protected static final String MAXIMUM_SIZE_OF_STATEMENT_CACHE
See Also:
Constant Field Values

NUMBER_OF_CONNECTIONS_TO_BE_ACQUIRED_AS_NEEDED

protected static final String NUMBER_OF_CONNECTIONS_TO_BE_ACQUIRED_AS_NEEDED
See Also:
Constant Field Values

IDLE_TIME_IN_SECONDS_BEFORE_TESTING_CONNECTIONS

protected static final String IDLE_TIME_IN_SECONDS_BEFORE_TESTING_CONNECTIONS
See Also:
Constant Field Values

CACHE_TIME_TO_LIVE_IN_MILLISECONDS

protected static final String CACHE_TIME_TO_LIVE_IN_MILLISECONDS
See Also:
Constant Field Values

RETRY_LIMIT

protected static final String RETRY_LIMIT
See Also:
Constant Field Values

MODEL_NAME

protected static final String MODEL_NAME
See Also:
Constant Field Values

LARGE_VALUE_SIZE_IN_BYTES

protected static final String LARGE_VALUE_SIZE_IN_BYTES
See Also:
Constant Field Values

COMPRESS_DATA

protected static final String COMPRESS_DATA
See Also:
Constant Field Values

ENFORCE_REFERENTIAL_INTEGRITY

protected static final String ENFORCE_REFERENTIAL_INTEGRITY
See Also:
Constant Field Values

DEFAULT_WORKSPACE

protected static final String DEFAULT_WORKSPACE
See Also:
Constant Field Values

PREDEFINED_WORKSPACE_NAMES

protected static final String PREDEFINED_WORKSPACE_NAMES
See Also:
Constant Field Values

ALLOW_CREATING_WORKSPACES

protected static final String ALLOW_CREATING_WORKSPACES
See Also:
Constant Field Values

AUTO_GENERATE_SCHEMA

protected static final String AUTO_GENERATE_SCHEMA
See Also:
Constant Field Values

CACHE_PROVIDER_CLASS_NAME

protected static final String CACHE_PROVIDER_CLASS_NAME
See Also:
Constant Field Values

CACHE_MANAGER

protected static final String CACHE_MANAGER
See Also:
Constant Field Values

CACHE_CONCURRENCY_STRATEGY

protected static final String CACHE_CONCURRENCY_STRATEGY
See Also:
Constant Field Values

SUPPORTS_EVENTS

protected static final boolean SUPPORTS_EVENTS
This source supports events.

See Also:
Constant Field Values

SUPPORTS_AUTOMATIC_GARBAGE_COLLECTION

protected static final boolean SUPPORTS_AUTOMATIC_GARBAGE_COLLECTION
This source does not support automatic garbage collection.

See Also:
Constant Field Values

SUPPORTS_SAME_NAME_SIBLINGS

protected static final boolean SUPPORTS_SAME_NAME_SIBLINGS
This source supports same-name-siblings.

See Also:
Constant Field Values

SUPPORTS_REFERENCES

protected static final boolean SUPPORTS_REFERENCES
This source supports creating references.

See Also:
Constant Field Values

DEFAULT_ALLOWS_UPDATES

public static final boolean DEFAULT_ALLOWS_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_SHOW_SQL

public static final boolean DEFAULT_SHOW_SQL
This source does not output executed SQL by default, but this can be overridden by calling setShowSql(boolean).

See Also:
Constant Field Values

DEFAULT_SUPPORTS_CREATING_WORKSPACES

public static final boolean DEFAULT_SUPPORTS_CREATING_WORKSPACES
This source does support creating workspaces.

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 store.

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_CACHE_PROVIDER_CLASS_NAME

public static final String DEFAULT_CACHE_PROVIDER_CLASS_NAME
The class name of the JPA cache provider is " ", unless otherwise specified.


DEFAULT_CACHE_MANAGER_LOOKUP

public static final String DEFAULT_CACHE_MANAGER_LOOKUP
The cache manager lookup name is " ", unless otherwise specified.


DEFAULT_CACHE_CONCURRENCY_STRATEGY

public static final String DEFAULT_CACHE_CONCURRENCY_STRATEGY
The cache concurrency strategy is ""read-write" ", unless otherwise specified.

See Also:
Constant Field Values

DEFAULT_SCHEMA_NAME

public static final String DEFAULT_SCHEMA_NAME

DEFAULT_MAXIMUM_FETCH_DEPTH

protected static final int DEFAULT_MAXIMUM_FETCH_DEPTH
See Also:
Constant Field Values

AUTO_GENERATE_SCHEMA_DISABLE

public static final String AUTO_GENERATE_SCHEMA_DISABLE
The automatic schema generation setting that should be used in production is ""disable" ". When using this value, the connector assumes that the database schema is already configured properly, and nothing will be done to validate the schema.

See Also:
Constant Field Values

DEFAULT_AUTO_GENERATE_SCHEMA

public static final String DEFAULT_AUTO_GENERATE_SCHEMA
The default automatic schema generation setting is ""validate" ", unless otherwise specified.

See Also:
Constant Field Values
Constructor Detail

JpaSource

public JpaSource()
Method Detail

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()

getLogger

protected Logger getLogger()

setName

public void setName(String name)
Set the name for the source

Parameters:
name - the new name for the source

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()

areUpdatesAllowed

@Description(i18n=JpaConnectorI18n.class,
             value="updatesAllowedPropertyDescription")
@Label(i18n=JpaConnectorI18n.class,
       value="updatesAllowedPropertyLabel")
@Category(i18n=JpaConnectorI18n.class,
          value="updatesAllowedPropertyCategory")
public boolean areUpdatesAllowed()
Get whether this source allows updates.

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

setAllowsUpdates

public void setAllowsUpdates(boolean allowsUpdates)
Set whether this source allows updates.

Parameters:
allowsUpdates - true if this source allows updating content, or false if this source only allows reading content.

getShowSql

public boolean getShowSql()
Get whether this source outputs the SQL that it executes

Returns:
whether this source outputs the SQL that it executes

setShowSql

public void setShowSql(boolean showSql)
Sets whether this source should output the SQL that it executes

Parameters:
showSql - true if this source should output the SQL that it executes, otherwise false

getAutoGenerateSchema

public String getAutoGenerateSchema()
Get the Hibernate setting dictating what it does with the database schema upon first connection. For more information, see setAutoGenerateSchema(String).

Returns:
the setting; never null and never empty

setAutoGenerateSchema

public void setAutoGenerateSchema(String autoGenerateSchema)
Sets the setting dictating what the JPA implementation should do with the database schema upon first connection. Valid values are as follows (though the value is not checked):

Parameters:
autoGenerateSchema - the setting for the auto-generation, or null if the default should be used; an empty string will be treated as "disable".

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()

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)

getCacheTimeToLiveInMilliseconds

public int getCacheTimeToLiveInMilliseconds()
Get the time in milliseconds that content returned from this source may used while in the cache.

Returns:
the time to live, in milliseconds, or 0 if the time to live is not specified by this source

setCacheTimeToLiveInMilliseconds

public void setCacheTimeToLiveInMilliseconds(int cacheTimeToLive)
Set the time in milliseconds that content returned from this source may used while in the cache.

Parameters:
cacheTimeToLive - the time to live, in milliseconds; 0 if the time to live is not specified by this source; or a negative number for the default value

getCachePolicy

public CachePolicy getCachePolicy()
Returns the current cache policy

Returns:
the current cache policy

getEntityManagers

public EntityManagers getEntityManagers()
Returns the current EntityManagers reference.

Returns:
the current EntityManagers reference.

getRootNodeUuid

public String getRootNodeUuid()
Returns:
rootNodeUuid

getRootUuid

public UUID getRootUuid()
Returns:
rootUuid

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

getDefaultWorkspaceName

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

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

getCacheProviderClassName

public String getCacheProviderClassName()
Get the name of the implementation class for the JPA cache provider or region factory.

Returns:
the class name of the JPA cache provider or region factory that should be used by default, or null if no JPA caching should be performed.

setCacheProviderClassName

public void setCacheProviderClassName(String cacheProviderClassName)
Set the class name of the JPA cache provider or region factory that should be used.

Typical values include:

Parameters:
cacheProviderClassName - the class name of the JPA cache provider or region factory that should be used by default, or null if no JPA caching should be performed

getCacheManagerLookup

public String getCacheManagerLookup()
Get the value specifying where the cache manager should be found. This is only used when deployed within an application server (usually JBoss AS 6 or 7) when using an Infinispan 2nd level cache via JNDI, and is often set to "java:CacheManager/entity" in these cases. This value should be left blank or null when running in other environments or with another 2nd-level cache implementation.

Returns:
the JNDI location of Infinispan cache manager that should be used for the 2nd level cache; may be null

setCacheManagerLookup

public void setCacheManagerLookup(String cacheManagerLookup)
Set the value specifying where the cache manager should be found. This is only used when deployed within an application server (usually JBoss AS 6 or 7) when using Infinispan 2nd level cache via JNDI, and is often set to "java:CacheManager/entity" in these cases. This value should be left blank or null when running in other environments or with another 2nd-level cache implementation.

This should always be set (usually to java:CacheManager/entity) when the setCacheProviderClassName(String) is set to org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.

Parameters:
cacheManagerLookup - the JNDI location of existing Infinispan cache manager (in JBoss AS 6 or 7) that should be used for the 2nd level cache; or null if not using Infinispan for a 2nd-level cache or if deployed outside of JBoss AS 6 or 7

getCacheConcurrencyStrategy

public String getCacheConcurrencyStrategy()
Get the cache concurrency strategy.

Returns:
the cache concurrency strategy being used; may be null
See Also:
setCacheConcurrencyStrategy(String)

setCacheConcurrencyStrategy

public void setCacheConcurrencyStrategy(String cacheConcurrencyStrategy)
Set the cache concurrency strategy. This value is JPA implementation specific. For Hibernate, this value should be "read-only", "nonstrict-read-write", "read-write", or "transactional", but other JPA providers may use different values.

Parameters:
cacheConcurrencyStrategy - the cache concurrency strategy being used; may be null

getPredefinedWorkspaceNames

public String[] getPredefinedWorkspaceNames()
Gets the names of the workspaces that are available when this source is created.

Returns:
the names of the workspaces that this source starts with, or null if there are no such workspaces
See Also:
setPredefinedWorkspaceNames(String[]), setCreatingWorkspacesAllowed(boolean)

setPredefinedWorkspaceNames

public void setPredefinedWorkspaceNames(String[] predefinedWorkspaceNames)
Sets the names of the workspaces that are available when this source is created.

Parameters:
predefinedWorkspaceNames - the names of the workspaces that this source should start with, or null if there are no such workspaces
See Also:
setCreatingWorkspacesAllowed(boolean), getPredefinedWorkspaceNames()

isCreatingWorkspacesAllowed

@Description(i18n=JpaConnectorI18n.class,
             value="creatingWorkspacesAllowedPropertyDescription")
@Label(i18n=JpaConnectorI18n.class,
       value="creatingWorkspacesAllowedPropertyLabel")
@Category(i18n=JpaConnectorI18n.class,
          value="creatingWorkspacesAllowedPropertyCategory")
public boolean isCreatingWorkspacesAllowed()
Get whether this source allows workspaces to be created dynamically.

Returns:
true if this source allows workspaces to be created by clients, or false if the set of workspaces is fixed
See Also:
setPredefinedWorkspaceNames(String[]), getPredefinedWorkspaceNames(), setCreatingWorkspacesAllowed(boolean)

setCreatingWorkspacesAllowed

public void setCreatingWorkspacesAllowed(boolean allowWorkspaceCreation)
Set whether this source allows workspaces to be created dynamically.

Parameters:
allowWorkspaceCreation - true if this source allows workspaces to be created by clients, or false if the set of workspaces is fixed
See Also:
setPredefinedWorkspaceNames(String[]), getPredefinedWorkspaceNames(), isCreatingWorkspacesAllowed()

isGarbageCollectionEnabled

@Description(i18n=JpaConnectorI18n.class,
             value="garbageCollectionEnabledPropertyDescription")
@Label(i18n=JpaConnectorI18n.class,
       value="garbageCollectionEnabledPropertyLabel")
@Category(i18n=JpaConnectorI18n.class,
          value="garbageCollectionEnabledPropertyCategory")
public boolean isGarbageCollectionEnabled()
Get whether this source garbage collects unused large values (BINARY and large STRING values) automatically, in the background.

Returns:
true if this source should garbage collect unused large values, or false if they should not be garbage collected
See Also:
setPredefinedWorkspaceNames(String[]), getPredefinedWorkspaceNames(), setCreatingWorkspacesAllowed(boolean)

setGarbageCollectionEnabled

public void setGarbageCollectionEnabled(boolean garbageCollectionEnabled)
Set whether this source garbage collects unused large values (BINARY and large STRING values) automatically, in the background.

Parameters:
garbageCollectionEnabled - true if this source should garbage collect unused large values
See Also:
isGarbageCollectionEnabled()

getDialect

public String getDialect()
Returns:
dialect

setDialect

public void setDialect(String dialect)
Parameters:
dialect - Sets dialect to the specified value.

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.

getSchemaName

public String getSchemaName()
Returns:
schemaName

setSchemaName

public void setSchemaName(String schemaName)
Parameters:
schemaName - Sets schemaName 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.

getModel

public String getModel()
Get the model that will be used. This may be null if not yet connected, but after connections will reflect the type of model that is being used in the store.

Returns:
the name of the model

setModel

public void setModel(String modelName)
Set the model that should be used for this store. If the store already has a model, specifying a different value has no effect, since the store's model will not be changed. After connection, this value will reflect the actual store value.

Parameters:
modelName - the name of the model that should be used for new stores, or null if the default should be used

getLargeValueSizeInBytes

public long getLargeValueSizeInBytes()
Returns:
largeValueSizeInBytes

setLargeValueSizeInBytes

public void setLargeValueSizeInBytes(long largeValueSizeInBytes)
Parameters:
largeValueSizeInBytes - Sets largeValueSizeInBytes to the specified value.

isCompressData

public boolean isCompressData()
Returns:
compressData

setCompressData

public void setCompressData(boolean compressData)
Parameters:
compressData - Sets compressData to the specified value.

isReferentialIntegrityEnforced

public boolean isReferentialIntegrityEnforced()
Returns:
referentialIntegrityEnforced

setReferentialIntegrityEnforced

public void setReferentialIntegrityEnforced(boolean referentialIntegrityEnforced)
Parameters:
referentialIntegrityEnforced - Sets referentialIntegrityEnforced to the specified value.

getIsolationLevel

public Integer getIsolationLevel()
Get the JDBC transaction isolation level that should be used. Note that if the isolation level is not set (the value is null), then this source does not explicitly set the isolation level, so the data source's value will implicitly be used.

Returns:
isolationLevel the value of the isolation level, or null if the isolation level is not set by this source (meaning the data source's current setting or its default will be used)

setIsolationLevel

public void setIsolationLevel(Integer isolationLevel)
Set the JDBC transaction isolation level that should be used. Note that if the isolation level is not set (the value is null), then this source does not explicitly set the isolation level, so the data source's value will implicitly be used.

Parameters:
isolationLevel - the value of the isolation level, or null if the isolation level is not set by this source (meaning the data source's current setting or its default will be used)

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.modeshape.graph.connector.RepositoryContext)

getReference

public Reference getReference()

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

getRepositoryContext

public RepositoryContext getRepositoryContext()
Returns the current repository context for the source, as set with a call to initialize(RepositoryContext).

Returns:
the current repository context for the source

getObjectInstance

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

Specified by:
getObjectInstance in interface ObjectFactory
Throws:
Exception

getConnection

public RepositoryConnection getConnection()
                                   throws RepositorySourceException
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
See Also:
RepositorySource.getConnection()

close

public 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. 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
See Also:
RepositorySource.close()


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