org.jboss.dna.connector.federation
Class FederatedRepositorySource

java.lang.Object
  extended by org.jboss.dna.connector.federation.FederatedRepositorySource
All Implemented Interfaces:
Serializable, Referenceable, ObjectFactory, org.jboss.dna.graph.connectors.RepositorySource

@ThreadSafe
public class FederatedRepositorySource
extends Object
implements org.jboss.dna.graph.connectors.RepositorySource, ObjectFactory

Author:
Randall Hauch
See Also:
Serialized Form

Nested Class Summary
protected  class FederatedRepositorySource.Capabilities
           
 
Field Summary
static String CACHE_POLICY_TIME_TO_LIVE_CONFIG_PROPERTY_NAME
           
protected static String CONFIGURATION_SOURCE_NAME
           
protected static String CONFIGURATION_SOURCE_PATH
           
static String DEFAULT_CONFIGURATION_SOURCE_PATH
           
static int DEFAULT_RETRY_LIMIT
          The default limit is 0 for retrying connection calls to the underlying source.
static String DNA_CACHE_SEGMENT
           
static String DNA_PROJECTIONS_SEGMENT
           
protected static String PASSWORD
           
static String PATH_TO_CONFIGURATION_INFORMATION
           
static String PROJECTION_RULES_CONFIG_PROPERTY_NAME
           
protected static String REPOSITORY_NAME
           
protected static String RETRY_LIMIT
           
protected static String SECURITY_DOMAIN
           
protected static String SOURCE_NAME
           
protected static String USERNAME
           
 
Constructor Summary
FederatedRepositorySource()
          Create a new instance of the source, which must still be properly initialized with a repository name.
FederatedRepositorySource(String repositoryName)
          Create a new instance of the source with the required repository name and federation service.
 
Method Summary
protected  void changeRepositoryConfig()
          This method is called to signal that some aspect of the configuration has changed.
protected  CallbackHandler createCallbackHandler()
           
protected  Projection createProjection(org.jboss.dna.graph.ExecutionContext context, ProjectionParser projectionParser, org.jboss.dna.graph.properties.Path path, Map<org.jboss.dna.graph.properties.Name,org.jboss.dna.graph.properties.Property> properties, org.jboss.dna.common.collection.Problems problems)
          Instantiate the Projection described by the supplied properties.
 boolean equals(Object obj)
          
 org.jboss.dna.graph.connectors.RepositorySourceCapabilities getCapabilities()
          
 String getConfigurationSourceName()
          Get the name in JNDI of a RepositorySource instance that should be used by the federated repository as the configuration repository.
 String getConfigurationSourcePath()
          Get the path in the source that will be subgraph below the /dna:system branch of the repository.
 org.jboss.dna.graph.connectors.RepositoryConnection getConnection()
          
protected  org.jboss.dna.graph.ExecutionContext getExecutionContext()
           
 String getName()
          
 Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)
          
 String getPassword()
          Get the password that should be used when authenticating and creating connections.
 Reference getReference()
          
protected  FederatedRepository getRepository()
          Get the FederatedRepository instance that this source is using.
protected  FederatedRepositoryConfig getRepositoryConfiguration(org.jboss.dna.graph.ExecutionContext context, org.jboss.dna.graph.connectors.RepositoryConnectionFactory connectionFactory)
          Create a FederatedRepositoryConfig instance from the current properties of this instance.
 org.jboss.dna.graph.connectors.RepositoryContext getRepositoryContext()
           
 String getRepositoryName()
          Get the name of the federated repository.
 int getRetryLimit()
          
 String getSecurityDomain()
          Get the name of the security domain that should be used by JAAS to identify the application or security context.
 String getUsername()
          Get the username that should be used when authenticating and creating connections.
 int hashCode()
          
 void initialize(org.jboss.dna.graph.connectors.RepositoryContext context)
          
 void setConfigurationSourceName(String sourceName)
          Get the name of a RepositorySource instance that should be used by the federated repository as the configuration repository.
 void setConfigurationSourcePath(String pathInSourceToConfigurationRoot)
          Set the path in the source that will be subgraph below the /dna:system branch of the repository.
 void setName(String sourceName)
          Set the name of this source.
 void setPassword(String password)
          Get the password that should be used when authenticating and creating connections.
 void setRepositoryName(String repositoryName)
          Get the name of the federated repository.
 void setRetryLimit(int limit)
          
 void setSecurityDomain(String securityDomain)
          Set the name of the security domain that should be used by JAAS to identify the application or security context.
 void setUsername(String username)
          Set the username that should be used when authenticating and creating connections.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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_CONFIGURATION_SOURCE_PATH

public static final String DEFAULT_CONFIGURATION_SOURCE_PATH
See Also:
Constant Field Values

REPOSITORY_NAME

protected static final String REPOSITORY_NAME
See Also:
Constant Field Values

SOURCE_NAME

protected static final String SOURCE_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

CONFIGURATION_SOURCE_NAME

