org.modeshape.graph.connector.path
Class AbstractPathRepositorySource

java.lang.Object
  extended by org.modeshape.graph.connector.path.AbstractPathRepositorySource
All Implemented Interfaces:
Serializable, Referenceable, PathRepositorySource, RepositorySource
Direct Known Subclasses:
FileSystemSource, JdbcMetadataSource, SvnRepositorySource

public abstract class AbstractPathRepositorySource
extends Object
implements PathRepositorySource

Basic implementation of the trivial PathRepositorySource methods and the path repository cache life cycle.

See Also:
Serialized Form

Field Summary
static PathCachePolicy DEFAULT_CACHE_POLICY
          The default cache policy for this repository source (no caching)
static int DEFAULT_RETRY_LIMIT
          The default number of times that a request that failed due to system error should be retried
static String DEFAULT_ROOT_NODE_UUID
          The default UUID that is used for root nodes in a store.
 
Constructor Summary
AbstractPathRepositorySource()
           
 
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.
 PathCachePolicy getCachePolicy()
          Returns the cache policy for the repository source
 String getName()
          Get the name for this repository source.
 PathRepositoryCache getPathRepositoryCache()
           
 RepositoryContext getRepositoryContext()
          Returns the repository context for the repository source
 int getRetryLimit()
          Get the maximum number of retries that may be performed on a given operation when using connections created by this source.
 UUID getRootNodeUuid()
          Get the UUID that is used for the root node of each workspace
 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 setCachePolicy(PathCachePolicy cachePolicy)
          Sets the cache policy for the repository and replaces the path repository cache with a new path repository cache tied to the new cache policy
 void setName(String name)
          Sets the name of the repository source.
 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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.modeshape.graph.connector.path.PathRepositorySource
getDefaultWorkspaceName, setUpdatesAllowed
 
Methods inherited from interface org.modeshape.graph.connector.RepositorySource
getCapabilities, getConnection
 
Methods inherited from interface javax.naming.Referenceable
getReference
 

Field Detail

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_RETRY_LIMIT

public static final int DEFAULT_RETRY_LIMIT
The default number of times that a request that failed due to system error should be retried

See Also:
Constant Field Values

DEFAULT_CACHE_POLICY

public static final PathCachePolicy DEFAULT_CACHE_POLICY
The default cache policy for this repository source (no caching)

Constructor Detail

AbstractPathRepositorySource

public AbstractPathRepositorySource()
Method Detail

areUpdatesAllowed

public boolean areUpdatesAllowed()
Get whether this source allows updates.

Specified by:
areUpdatesAllowed in interface PathRepositorySource
Returns:
true if this source allows updates by clients, or false if no updates are allowed
See Also:
PathRepositorySource.areUpdatesAllowed()

getRepositoryContext

public RepositoryContext getRepositoryContext()
Returns the repository context for the repository source

Specified by:
getRepositoryContext in interface PathRepositorySource
Returns:
the repository context for the repository source
See Also:
PathRepositorySource.getRepositoryContext()

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

getCachePolicy

public PathCachePolicy getCachePolicy()
Returns the cache policy for the repository source

Specified by:
getCachePolicy in interface PathRepositorySource
Returns:
the cache policy for the repository source
See Also:
PathRepositorySource.getCachePolicy()

setCachePolicy

public void setCachePolicy(PathCachePolicy cachePolicy)
Sets the cache policy for the repository and replaces the path repository cache with a new path repository cache tied to the new cache policy

Parameters:
cachePolicy - the new cache policy; may not be null

getRootNodeUuid

public UUID getRootNodeUuid()
Description copied from interface: PathRepositorySource
Get the UUID that is used for the root node of each workspace

Specified by:
getRootNodeUuid in interface PathRepositorySource
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

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

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)
Sets the name of the repository source. The name should be unique among loaded repository sources.

Parameters:
name - the new name for the repository source; may not be empty

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

getPathRepositoryCache

public PathRepositoryCache getPathRepositoryCache()
Returns:
the active path repository cache; never null


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