org.objectweb.dsrg.sofa.repository
Class RepositoryAgent

java.lang.Object
  extended by org.objectweb.dsrg.sofa.repository.RepositoryAgent

public class RepositoryAgent
extends java.lang.Object

This is main class responsible for initializing repository client side and it must be used for all operations on repository.


Field Summary
static java.lang.String DEFAULT_CONFIGURATION_FILENAME
          Default configuration filename used for reading configuration.
static java.lang.String DEFAULT_REPOSITORY_CONTEXT
          Default repository context path used for initializing repository, if context path is not specified.
static java.lang.String DEFAULT_REPOSITORY_HOST
          Default repository host name used for initializing repository, if host name is not specified.
static int DEFAULT_REPOSITORY_PORT
          Default repository port used for initializing repository, if port is not specified.
static java.lang.String DEFAULT_REPOSITORY_URL
          Default repository URL used for initializing repository, if URL is not specified.
static org.apache.commons.httpclient.HttpClient httpClientInstance
          Global HttpClient instance, which should be used in any Http transfer.
static java.lang.String REPOSITORY_CONTEXT_PROPERTY
          Name of the property, from which the repository context path is loaded.
static java.lang.String REPOSITORY_HOST_PROPERTY
          Name of the property, from which the repository host name is loaded.
static java.lang.String REPOSITORY_PORT_PROPERTY
          Name of the property, from which the repository port number is loaded.
 
Constructor Summary
RepositoryAgent(NodeConfiguration nodeConfiguration)
          Basic constructor, which initialize entire repository with NodeConfiguration object.
 
Method Summary
 RepositoryCloner getCloner(RepositoryConfiguration developmentRC)
          Returns cloner object for cloning from the repository or merging into repository.
 RepositoryDeleter getDeleter()
          Returns deleter object for deleting objects from the repository.
 RepositoryFacade getFacade()
          Returns repository facade - for accessing the repository, primarily use facade.
static ModelFactory getFactory()
          Returns EMF model factory to create new model objects - DON'T USE THIS FACTORY UNLESS YOU KNOW WHAT YOU ARE DOING - Instead use create methods on RepositoryData or even better RepositoryFacade.
 NodeConfiguration getNodeConfiguration()
          Returns active node configuration of this RepositoryAgent instance.
static ModelPackage getPackage()
          Returns EMF model package to retrieve all information about metamodel of Sofa 2.0 model.
 RepositoryPersister getPersister()
          Returns persister object for storing new objects into repository.
 RepositoryQuery getQuery()
          Returns query object for looking up objects in repository.
static RepositoryAgent init()
          Tries to initialize RepositoryAgent from configuration loaded by ConfigurationHelper from default filename.
static RepositoryAgent init(java.net.URL url)
          Tries to initialize class from configuration loaded by ConfigurationHelper from URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_REPOSITORY_URL

public static final java.lang.String DEFAULT_REPOSITORY_URL
Default repository URL used for initializing repository, if URL is not specified.

See Also:
Constant Field Values

DEFAULT_REPOSITORY_PORT

public static final int DEFAULT_REPOSITORY_PORT
Default repository port used for initializing repository, if port is not specified.


DEFAULT_REPOSITORY_HOST

public static final java.lang.String DEFAULT_REPOSITORY_HOST
Default repository host name used for initializing repository, if host name is not specified.


DEFAULT_REPOSITORY_CONTEXT

public static final java.lang.String DEFAULT_REPOSITORY_CONTEXT
Default repository context path used for initializing repository, if context path is not specified.


DEFAULT_CONFIGURATION_FILENAME

public static final java.lang.String DEFAULT_CONFIGURATION_FILENAME
Default configuration filename used for reading configuration.

See Also:
Constant Field Values

REPOSITORY_HOST_PROPERTY

public static final java.lang.String REPOSITORY_HOST_PROPERTY
Name of the property, from which the repository host name is loaded.

See Also:
Constant Field Values

REPOSITORY_PORT_PROPERTY

public static final java.lang.String REPOSITORY_PORT_PROPERTY
Name of the property, from which the repository port number is loaded.

See Also:
Constant Field Values

REPOSITORY_CONTEXT_PROPERTY

public static final java.lang.String REPOSITORY_CONTEXT_PROPERTY
Name of the property, from which the repository context path is loaded.

See Also:
Constant Field Values

httpClientInstance

public static org.apache.commons.httpclient.HttpClient httpClientInstance
Global HttpClient instance, which should be used in any Http transfer. It is used by SofaInputStream and SofaOutputStream. Pay attention to release all not required connections.

Constructor Detail

RepositoryAgent

public RepositoryAgent(NodeConfiguration nodeConfiguration)
Basic constructor, which initialize entire repository with NodeConfiguration object. NodeConfiguration object should be retrieved by ConfigurationHelper class.

Parameters:
nodeConfiguration - Node configuration with all necessary connection data.
Method Detail

getPackage

public static ModelPackage getPackage()
Returns EMF model package to retrieve all information about metamodel of Sofa 2.0 model.

Returns:
ModelPackage static instance

getFactory

public static ModelFactory getFactory()
Returns EMF model factory to create new model objects - DON'T USE THIS FACTORY UNLESS YOU KNOW WHAT YOU ARE DOING - Instead use create methods on RepositoryData or even better RepositoryFacade.

Returns:
ModelFactory static instance

getQuery

public RepositoryQuery getQuery()
Returns query object for looking up objects in repository.


getPersister

public RepositoryPersister getPersister()
Returns persister object for storing new objects into repository.


getNodeConfiguration

public NodeConfiguration getNodeConfiguration()
Returns active node configuration of this RepositoryAgent instance.

Returns:
NodeConfiguration instance

getDeleter

public RepositoryDeleter getDeleter()
Returns deleter object for deleting objects from the repository.


getCloner

public RepositoryCloner getCloner(RepositoryConfiguration developmentRC)
Returns cloner object for cloning from the repository or merging into repository.

Parameters:
developmentRC - Configuration of the development repository (host, port, context).
Returns:
The cloner object.

init

public static RepositoryAgent init()
                            throws java.io.IOException
Tries to initialize RepositoryAgent from configuration loaded by ConfigurationHelper from default filename.

Returns:
RepositoryAgent instance
Throws:
java.io.IOException

init

public static RepositoryAgent init(java.net.URL url)
                            throws java.io.IOException
Tries to initialize class from configuration loaded by ConfigurationHelper from URL.

Parameters:
url - URL object specifying host, port and file with configuration stored in XML file (ussually Sofa RepositoryServer is used)
Returns:
RepositoryAgent instance
Throws:
java.io.IOException

getFacade

public RepositoryFacade getFacade()
Returns repository facade - for accessing the repository, primarily use facade.

Returns:
repsitory facade