You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Ugo Cei <u....@sourcesense.com> on 2010/03/14 10:21:54 UTC

Client code entry point

Folks,

I am trying to write some CMIS client code (AtomPub binding only at the moment, but woudn't mind it being binding-agnostic) and can't figure out where to start. Previously, I had used the ContentManager inteface (and the APPContentManager implementation) but this seems to have gone, to be replaced by what?

At the moment, I am having success with the following code:

private static APPConnection getConnection(String serverUrl, String username, String password) {

        Map<String, Serializable> params = new HashMap<String, Serializable>();
        params.put(Repository.PARAM_USERNAME, username);
        params.put(Repository.PARAM_PASSWORD, password);
		APPRepositoryService rs = new APPRepositoryService(serverUrl, params);
        Repository repo = rs.getDefaultRepository();
        return (APPConnection) repo.getConnection(params);
}

but I'm not sure whether this is _the_ right way to initialize a connection. Any hints?

	Thanks in advance,

		Ugo

-- 
Ugo Cei
Sourcesense - making sense of Open Source: http://www.sourcesense.com


Re: Client code entry point

Posted by Stefane Fermigier <sf...@nuxeo.com>.
Hi Ugo.

I recently wrote some Clojure code that's almost identical to yours:

(defn getRootFolder [serviceUrl login password]
  (def param (HashMap. {"username" login, "password" password}))
  (def repoService (new APPRepositoryService serviceUrl param))
  (def repo (.getDefaultRepository repoService))
  (def conn (.getConnection repo param))
  (def rootFolder (.getRootFolder conn))
  rootFolder)

Note: in Clojure, you write (.methodName object param) when in Java you would have written: object.methodName(param).

  S.

On Mar 14, 2010, at 10:21 AM, Ugo Cei wrote:

> Folks,
> 
> I am trying to write some CMIS client code (AtomPub binding only at the moment, but woudn't mind it being binding-agnostic) and can't figure out where to start. Previously, I had used the ContentManager inteface (and the APPContentManager implementation) but this seems to have gone, to be replaced by what?
> 
> At the moment, I am having success with the following code:
> 
> private static APPConnection getConnection(String serverUrl, String username, String password) {
> 
>        Map<String, Serializable> params = new HashMap<String, Serializable>();
>        params.put(Repository.PARAM_USERNAME, username);
>        params.put(Repository.PARAM_PASSWORD, password);
> 		APPRepositoryService rs = new APPRepositoryService(serverUrl, params);
>        Repository repo = rs.getDefaultRepository();
>        return (APPConnection) repo.getConnection(params);
> }
> 
> but I'm not sure whether this is _the_ right way to initialize a connection. Any hints?
> 
> 	Thanks in advance,
> 
> 		Ugo
> 
> -- 
> Ugo Cei
> Sourcesense - making sense of Open Source: http://www.sourcesense.com
> 

--
Stefane Fermigier, Founder and Chairman, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
Web: http://www.nuxeo.com/ - Tel: +33 1 40 33 79 87
New: follow me on Twitter: http://twitter.com/sfermigier