Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8CCE6D4AC for ; Fri, 24 Aug 2012 21:15:51 +0000 (UTC) Received: (qmail 51248 invoked by uid 500); 24 Aug 2012 21:15:51 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 51187 invoked by uid 500); 24 Aug 2012 21:15:51 -0000 Mailing-List: contact dev-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list dev@chemistry.apache.org Received: (qmail 51176 invoked by uid 99); 24 Aug 2012 21:15:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 21:15:51 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [87.230.106.24] (HELO vwp1524.webpack.hosteurope.de) (87.230.106.24) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 21:15:41 +0000 Received: from p4fff7132.dip.t-dialin.net ([79.255.113.50] helo=laptop.local); authenticated by vwp1524.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) id 1T51Ds-0002ag-J5; Fri, 24 Aug 2012 23:15:20 +0200 Message-ID: <5037EEE7.7000604@apache.org> Date: Fri, 24 Aug 2012 23:15:19 +0200 From: =?ISO-8859-1?Q?Florian_M=FCller?= User-Agent: Postbox 3.0.4 (Macintosh/20120616) MIME-Version: 1.0 To: dev@chemistry.apache.org CC: Mark Streit Subject: Re: question about SessionParameter.REPOSITORY_ID References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;fmui@apache.org;1345842941;8bc85b41; 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 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: > > http://chemistry.apache.org/java/examples/example-create-session.html > > 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(SessionImpl.java:678) > at > org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.createSession(SessionFactoryImpl.java:90) > at > org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.createSession(SessionFactoryImpl.java:64) > > > 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. >