org.apache.chemistry.opencmis.client.api
Interface SessionFactory


public interface SessionFactory

Entry point into the OpenCMIS Client API. The SessionFactory class implementation needs to be retrieved by any runtime lookup call. This can for instance be a J2EE JNDI lookup or an OSGi service lookup.

The entries of parameter map are defined by SessionParameter class which is part of the commons package. Parameters specify connection settings (user name, authentication, connection url, binding type (soap or atom pub) ...).

The Session class which is constructed is either the session base class which is the default implementation or it can be derived from that implementing special behavior for the session. Which session finally is returned can be controlled by the SessionParameter.SESSION_TYPE parameter.

Example Coding:

SessionFactory factory = ... // use a runtime lookup service
Map parameters = ...

parameters.put(SessionParameter.USER, "username");
parameters.put(SessionParameter.URL, "http://...");
parameters.put(SessionParameter.SESSION_TYPE, SessionType.TRANSIENT.value());
...

TransientSession s = factory.createSession(parameters);

If the SessionType parameter is not specified then the default persistent session is returned.


Method Summary
<T extends Session>
T
createSession(Map<String,String> parameters)
          Obtain a new session using parameter configuration.
 List<Repository> getRepositories(Map<String,String> parameters)
          Returns all repositories that are available at the endpoint.
 

Method Detail

createSession

<T extends Session> T createSession(Map<String,String> parameters)
Obtain a new session using parameter configuration.

Parameters:
T - A from the Session interface derived sub type
parameters - a Map of name/value pairs with parameters for the session. See class SessionParameter.
Returns:
a session to the CMIS repository specified by the parameters.

getRepositories

List<Repository> getRepositories(Map<String,String> parameters)
Returns all repositories that are available at the endpoint. See createSession(Map) for parameter details. The parameter SessionParameter.REPOSITORY_ID should not be set.



Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.