You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Damian Sima <da...@gmail.com> on 2012/05/28 20:54:23 UTC

CMIS session and session factory

Hi guys,


I've been playing with chemistry and I found something that I want to ask
you about.

I have this portion of code:


* List<Repository> repositories = new ArrayList<Repository>();*

* repositories = sessionFactory.getRepositories(parameter);*

* for (Repository r : repositories) {*

*  System.out.println("Found repository: " + r.getName());*

* }*

*
*

* // create session with the first (and only) repository*

* Repository repository = repositories.get(0);*

* parameter.put(SessionParameter.REPOSITORY_ID, repository.getId());*

* Session session = sessionFactory.createSession(parameter);*

*
*

* System.out.println("Got a connection to repository: " +
repository.getName() + ", with id: " + repository.getId());*

*
*

* CmisObject object = session.getObject(
"workspace://SpacesStore/55817c09-d027-44ee-8b4e-37f6f64395e9");*

* System.out.println("Name: " + object.getName() + " id: " +
object.getId());*


Basically it connect (using the ATOM interface) to get the repository
information and then it tries to get another object.
Now I've been following the code and it looks like that from the first
request I'm doing which returns things like:

*<?xml version='1.0' encoding='UTF-8'?>*

*<app:service xmlns:app="http://www.w3.org/2007/app" xmlns:atom="
http://www.w3.org/2005/Atom" xmlns:cmis="
http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:cmisra="
http://docs.oasis-open.org/ns/cmis/restatom/200908/">*

*<app:workspace>*

* <atom:title>40b1fba9-6972-49d4-a4a8-8f1c212c14ca</atom:title>*

* <app:collection href="
https://myacmsserverintance.com/alfresco/cmisatom/40b1fba9-6972-49d4-a4a8-8f1c212c14ca/children?id=workspace%3A%2F%2FSpacesStore%2F3374dfec-8117-457b-8099-cba963f3f00d
">*

Thing is that looks like that Chemistry it's doing the following request
based on the value of the href in the app:collection tag. This is it's
ignoring the parameters defined at the beginning for the base host and
using the ones comming in this tag(or maybe another).

Is this correct?

I mean is chemistry ignoring the defined parameters and using new ones
based on the responses it gets???

Cheers, Damian.




-- 
Damián. > - )

Re: CMIS session and session factory

Posted by Florian Müller <fm...@apache.org>.
Hi Damian,

OpenCMIS actually follows the URI templates in the service document.

The URL of the service document doesn't matter. That CMIS spec says this:
"How the client will get the initial AtomPub (APP) service document or the URI for the service document is repository specific.  Examples are via URI, or loading the service document from disk."


- Florian


> Hi guys,
> 
> 
> I've been playing with chemistry and I found something that I want to ask
> you about.
> 
> I have this portion of code:
> 
> 
> * List<Repository>  repositories = new ArrayList<Repository>();*
> 
> * repositories = sessionFactory.getRepositories(parameter);*
> 
> * for (Repository r : repositories) {*
> 
> *  System.out.println("Found repository: " + r.getName());*
> 
> * }*
> 
> *
> *
> 
> * // create session with the first (and only) repository*
> 
> * Repository repository = repositories.get(0);*
> 
> * parameter.put(SessionParameter.REPOSITORY_ID, repository.getId());*
> 
> * Session session = sessionFactory.createSession(parameter);*
> 
> *
> *
> 
> * System.out.println("Got a connection to repository: " +
> repository.getName() + ", with id: " + repository.getId());*
> 
> *
> *
> 
> * CmisObject object = session.getObject(
> "workspace://SpacesStore/55817c09-d027-44ee-8b4e-37f6f64395e9");*
> 
> * System.out.println("Name: " + object.getName() + " id: " +
> object.getId());*
> 
> 
> Basically it connect (using the ATOM interface) to get the repository
> information and then it tries to get another object.
> Now I've been following the code and it looks like that from the first
> request I'm doing which returns things like:
> 
> *<?xml version='1.0' encoding='UTF-8'?>*
> 
> *<app:service xmlns:app="http://www.w3.org/2007/app" xmlns:atom="
> http://www.w3.org/2005/Atom" xmlns:cmis="
> http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:cmisra="
> http://docs.oasis-open.org/ns/cmis/restatom/200908/">*
> 
> *<app:workspace>*
> 
> *<atom:title>40b1fba9-6972-49d4-a4a8-8f1c212c14ca</atom:title>*
> 
> *<app:collection href="
> https://myacmsserverintance.com/alfresco/cmisatom/40b1fba9-6972-49d4-a4a8-8f1c212c14ca/children?id=workspace%3A%2F%2FSpacesStore%2F3374dfec-8117-457b-8099-cba963f3f00d
> ">*
> 
> Thing is that looks like that Chemistry it's doing the following request
> based on the value of the href in the app:collection tag. This is it's
> ignoring the parameters defined at the beginning for the base host and
> using the ones comming in this tag(or maybe another).
> 
> Is this correct?
> 
> I mean is chemistry ignoring the defined parameters and using new ones
> based on the responses it gets???
> 
> Cheers, Damian.
> 
> 
> 
>