|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.graph.connector.inmemory.InMemoryRepositorySource
@ThreadSafe public class InMemoryRepositorySource

A RepositorySource for an in-memory repository. Each InMemoryRepositorySource instance contains its own
repository, and the lifetime of the source dictates the lifetime of the repository and its content.
| Nested Class Summary | |
|---|---|
protected class |
InMemoryRepositorySource.DefaultRepositoryContext
|
| Field Summary | |
|---|---|
protected static RepositorySourceCapabilities |
CAPABILITIES
|
protected static String |
DEFAULT_CACHE_POLICY_ATTR
|
static int |
DEFAULT_RETRY_LIMIT
The default limit is 0 for retrying connection calls to the underlying source. |
static String |
DEFAULT_WORKSPACE_NAME
The default name for the workspace used by this source, which is a blank string. |
protected static String |
DEFAULT_WORKSPACE_NAME_ATTR
|
protected static String |
JNDI_NAME_ATTR
|
protected static String |
PREDEFINED_WORKSPACE_NAMES
|
protected static String |
RETRY_LIMIT_ATTR
|
protected static String |
ROOT_NODE_UUID_ATTR
|
protected static String |
SOURCE_NAME_ATTR
|
| Constructor Summary | |
|---|---|
InMemoryRepositorySource()
Create a repository source instance. |
|
| 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. |
RepositorySourceCapabilities |
getCapabilities()
Get the capabilities for this source. |
RepositoryConnection |
getConnection()
Get a connection from this source. |
CachePolicy |
getDefaultCachePolicy()
Get the default cache policy for this source, or null if the global default cache policy should be used |
String |
getDefaultWorkspaceName()
Get the name of the workspace that should be used by default. |
String |
getJndiName()
Gets the JNDI name this source is bound to. |
String |
getName()
Get the name for this repository source. |
Object |
getObjectInstance(Object obj,
Name name,
Context nameCtx,
Hashtable<?,?> environment)
|
String[] |
getPredefinedWorkspaceNames()
Gets the names of the workspaces that are available when this source is created. |
Reference |
getReference()
|
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. |
String |
getRootNodeUuid()
Get the string representation of the UUID for the root node. |
UUID |
getRootNodeUuidObject()
Get the UUID for the root node. |
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 |
setDefaultCachePolicy(CachePolicy defaultCachePolicy)
|
void |
setDefaultWorkspaceName(String defaultWorkspaceName)
Set the default workspace name. |
void |
setJndiName(String name)
If you use this to set a JNDI name, this source will be bound to that name using the default InitialContext. |
void |
setJndiName(String name,
Context context)
Register this source in JNDI under the supplied name using the supplied context. to set a JNDI name, this source will be bound to that name using the default InitialContext. |
void |
setName(String name)
|
void |
setPredefinedWorkspaceNames(String[] predefinedWorkspaceNames)
Sets the names of the workspaces that are available when this source is created. |
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 |
setRootNodeUuid(UUID rootNodeUuid)
|
void |
setUpdatesAllowed(boolean updatesAllowed)
In-memory connectors aren't shared and cannot be loaded from external sources if updates are not allowed. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_RETRY_LIMIT
connection calls to the underlying source.
public static final String DEFAULT_WORKSPACE_NAME
protected static final RepositorySourceCapabilities CAPABILITIES
protected static final String ROOT_NODE_UUID_ATTR
protected static final String SOURCE_NAME_ATTR
protected static final String PREDEFINED_WORKSPACE_NAMES
protected static final String DEFAULT_WORKSPACE_NAME_ATTR
protected static final String DEFAULT_CACHE_POLICY_ATTR
protected static final String JNDI_NAME_ATTR
protected static final String RETRY_LIMIT_ATTR
| Constructor Detail |
|---|
public InMemoryRepositorySource()
| Method Detail |
|---|
public void initialize(RepositoryContext context)
throws RepositorySourceException
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.
initialize in interface RepositorySourceRepositorySourceExceptionRepositorySource.initialize(org.modeshape.graph.connector.RepositoryContext)public RepositoryContext getRepositoryContext()
BaseRepositorySourcerepository context for the repository source
getRepositoryContext in interface BaseRepositorySourcepublic int getRetryLimit()
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.
getRetryLimit in interface RepositorySourceRepositorySource.getRetryLimit()public void setRetryLimit(int limit)
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.
setRetryLimit in interface RepositorySourcelimit - the maximum number of allowable retries, or 0 if the source has no limitRepositorySource.setRetryLimit(int)public CachePolicy getDefaultCachePolicy()
getDefaultCachePolicy in interface BaseRepositorySourcepublic void setDefaultCachePolicy(CachePolicy defaultCachePolicy)
defaultCachePolicy - Sets defaultCachePolicy to the specified value.public String getDefaultWorkspaceName()
getDefaultWorkspaceName in interface BaseRepositorySourcepublic void setDefaultWorkspaceName(String defaultWorkspaceName)
defaultWorkspaceName - the name of the workspace that should be used by default, or null if "" should be usedpublic String getRootNodeUuid()
public UUID getRootNodeUuidObject()
getRootNodeUuidObject in interface BaseRepositorySourceBaseRepositorySource.getRootNodeUuidObject()public void setRootNodeUuid(UUID rootNodeUuid)
rootNodeUuid - Sets rootNodeUuid to the specified value.public void setRootNodeUuid(String rootNodeUuid)
rootNodeUuid - Sets rootNodeUuid to the specified value.
public void setJndiName(String name)
throws NamingException
InitialContext. You
can also do this manually if you have additional requirements.
name - the JNDI name
NamingException - if there is a problem registering this objectgetJndiName()
public void setJndiName(String name,
Context context)
throws NamingException
InitialContext. You can also do this manually if you have additional
requirements.
name - the JNDI name, or null if this object is to no longer be registeredcontext - the JNDI context, or null if the InitialContext should be used
NamingException - if there is a problem registering this objectgetJndiName()public String getJndiName()
setJndiName(String)public String getName()
getName in interface RepositorySourcepublic void setName(String name)
name - Sets name to the specified value.
public RepositoryConnection getConnection()
throws RepositorySourceException
getConnection in interface RepositorySourceRepositorySourceException - if there is a problem obtaining a connectionRepositorySource.getConnection()public void close()
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.
close in interface RepositorySourceRepositorySource.close()public Reference getReference()
getReference in interface Referenceable
public Object getObjectInstance(Object obj,
Name name,
Context nameCtx,
Hashtable<?,?> environment)
throws Exception
getObjectInstance in interface ObjectFactoryExceptionpublic String[] getPredefinedWorkspaceNames()
setPredefinedWorkspaceNames(String[])public void setPredefinedWorkspaceNames(String[] predefinedWorkspaceNames)
predefinedWorkspaceNames - the names of the workspaces that this source should start with, or null if there are no
such workspacesgetPredefinedWorkspaceNames()public RepositorySourceCapabilities getCapabilities()
getCapabilities in interface RepositorySourceRepositorySource.getCapabilities()
@Description(i18n=GraphI18n.class,
value="updatesAllowedPropertyDescription")
@Label(i18n=GraphI18n.class,
value="updatesAllowedPropertyLabel")
@Category(i18n=GraphI18n.class,
value="updatesAllowedPropertyCategory")
@ReadOnly
public boolean areUpdatesAllowed()
BaseRepositorySource
areUpdatesAllowed in interface BaseRepositorySourceBaseRepositorySource.setUpdatesAllowed(boolean)public void setUpdatesAllowed(boolean updatesAllowed)
setUpdatesAllowed in interface BaseRepositorySourceupdatesAllowed - must be true
RepositorySourceException - if updatesAllowed != true.BaseRepositorySource.areUpdatesAllowed()public String toString()
toString in class ObjectObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||