protected static final String CONFIGURATION_SOURCE_NAME
See Also:
Constant Field Values

CONFIGURATION_SOURCE_PATH

protected static final String CONFIGURATION_SOURCE_PATH
See Also:
Constant Field Values

SECURITY_DOMAIN

protected static final String SECURITY_DOMAIN
See Also:
Constant Field Values

RETRY_LIMIT

protected static final String RETRY_LIMIT
See Also:
Constant Field Values

PATH_TO_CONFIGURATION_INFORMATION

public static final String PATH_TO_CONFIGURATION_INFORMATION
See Also:
Constant Field Values

DNA_CACHE_SEGMENT

public static final String DNA_CACHE_SEGMENT
See Also:
Constant Field Values

DNA_PROJECTIONS_SEGMENT

public static final String DNA_PROJECTIONS_SEGMENT
See Also:
Constant Field Values

PROJECTION_RULES_CONFIG_PROPERTY_NAME

public static final String PROJECTION_RULES_CONFIG_PROPERTY_NAME
See Also:
Constant Field Values

CACHE_POLICY_TIME_TO_LIVE_CONFIG_PROPERTY_NAME

public static final String CACHE_POLICY_TIME_TO_LIVE_CONFIG_PROPERTY_NAME
See Also:
Constant Field Values
Constructor Detail

FederatedRepositorySource

public FederatedRepositorySource()
Create a new instance of the source, which must still be properly initialized with a repository name.


FederatedRepositorySource

public FederatedRepositorySource(String repositoryName)
Create a new instance of the source with the required repository name and federation service.

Parameters:
repositoryName - the repository name
Throws:
IllegalArgumentException - if the federation service is null or the repository name is null or blank
Method Detail

initialize

public void initialize(org.jboss.dna.graph.connectors.RepositoryContext context)
                throws org.jboss.dna.graph.connectors.RepositorySourceException

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

getRepositoryContext

public org.jboss.dna.graph.connectors.RepositoryContext getRepositoryContext()
Returns:
repositoryContext

getName

public String getName()

Specified by:
getName in interface org.jboss.dna.graph.connectors.RepositorySource

setName

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

This is a required property.

Parameters:
sourceName - the name of this repository source
See Also:
setConfigurationSourceName(String), setConfigurationSourcePath(String), setPassword(String), setUsername(String), setRepositoryName(String), setPassword(String), setUsername(String), setName(String)

getRetryLimit

public int getRetryLimit()

Specified by:
getRetryLimit in interface org.jboss.dna.graph.connectors.RepositorySource
See Also:
RepositorySource.getRetryLimit()

setRetryLimit

public void setRetryLimit(int limit)

Specified by:
setRetryLimit in interface org.jboss.dna.graph.connectors.RepositorySource
See Also:
RepositorySource.setRetryLimit(int)

getConfigurationSourceName

public String getConfigurationSourceName()
Get the name in JNDI of a RepositorySource instance that should be used by the federated repository as the configuration repository.

This is a required property.

Returns:
the JNDI name of the RepositorySource instance that should be used for the configuration, or null if the federated repository instance is to be found in JNDI
See Also:
setConfigurationSourceName(String)

setConfigurationSourceName

public void setConfigurationSourceName(String sourceName)
Get the name of a RepositorySource instance that should be used by the federated repository as the configuration repository. The instance will be retrieved from the RepositoryConnectionFactory instance from the repository context supplied during initialization.

This is a required property.

Parameters:
sourceName - the name of the RepositorySource instance that should be used for the configuration, or null if the federated repository instance is to be found in JNDI
See Also:
getConfigurationSourceName(), setConfigurationSourcePath(String), setPassword(String), setUsername(String), setRepositoryName(String), setName(String)

getConfigurationSourcePath

public String getConfigurationSourcePath()
Get the path in the source that will be subgraph below the /dna:system branch of the repository.

This is a required property.

Returns:
the string array of projection rules, or null if the projection rules haven't yet been set or if the federated repository instance is to be found in JNDI
See Also:
setConfigurationSourcePath(String)

setConfigurationSourcePath

public void setConfigurationSourcePath(String pathInSourceToConfigurationRoot)
Set the path in the source that will be subgraph below the /dna:system branch of the repository.

This is a required property.

Parameters:
pathInSourceToConfigurationRoot - the path within the configuration source to the node that should be the root of the configuration information, or null if the path hasn't yet been set or if the federated repository instance is to be found in JNDI
See Also:
setConfigurationSourcePath(String), setConfigurationSourceName(String), setPassword(String), setUsername(String), setRepositoryName(String), setName(String)

getSecurityDomain

public String getSecurityDomain()
Get the name of the security domain that should be used by JAAS to identify the application or security context. This should correspond to the JAAS login configuration located within the JAAS login configuration file.

Returns:
securityDomain

setSecurityDomain

