Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.connector.jcr
Class JcrRepositorySource

    java.lang.Object
      org.modeshape.connector.jcr.JcrRepositorySource

All Implemented Interfaces:
  Serializable, Referenceable, ObjectFactory, RepositorySource

    @ThreadSafe
    public class JcrRepositorySource

extends Object
implements RepositorySource, ObjectFactory

The `RepositorySource` for the connector that exposes an area of the local file system as content in a repository. This source considers a workspace name to be the path to the directory on the file system that represents the root of that workspace. New workspaces can be created, as long as the names represent valid paths to existing directories.

See Also:
  Serialized Form

Field Summary
`protected static String` | `CREDENTIALS`
`protected static String` | `DEFAULT_CACHE_POLICY`
`static int` | `DEFAULT_RETRY_LIMIT` The default limit is 0 for retrying `connection` calls to the underlying source.
`protected static String` | `PASSWORD`
`protected static String` | `REPOSITORY_JNDI_NAME`
`protected static String` | `RETRY_LIMIT`
`protected static String` | `SOURCE_NAME`
`protected static boolean` | `SUPPORTS_CREATING_WORKSPACES` This source does not support creating new workspaces, since the JCR API does not provide a way of doing so.
`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 boolean` | `SUPPORTS_UPDATES` This source does support updates.
`protected static String` | `USERNAME`

Constructor Summary
`JcrRepositorySource()` Create a new instance of a JCR repository source.

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.
`protected Context` | `getContext()`
`Credentials` | `getCredentials()` Get the JCR credentials that should be used.
`CachePolicy` | `getDefaultCachePolicy()` Get the default cache policy for this source, or null if the global default cache policy should be used
`String` | `getName()` Get the name for this repository source.
`Object` | `getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)`
`String` | `getPassword()`
`Reference` | `getReference()`
`protected Repository` | `getRepository()`
`protected RepositoryContext` | `getRepositoryContext()`
`String` | `getRepositoryJndiName()`
`int` | `getRetryLimit()` Get the maximum number of retries that may be performed on a given operation when using `connections` created by this source.
`boolean` | `getUpdatesAllowed()` Get whether this source supports updates.
`String` | `getUsername()` Get the username that should be used to access the repository.
`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`.
`protected void` | `setContext(Context context)`
`void` | `setCredentials(Credentials credentials)` Set the JCR credentials that should be used.
`void` | `setDefaultCachePolicy(CachePolicy defaultCachePolicy)`
`void` | `setName(String name)` Set the name for the source
`void` | `setPassword(String password)`
`protected void` | `setRepository(Repository repository)`
`void` | `setRepositoryJndiName(String repositoryJndiName)` Set the name in JNDI where this source can find the JCR Repository object.
`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` | `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

### REPOSITORY_JNDI_NAME

    protected static final String REPOSITORY_JNDI_NAME

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

### CREDENTIALS

    protected static final String CREDENTIALS

See Also:
  Constant Field Values

### DEFAULT_CACHE_POLICY

    protected static final String DEFAULT_CACHE_POLICY

See Also:
  Constant Field Values

### RETRY_LIMIT

    protected static final String RETRY_LIMIT

See Also:
  Constant Field Values

### 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

### SUPPORTS_EVENTS

    protected static final boolean SUPPORTS_EVENTS

  This source supports events.

  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_UPDATES

    protected static final boolean SUPPORTS_UPDATES

  This source does support updates.

  See Also:
    Constant Field Values

### SUPPORTS_CREATING_WORKSPACES

    protected static final boolean SUPPORTS_CREATING_WORKSPACES

  This source does not support creating new workspaces, since the JCR API does not provide a way of doing so.

  See Also:
    Constant Field Values

### SUPPORTS_REFERENCES

    protected static final boolean SUPPORTS_REFERENCES

  This source supports creating references.

  See Also:
    Constant Field Values

Constructor Detail

### JcrRepositorySource

    public JcrRepositorySource()

  Create a new instance of a JCR repository source.

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

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

### getUpdatesAllowed

    @Description(i18n=JcrConnectorI18n.class,
                 value="updatesAllowedPropertyDescription")
    @Label(i18n=JcrConnectorI18n.class,
           value="updatesAllowedPropertyLabel")
    @Category(i18n=JcrConnectorI18n.class,
              value="updatesAllowedPropertyCategory")
    public boolean getUpdatesAllowed()

  Get whether this source supports updates.

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

### getRepositoryJndiName

    public String getRepositoryJndiName()

  Returns:
    dataSourceJndiName

### setRepositoryJndiName

    public void setRepositoryJndiName(String repositoryJndiName)

  Set the name in JNDI where this source can find the JCR Repository object.

  Parameters:
    `repositoryJndiName` - the name in JNDI where the JCR Repository object can be found

### getUsername

    public String getUsername()

  Get the username that should be used to access the repository.

  Returns:
    the username, which may be null if the

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

### getCredentials

    public Credentials getCredentials()

  Get the JCR credentials that should be used.

  Returns:
    the credentials, or null if no credentials should be used

### setCredentials

    public void setCredentials(Credentials credentials)

  Set the JCR credentials that should be used.

  Parameters:
    `credentials` - the credentials, or null if no fixed credentials should be used

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

### 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)`

### 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)`

### getRepositoryContext

    protected RepositoryContext getRepositoryContext()

### getRepository

    protected Repository getRepository()

### setRepository

    protected void setRepository(Repository repository)

### getContext

    protected Context getContext()

### setContext

    protected void setContext(Context context)

### 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`

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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