chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Müller <>
Subject Re: question about SessionParameter.REPOSITORY_ID
Date Fri, 24 Aug 2012 21:15:19 GMT
Hi Mark,

You always need a repository id to set up an OpenCMIS session!

However, if there is only one repository exposed (e.g. Alfresco), these 
two lines help you detect and hide it:

List<Repository> repositories = factory.getRepositories(parameters);
Session session = repositories.get(0).createSession();

The "parameters" here don't require a repository id because the 
getRepositories() operation is the only CMIS operation that works 
without an id.

It returns a list of all repositories. That's the list you see in the 
CMIS Workbench.
If there is only one repository, this list is short - it has one entry. 
If you know that the ECM system exposed exactly one repository, it is 
safe to pick the first one from the that list.

The Repository object knows its id and adds it to the parameters when 
createSession() is called.
This way you don't need supply a repository id. It is determined before 
you create the session.

If an ECM system exposed (potentially) more than one repository, then 
you have to tell OpenCMIS which one you want to connect to by supplying 
a repository id.
The CMIS Workbench presents the list of available repositories and let 
the user pick.

- Florian

> Hello
> Pardon what may be a question asked already or my likely misunderstanding:
> We are using OpenCMIS libraries (Java) to communicate with both an Alfresco
> 4 and Sharepoint 2010 instance quite successfully.  In the case of AF4,
> there is only ONE repository set up.  On Sharepoint, there are 4
> repositories.
> When initializing a Session, we have been initially setting the Map of
> parameters that include (among others), the following:
>           parameters.put(SessionParameter.USER, cmisUserName);
>           parameters.put(SessionParameter.PASSWORD, cmisPassword);
>           parameters.put(SessionParameter.REPOSITORY_ID, cmisRepositoryId);
> The *values *on these keys are variables we have set up in some properties
> file for testing right now.
> On  the page here:
> There is a mention that the parameter *SessionParameter.REPOSITORY_ID* did
> not have to be set when connecting to an ECM server that has more than one
> repository and hence multiple GUIDs , one for each one that is available.
> However, when I try to leave that parameter out and get the Session, I end
> up with this exception:
> java.lang.IllegalStateException: Repository Id is not set!
> at
> org.apache.chemistry.opencmis.client.runtime.SessionImpl.connect(
> at
> org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.createSession(
> at
> org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.createSession(
> If I use the Chemistry workbench using the AtomPub URL, or WSDL binding, It
> connects and gives the list of repositories and in that case, we are not
> setting any ID.
> In my code where we are creating the Session, but without setting this ID
> value, we get the exception above.
> *This is 0.8.0 SNAPSHOT - built from source.   Java JDK 6.*
> Any insight would be appreciated.

View raw message