public void setSecurityDomain(String securityDomain)
Set the name of the security domain that should be used by JAAS to identify the application or security context. This should correspond to the JAAS login configuration located within the JAAS login configuration file.

Parameters:
securityDomain - Sets securityDomain to the specified value.

getRepositoryName

public String getRepositoryName()
Get the name of the federated repository.

This is a required property.

Returns:
the name of the repository
See Also:
setRepositoryName(String)

setRepositoryName

public void setRepositoryName(String repositoryName)
Get the name of the federated repository.

This is a required property.

Parameters:
repositoryName - the new name of the repository
Throws:
IllegalArgumentException - if the repository name is null, empty or blank
See Also:
getRepositoryName(), setConfigurationSourceName(String), setConfigurationSourcePath(String), setPassword(String), setUsername(String), setName(String)

getUsername

public String getUsername()
Get the username that should be used when authenticating and creating connections.

This is an optional property, required only when authentication is to be used.

Returns:
the username, or null if no username has been set or are not to be used
See Also:
setUsername(String)

setUsername

public void setUsername(String username)
Set the username that should be used when authenticating and creating connections.

This is an optional property, required only when authentication is to be used.

Parameters:
username - the username, or null if no username has been set or are not to be used
See Also:
getUsername(), setPassword(String), setConfigurationSourceName(String), setConfigurationSourcePath(String), setPassword(String), setRepositoryName(String), setName(String)

getPassword

public String getPassword()
Get the password that should be used when authenticating and creating connections.

This is an optional property, required only when authentication is to be used.

Returns:
the password, or null if no password have been set or are not to be used
See Also:
setPassword(String)

setPassword

public void setPassword(String password)
Get the password that should be used when authenticating and creating connections.

This is an optional property, required only when authentication is to be used.

Parameters:
password - the password, or null if no password have been set or are not to be used
See Also:
getPassword(), setConfigurationSourceName(String), setConfigurationSourcePath(String), setUsername(String), setRepositoryName(String), setName(String)

changeRepositoryConfig

protected void changeRepositoryConfig()
This method is called to signal that some aspect of the configuration has changed. If a repository instance has been created, it's configuration is rebuilt and updated. Nothing is done, however, if there is currently no repository.


getConnection

public org.jboss.dna.graph.connectors.RepositoryConnection getConnection()
                                                                  throws org.jboss.dna.graph.connectors.RepositorySourceException

Specified by:
getConnection in interface org.jboss.dna.graph.connectors.RepositorySource
Throws:
org.jboss.dna.graph.connectors.RepositorySourceException
See Also:
RepositorySource.getConnection()

getRepository

protected FederatedRepository getRepository()
                                     throws org.jboss.dna.graph.connectors.RepositorySourceException
Get the FederatedRepository instance that this source is using. This method uses the following logic:
  1. If a FederatedRepository already was obtained from a prior call, the same instance is returned.
  2. A FederatedRepository is created using a FederatedRepositoryConfig is created from this instance's properties and ExecutionContext and RepositoryConnectionFactory instances obtained from JNDI.

Returns:
the federated repository instance
Throws:
org.jboss.dna.graph.connectors.RepositorySourceException

getExecutionContext

protected org.jboss.dna.graph.ExecutionContext getExecutionContext()

createCallbackHandler

protected CallbackHandler createCallbackHandler()

getRepositoryConfiguration

protected FederatedRepositoryConfig getRepositoryConfiguration(org.jboss.dna.graph.ExecutionContext context,
                                                               org.jboss.dna.graph.connectors.RepositoryConnectionFactory connectionFactory)
Create a FederatedRepositoryConfig instance from the current properties of this instance. This method does not modify the state of this instance.

Parameters:
context - the execution context that should be used to read the configuration; may not be null
connectionFactory - the factory for RepositoryConnections can be obtained; may not be null
Returns:
a configuration reflecting the current state of this instance

createProjection

protected Projection createProjection(org.jboss.dna.graph.ExecutionContext context,
                                      ProjectionParser projectionParser,
                                      org.jboss.dna.graph.properties.Path path,
                                      Map<org.jboss.dna.graph.properties.Name,org.jboss.dna.graph.properties.Property> properties,
                                      org.jboss.dna.common.collection.Problems problems)
Instantiate the Projection described by the supplied properties.

Parameters:
context - the execution context that should be used to read the configuration; may not be null
projectionParser - the projection rule parser that should be used; may not be null
path - the path to the node where these properties were found; never null
properties - the properties; never null
problems - the problems container in which any problems should be reported; never null
Returns:
the region instance, or null if it could not be created

getReference

public Reference getReference()

Specified by:
getReference in interface Referenceable

getObjectInstance

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

Specified by:
getObjectInstance in interface ObjectFactory
Throws:
Exception

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

getCapabilities

public org.jboss.dna.graph.connectors.RepositorySourceCapabilities getCapabilities()

Specified by:
getCapabilities in interface org.jboss.dna.graph.connectors.RepositorySource
See Also:
RepositorySource.getCapabilities()


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