Return-Path: Delivered-To: apmail-incubator-chemistry-commits-archive@minotaur.apache.org Received: (qmail 91721 invoked from network); 17 Apr 2010 18:14:04 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Apr 2010 18:14:04 -0000 Received: (qmail 62946 invoked by uid 500); 17 Apr 2010 18:14:04 -0000 Delivered-To: apmail-incubator-chemistry-commits-archive@incubator.apache.org Received: (qmail 62920 invoked by uid 500); 17 Apr 2010 18:14:04 -0000 Mailing-List: contact chemistry-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: chemistry-dev@incubator.apache.org Delivered-To: mailing list chemistry-commits@incubator.apache.org Received: (qmail 62912 invoked by uid 99); 17 Apr 2010 18:14:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Apr 2010 18:14:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Apr 2010 18:13:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5CBBE23888D7; Sat, 17 Apr 2010 18:13:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r935219 [1/2] - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/s... Date: Sat, 17 Apr 2010 18:13:11 -0000 To: chemistry-commits@incubator.apache.org From: fmui@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100417181312.5CBBE23888D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fmui Date: Sat Apr 17 18:13:10 2010 New Revision: 935219 URL: http://svn.apache.org/viewvc?rev=935219&view=rev Log: more preparation for the server binding refactoring added close() to CmisBinding and CmisSpi added stub for local binding several clean ups Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/CmisLocalSpi.java Removed: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/ Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/SessionImpl.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TransientWrapper.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpi.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/WebServicesTestBindingFactory.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/CmisBinding.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/CallContext.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/PolicyService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RelationshipService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/VersioningService.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DummyCallContext.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/clientprovider/CmisInMemorySpi.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/clientprovider/DummyCallContext.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ServiceFactory.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/MultiFilingTest.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/SessionFactory.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSetup.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyDiscoverIT.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyNavigationIT.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/commander/Commander.java incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/repository/ObjGenApp.java Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java?rev=935219&view=auto ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java (added) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java Sat Apr 17 18:13:10 2010 @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.chemistry.opencmis.client.bindings; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingImpl; +import org.apache.chemistry.opencmis.commons.SessionParameter; +import org.apache.chemistry.opencmis.commons.api.CmisBinding; + +/** + * Default factory for a CMIS binding instance. + */ +public final class CmisBindingFactory { + + /** Default CMIS AtomPub binding SPI implementation */ + public static final String BINDING_SPI_ATOMPUB = "org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubSpi"; + /** Default CMIS Web Services binding SPI implementation */ + public static final String BINDING_SPI_WEBSERVICES = "org.apache.chemistry.opencmis.client.bindings.spi.webservices.CmisWebServicesSpi"; + /** Default CMIS local binding SPI implementation */ + public static final String BINDING_SPI_LOCAL = "org.apache.chemistry.opencmis.client.bindings.spi.local.CmisLocalSpi"; + /** CMIS In Memory binding SPI implementation (for testing only!) */ + public static final String BINDING_SPI_INMEMORY = "org.apache.chemistry.opencmis.inmemory.clientprovider.CmisInMemorySpiFactory"; + + /** Standard authentication provider class */ + public static final String STANDARD_AUTHENTICATION_PROVIDER = "org.apache.chemistry.opencmis.client.bindings.spi.StandardAuthenticationProvider"; + + private Map defaults; + + /** + * Private constructor -- it's a factory. + */ + private CmisBindingFactory() { + defaults = createNewDefaultParameters(); + } + + /** + * Creates a new factory instance. + */ + public static CmisBindingFactory newInstance() { + return new CmisBindingFactory(); + } + + /** + * Returns the default session parameters. + */ + public Map getDefaultSessionParameters() { + return defaults; + } + + /** + * Sets the default session parameters. + */ + public void setDefaultSessionParameters(Map sessionParameters) { + if (sessionParameters == null) { + defaults = createNewDefaultParameters(); + } else { + defaults = sessionParameters; + } + } + + /** + * Creates a CMIS binding instance. A binding class has to be provided in + * the session parameters. + */ + public CmisBinding createCmisBinding(Map sessionParameters) { + checkSessionParameters(sessionParameters, true); + + addDefaultParameters(sessionParameters); + + return new CmisBindingImpl(sessionParameters); + } + + /** + * Creates a default CMIS AtomPub binding instance. + */ + public CmisBinding createCmisAtomPubBinding(Map sessionParameters) { + checkSessionParameters(sessionParameters, false); + + sessionParameters.put(SessionParameter.BINDING_SPI_CLASS, BINDING_SPI_ATOMPUB); + if (!sessionParameters.containsKey(SessionParameter.AUTHENTICATION_PROVIDER_CLASS)) { + sessionParameters.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS, STANDARD_AUTHENTICATION_PROVIDER); + } + sessionParameters.put(SessionParameter.AUTH_HTTP_BASIC, "true"); + sessionParameters.put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, "false"); + addDefaultParameters(sessionParameters); + + check(sessionParameters, SessionParameter.ATOMPUB_URL); + + return new CmisBindingImpl(sessionParameters); + } + + /** + * Creates a default CMIS Web Services binding instance. + */ + public CmisBinding createCmisWebServicesBinding(Map sessionParameters) { + checkSessionParameters(sessionParameters, false); + + sessionParameters.put(SessionParameter.BINDING_SPI_CLASS, BINDING_SPI_WEBSERVICES); + if (!sessionParameters.containsKey(SessionParameter.AUTHENTICATION_PROVIDER_CLASS)) { + sessionParameters.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS, STANDARD_AUTHENTICATION_PROVIDER); + } + sessionParameters.put(SessionParameter.AUTH_HTTP_BASIC, "true"); + sessionParameters.put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, "true"); + addDefaultParameters(sessionParameters); + + check(sessionParameters, SessionParameter.WEBSERVICES_ACL_SERVICE); + check(sessionParameters, SessionParameter.WEBSERVICES_DISCOVERY_SERVICE); + check(sessionParameters, SessionParameter.WEBSERVICES_MULTIFILING_SERVICE); + check(sessionParameters, SessionParameter.WEBSERVICES_NAVIGATION_SERVICE); + check(sessionParameters, SessionParameter.WEBSERVICES_OBJECT_SERVICE); + check(sessionParameters, SessionParameter.WEBSERVICES_POLICY_SERVICE); + check(sessionParameters, SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE); + check(sessionParameters, SessionParameter.WEBSERVICES_REPOSITORY_SERVICE); + check(sessionParameters, SessionParameter.WEBSERVICES_VERSIONING_SERVICE); + + return new CmisBindingImpl(sessionParameters); + } + + // ---- internal ---- + + /** + * Checks the passed session parameters. + */ + private void checkSessionParameters(Map sessionParameters, boolean mustContainSPI) { + // don't accept null + if (sessionParameters == null) { + throw new IllegalArgumentException("Session parameter map not set!"); + } + + // check binding entry + String SPIClass = sessionParameters.get(SessionParameter.BINDING_SPI_CLASS); + if (mustContainSPI) { + if ((SPIClass == null) || (SPIClass.trim().length() == 0)) { + throw new IllegalArgumentException("SPI class entry (" + SessionParameter.BINDING_SPI_CLASS + + ") is missing!"); + } + } + } + + /** + * Checks if the given parameter is present. If not, throw an + * IllegalArgumentException. + */ + private void check(Map sessionParameters, String parameter) { + if (!sessionParameters.containsKey(parameter)) { + throw new IllegalArgumentException("Parameter '" + parameter + "' is missing!"); + } + } + + /** + * Add the default session parameters to the given map without override + * existing entries. + */ + private void addDefaultParameters(Map sessionParameters) { + for (String key : defaults.keySet()) { + if (!sessionParameters.containsKey(key)) { + sessionParameters.put(key, defaults.get(key)); + } + } + } + + /** + * Creates a default session parameters map with some reasonable defaults. + */ + private Map createNewDefaultParameters() { + Map result = new HashMap(); + + result.put(SessionParameter.CACHE_SIZE_REPOSITORIES, "10"); + result.put(SessionParameter.CACHE_SIZE_TYPES, "100"); + result.put(SessionParameter.CACHE_SIZE_OBJECTS, "400"); + + return result; + } +} Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java Sat Apr 17 18:13:10 2010 @@ -39,17 +39,14 @@ import org.apache.chemistry.opencmis.com /** * CMIS binding implementation. - * - * @author Florian Müller - * */ public class CmisBindingImpl implements CmisBinding { private static final long serialVersionUID = 1L; - private Session fSession; - private BindingsObjectFactory fObjectFactory; - private RepositoryService fRepositoryService; + private Session session; + private BindingsObjectFactory objectFactory; + private RepositoryService repositoryServiceWrapper; /** * Constructor. @@ -67,9 +64,9 @@ public class CmisBindingImpl implements } // initialize session - fSession = new SessionImpl(); + session = new SessionImpl(); for (Map.Entry entry : sessionParameters.entrySet()) { - fSession.put(entry.getKey(), entry.getValue()); + session.put(entry.getKey(), entry.getValue()); } // create authentication provider and add it session @@ -88,104 +85,137 @@ public class CmisBindingImpl implements "Authentication provider does not extend AbstractAuthenticationProvider!"); } - fSession.put(CmisBindingsHelper.AUTHENTICATION_PROVIDER_OBJECT, + session.put(CmisBindingsHelper.AUTHENTICATION_PROVIDER_OBJECT, (AbstractAuthenticationProvider) authProviderObj); - ((AbstractAuthenticationProvider) authProviderObj).setSession(fSession); + ((AbstractAuthenticationProvider) authProviderObj).setSession(session); } // set up caches clearAllCaches(); // initialize the SPI - CmisBindingsHelper.getSPI(fSession); + CmisBindingsHelper.getSPI(session); // set up object factory - fObjectFactory = new BindingsObjectFactoryImpl(); + objectFactory = new BindingsObjectFactoryImpl(); // set up repository service - fRepositoryService = new RepositoryServiceImpl(fSession); + repositoryServiceWrapper = new RepositoryServiceImpl(session); } public RepositoryService getRepositoryService() { - return fRepositoryService; + checkSession(); + return repositoryServiceWrapper; } public NavigationService getNavigationService() { - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + checkSession(); + CmisSpi spi = CmisBindingsHelper.getSPI(session); return spi.getNavigationService(); } public ObjectService getObjectService() { - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + checkSession(); + CmisSpi spi = CmisBindingsHelper.getSPI(session); return spi.getObjectService(); } public DiscoveryService getDiscoveryService() { - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + checkSession(); + CmisSpi spi = CmisBindingsHelper.getSPI(session); return spi.getDiscoveryService(); } public RelationshipService getRelationshipService() { - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + checkSession(); + CmisSpi spi = CmisBindingsHelper.getSPI(session); return spi.getRelationshipService(); } public VersioningService getVersioningService() { - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + checkSession(); + CmisSpi spi = CmisBindingsHelper.getSPI(session); return spi.getVersioningService(); } public AclService getAclService() { - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + checkSession(); + CmisSpi spi = CmisBindingsHelper.getSPI(session); return spi.getAclService(); } public MultiFilingService getMultiFilingService() { - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + checkSession(); + CmisSpi spi = CmisBindingsHelper.getSPI(session); return spi.getMultiFilingService(); } public PolicyService getPolicyService() { - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + checkSession(); + CmisSpi spi = CmisBindingsHelper.getSPI(session); return spi.getPolicyService(); } public BindingsObjectFactory getObjectFactory() { - return fObjectFactory; + return objectFactory; } public void clearAllCaches() { - fSession.writeLock(); + checkSession(); + + session.writeLock(); try { - fSession.put(CmisBindingsHelper.REPOSITORY_INFO_CACHE, new RepositoryInfoCache(fSession)); - fSession.put(CmisBindingsHelper.TYPE_DEFINTION_CACHE, new TypeDefinitionCache(fSession)); + session.put(CmisBindingsHelper.REPOSITORY_INFO_CACHE, new RepositoryInfoCache(session)); + session.put(CmisBindingsHelper.TYPE_DEFINTION_CACHE, new TypeDefinitionCache(session)); - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + CmisSpi spi = CmisBindingsHelper.getSPI(session); spi.clearAllCaches(); } finally { - fSession.writeUnlock(); + session.writeUnlock(); } } public void clearRepositoryCache(String repositoryId) { + checkSession(); + if (repositoryId == null) { return; } - fSession.writeLock(); + session.writeLock(); try { - RepositoryInfoCache repInfoCache = (RepositoryInfoCache) fSession + RepositoryInfoCache repInfoCache = (RepositoryInfoCache) session .get(CmisBindingsHelper.REPOSITORY_INFO_CACHE); repInfoCache.remove(repositoryId); - TypeDefinitionCache typeDefCache = (TypeDefinitionCache) fSession + TypeDefinitionCache typeDefCache = (TypeDefinitionCache) session .get(CmisBindingsHelper.TYPE_DEFINTION_CACHE); typeDefCache.remove(repositoryId); - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + CmisSpi spi = CmisBindingsHelper.getSPI(session); spi.clearRepositoryCache(repositoryId); } finally { - fSession.writeUnlock(); + session.writeUnlock(); + } + } + + public void close() { + checkSession(); + + session.writeLock(); + try { + CmisSpi spi = CmisBindingsHelper.getSPI(session); + spi.close(); + } finally { + session.writeUnlock(); + session = null; + } + + } + + private void checkSession() { + if (session == null) { + throw new IllegalStateException("Already closed."); } } } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java Sat Apr 17 18:13:10 2010 @@ -29,9 +29,6 @@ import org.apache.chemistry.opencmis.com /** * A collection of static methods that are used in multiple places within the * bindings implementation. - * - * @author Florian Müller - * */ public final class CmisBindingsHelper { Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java Sat Apr 17 18:13:10 2010 @@ -30,9 +30,6 @@ import org.apache.chemistry.opencmis.com /** * A cache for repository info objects. - * - * @author Florian Müller - * */ public class RepositoryInfoCache implements Serializable { @@ -40,7 +37,7 @@ public class RepositoryInfoCache impleme private static final int CACHE_SIZE_REPOSITORIES = 10; - private Cache fCache; + private Cache cache; /** * Constructor. @@ -54,8 +51,8 @@ public class RepositoryInfoCache impleme repCount = CACHE_SIZE_REPOSITORIES; } - fCache = new CacheImpl("Repository Info Cache"); - fCache.initialize(new String[] { MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=" + cache = new CacheImpl("Repository Info Cache"); + cache.initialize(new String[] { MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=" + repCount }); } @@ -70,7 +67,7 @@ public class RepositoryInfoCache impleme return; } - fCache.put(repositoryInfo, repositoryInfo.getId()); + cache.put(repositoryInfo, repositoryInfo.getId()); } /** @@ -82,7 +79,7 @@ public class RepositoryInfoCache impleme * not in the cache */ public RepositoryInfo get(String repositoryId) { - return (RepositoryInfo) fCache.get(repositoryId); + return (RepositoryInfo) cache.get(repositoryId); } /** @@ -92,11 +89,11 @@ public class RepositoryInfoCache impleme * the repository id */ public void remove(String repositoryId) { - fCache.remove(repositoryId); + cache.remove(repositoryId); } @Override public String toString() { - return fCache.toString(); + return cache.toString(); } } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java Sat Apr 17 18:13:10 2010 @@ -36,28 +36,25 @@ import org.apache.chemistry.opencmis.com * Repository Service implementation. * * Passes requests to the SPI and handles caching. - * - * @author Florian Müller - * */ public class RepositoryServiceImpl implements RepositoryService, Serializable { private static final long serialVersionUID = 1L; - private final Session fSession; + private final Session session; /** * Constructor. */ public RepositoryServiceImpl(Session session) { - fSession = session; + this.session = session; } public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) { RepositoryInfo result = null; boolean hasExtension = (extension != null) && (!extension.getExtensions().isEmpty()); - RepositoryInfoCache cache = CmisBindingsHelper.getRepositoryInfoCache(fSession); + RepositoryInfoCache cache = CmisBindingsHelper.getRepositoryInfoCache(session); // if extension is not set, check the cache first if (!hasExtension) { @@ -68,7 +65,7 @@ public class RepositoryServiceImpl imple } // it was not in the cache -> get the SPI and fetch the repository info - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + CmisSpi spi = CmisBindingsHelper.getSPI(session); result = spi.getRepositoryService().getRepositoryInfo(repositoryId, extension); // put it into the cache @@ -84,12 +81,12 @@ public class RepositoryServiceImpl imple boolean hasExtension = (extension != null) && (!extension.getExtensions().isEmpty()); // get the SPI and fetch the repository infos - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + CmisSpi spi = CmisBindingsHelper.getSPI(session); result = spi.getRepositoryService().getRepositoryInfos(extension); // put it into the cache if (!hasExtension && (result != null)) { - RepositoryInfoCache cache = CmisBindingsHelper.getRepositoryInfoCache(fSession); + RepositoryInfoCache cache = CmisBindingsHelper.getRepositoryInfoCache(session); for (RepositoryInfo rid : result) { cache.put(rid); } @@ -105,13 +102,13 @@ public class RepositoryServiceImpl imple boolean propDefs = (includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue()); // get the SPI and fetch the type definitions - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + CmisSpi spi = CmisBindingsHelper.getSPI(session); result = spi.getRepositoryService().getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount, extension); // put it into the cache if (!hasExtension && propDefs && (result != null)) { - TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(fSession); + TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(session); for (TypeDefinition tdd : result.getList()) { cache.put(repositoryId, tdd); @@ -125,7 +122,7 @@ public class RepositoryServiceImpl imple TypeDefinition result = null; boolean hasExtension = (extension != null) && (!extension.getExtensions().isEmpty()); - TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(fSession); + TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(session); // if extension is not set, check the cache first if (!hasExtension) { @@ -136,7 +133,7 @@ public class RepositoryServiceImpl imple } // it was not in the cache -> get the SPI and fetch the type definition - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + CmisSpi spi = CmisBindingsHelper.getSPI(session); result = spi.getRepositoryService().getTypeDefinition(repositoryId, typeId, extension); // put it into the cache @@ -154,13 +151,13 @@ public class RepositoryServiceImpl imple boolean propDefs = (includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue()); // get the SPI and fetch the type definitions - CmisSpi spi = CmisBindingsHelper.getSPI(fSession); + CmisSpi spi = CmisBindingsHelper.getSPI(session); result = spi.getRepositoryService().getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension); // put it into the cache if (!hasExtension && propDefs && (result != null)) { - TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(fSession); + TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(session); addToTypeCache(cache, repositoryId, result); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/SessionImpl.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/SessionImpl.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/SessionImpl.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/SessionImpl.java Sat Apr 17 18:13:10 2010 @@ -27,33 +27,30 @@ import org.apache.chemistry.opencmis.cli /** * CMIS binding session implementation. - * - * @author Florian Müller - * */ public class SessionImpl implements Session { private static final long serialVersionUID = 1L; - private Map fData; + private Map data; - private final ReentrantReadWriteLock fLock = new ReentrantReadWriteLock(); + private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); /** * Constructor. */ public SessionImpl() { - fData = new HashMap(); + data = new HashMap(); } public Object get(String key) { Object value = null; - fLock.readLock().lock(); + lock.readLock().lock(); try { - value = fData.get(key); + value = data.get(key); } finally { - fLock.readLock().unlock(); + lock.readLock().unlock(); } if (value instanceof TransientWrapper) { @@ -85,11 +82,11 @@ public class SessionImpl implements Sess } public void put(String key, Serializable obj) { - fLock.writeLock().lock(); + lock.writeLock().lock(); try { - fData.put(key, obj); + data.put(key, obj); } finally { - fLock.writeLock().unlock(); + lock.writeLock().unlock(); } } @@ -99,41 +96,41 @@ public class SessionImpl implements Sess throw new IllegalArgumentException("Object must be serializable!"); } - fLock.writeLock().lock(); + lock.writeLock().lock(); try { - fData.put(key, value); + data.put(key, value); } finally { - fLock.writeLock().unlock(); + lock.writeLock().unlock(); } } public void remove(String key) { - fLock.writeLock().lock(); + lock.writeLock().lock(); try { - fData.remove(key); + data.remove(key); } finally { - fLock.writeLock().unlock(); + lock.writeLock().unlock(); } } public void readLock() { - fLock.readLock().lock(); + lock.readLock().lock(); } public void readUnlock() { - fLock.readLock().unlock(); + lock.readLock().unlock(); } public void writeLock() { - fLock.writeLock().lock(); + lock.writeLock().lock(); } public void writeUnlock() { - fLock.writeLock().unlock(); + lock.writeLock().unlock(); } @Override public String toString() { - return fData.toString(); + return data.toString(); } } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TransientWrapper.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TransientWrapper.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TransientWrapper.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TransientWrapper.java Sat Apr 17 18:13:10 2010 @@ -22,25 +22,22 @@ import java.io.Serializable; /** * Wrapper for transient objects in a cache. - * - * @author Florian Müller - * */ public class TransientWrapper implements Serializable { private static final long serialVersionUID = 1L; - private transient Object fObject = null; + private transient Object object = null; public TransientWrapper(Object object) { - fObject = object; + this.object = object; } public Object getObject() { - return fObject; + return object; } @Override public String toString() { - return (fObject == null ? "(no object)" : "(transient) " + fObject.toString()); + return (object == null ? "(no object)" : "(transient) " + object.toString()); } } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.java Sat Apr 17 18:13:10 2010 @@ -30,9 +30,6 @@ import org.apache.chemistry.opencmis.com /** * A cache for type definition objects. - * - * @author Florian Müller - * */ public class TypeDefinitionCache implements Serializable { @@ -41,7 +38,7 @@ public class TypeDefinitionCache impleme private static final int CACHE_SIZE_REPOSITORIES = 10; private static final int CACHE_SIZE_TYPES = 100; - private Cache fCache; + private Cache cache; /** * Constructor. @@ -60,8 +57,8 @@ public class TypeDefinitionCache impleme typeCount = CACHE_SIZE_TYPES; } - fCache = new CacheImpl("Type Definition Cache"); - fCache.initialize(new String[] { + cache = new CacheImpl("Type Definition Cache"); + cache.initialize(new String[] { MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=" + repCount, // repository LruCacheLevelImpl.class.getName() + " " + LruCacheLevelImpl.MAX_ENTRIES + "=" + typeCount // type }); @@ -80,7 +77,7 @@ public class TypeDefinitionCache impleme return; } - fCache.put(typeDefinition, repositoryId, typeDefinition.getId()); + cache.put(typeDefinition, repositoryId, typeDefinition.getId()); } /** @@ -94,7 +91,7 @@ public class TypeDefinitionCache impleme * not in the cache */ public TypeDefinition get(String repositoryId, String typeId) { - return (TypeDefinition) fCache.get(repositoryId, typeId); + return (TypeDefinition) cache.get(repositoryId, typeId); } /** @@ -106,7 +103,7 @@ public class TypeDefinitionCache impleme * the type id */ public void remove(String repositoryId, String typeId) { - fCache.remove(repositoryId, typeId); + cache.remove(repositoryId, typeId); } /** @@ -116,11 +113,11 @@ public class TypeDefinitionCache impleme * the repository id */ public void remove(String repositoryId) { - fCache.remove(repositoryId); + cache.remove(repositoryId); } @Override public String toString() { - return fCache.toString(); + return cache.toString(); } } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpi.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpi.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpi.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpi.java Sat Apr 17 18:13:10 2010 @@ -94,4 +94,8 @@ public interface CmisSpi { */ void clearRepositoryCache(String repositoryId); + /** + * Releases all resources assigned to this SPI instance. + */ + void close(); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java Sat Apr 17 18:13:10 2010 @@ -59,13 +59,6 @@ public class CmisAtomPubSpi implements C public CmisAtomPubSpi() { } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPIFactory#getSPIInstance - * (org.apache.opencmis.client .provider .spi.Session) - */ public CmisSpi getSpiInstance(Session session) { if (log.isDebugEnabled()) { log.debug("Initializing AtomPub SPI..."); @@ -86,109 +79,46 @@ public class CmisAtomPubSpi implements C return this; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getRepositoryService() - */ public RepositoryService getRepositoryService() { return fRepositoryService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getNavigationService() - */ public NavigationService getNavigationService() { return fNavigationService; } - /* - * (non-Javadoc) - * - * @see org.apache.opencmis.client.provider.spi.CMISSPI#getObjectService() - */ public ObjectService getObjectService() { return fObjectService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getDiscoveryService() - */ public DiscoveryService getDiscoveryService() { return fDiscoveryService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getVersioningService() - */ public VersioningService getVersioningService() { return fVersioningService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getMultiFilingService() - */ public MultiFilingService getMultiFilingService() { return fMultiFilingService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getRelationshipService() - */ public RelationshipService getRelationshipService() { return fRelationshipService; } - /* - * (non-Javadoc) - * - * @see org.apache.opencmis.client.provider.spi.CMISSPI#getPolicyService() - */ public PolicyService getPolicyService() { return fPolicyService; } - /* - * (non-Javadoc) - * - * @see org.apache.opencmis.client.provider.spi.CMISSPI#getACLService() - */ public AclService getAclService() { return fACLService; } - /* - * (non-Javadoc) - * - * @see org.apache.opencmis.client.provider.spi.CMISSPI#clearAllCaches() - */ public void clearAllCaches() { fSession.remove(SpiSessionParameter.LINK_CACHE); } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#clearRepositoryCache( - * java.lang.String) - */ public void clearRepositoryCache(String repositoryId) { LinkCache linkCache = (LinkCache) fSession.get(SpiSessionParameter.LINK_CACHE); if (linkCache != null) { @@ -196,4 +126,7 @@ public class CmisAtomPubSpi implements C } } + public void close() { + // no-op for AtomPub + } } Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/CmisLocalSpi.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/CmisLocalSpi.java?rev=935219&view=auto ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/CmisLocalSpi.java (added) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/CmisLocalSpi.java Sat Apr 17 18:13:10 2010 @@ -0,0 +1,96 @@ +package org.apache.chemistry.opencmis.client.bindings.spi.local; + +import org.apache.chemistry.opencmis.client.bindings.spi.CmisSpi; +import org.apache.chemistry.opencmis.client.bindings.spi.CmisSpiFactory; +import org.apache.chemistry.opencmis.client.bindings.spi.Session; +import org.apache.chemistry.opencmis.commons.api.AclService; +import org.apache.chemistry.opencmis.commons.api.DiscoveryService; +import org.apache.chemistry.opencmis.commons.api.MultiFilingService; +import org.apache.chemistry.opencmis.commons.api.NavigationService; +import org.apache.chemistry.opencmis.commons.api.ObjectService; +import org.apache.chemistry.opencmis.commons.api.PolicyService; +import org.apache.chemistry.opencmis.commons.api.RelationshipService; +import org.apache.chemistry.opencmis.commons.api.RepositoryService; +import org.apache.chemistry.opencmis.commons.api.VersioningService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class CmisLocalSpi implements CmisSpiFactory, CmisSpi { + + private static Log log = LogFactory.getLog(CmisLocalSpi.class); + + private Session session; + + /** + * Constructor. + */ + public CmisLocalSpi() { + } + + public CmisSpi getSpiInstance(Session session) { + if (log.isDebugEnabled()) { + log.debug("Initializing local SPI..."); + } + + this.session = session; + + return this; + } + + public AclService getAclService() { + // TODO Auto-generated method stub + return null; + } + + public DiscoveryService getDiscoveryService() { + // TODO Auto-generated method stub + return null; + } + + public MultiFilingService getMultiFilingService() { + // TODO Auto-generated method stub + return null; + } + + public NavigationService getNavigationService() { + // TODO Auto-generated method stub + return null; + } + + public ObjectService getObjectService() { + // TODO Auto-generated method stub + return null; + } + + public PolicyService getPolicyService() { + // TODO Auto-generated method stub + return null; + } + + public RelationshipService getRelationshipService() { + // TODO Auto-generated method stub + return null; + } + + public RepositoryService getRepositoryService() { + // TODO Auto-generated method stub + return null; + } + + public VersioningService getVersioningService() { + // TODO Auto-generated method stub + return null; + } + + public void clearAllCaches() { + // TODO Auto-generated method stub + } + + public void clearRepositoryCache(String repositoryId) { + // TODO Auto-generated method stub + } + + public void close() { + // TODO Auto-generated method stub + } +} Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java Sat Apr 17 18:13:10 2010 @@ -90,109 +90,49 @@ public class CmisWebServicesSpi implemen return this; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getRepositoryService() - */ public RepositoryService getRepositoryService() { return fRepositoryService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getNavigationService() - */ public NavigationService getNavigationService() { return fNavigationService; } - /* - * (non-Javadoc) - * - * @see org.apache.opencmis.client.provider.spi.CMISSPI#getObjectService() - */ public ObjectService getObjectService() { return fObjectService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getDiscoveryService() - */ public DiscoveryService getDiscoveryService() { return fDiscoveryService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getVersioningService() - */ public VersioningService getVersioningService() { return fVersioningService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getMultiFilingService() - */ public MultiFilingService getMultiFilingService() { return fMultiFilingService; } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#getRelationshipService() - */ public RelationshipService getRelationshipService() { return fRelationshipService; } - /* - * (non-Javadoc) - * - * @see org.apache.opencmis.client.provider.spi.CMISSPI#getPolicyService() - */ public PolicyService getPolicyService() { return fPolicyService; } - /* - * (non-Javadoc) - * - * @see org.apache.opencmis.client.provider.spi.CMISSPI#getACLService() - */ public AclService getAclService() { return fACLService; } - /* - * (non-Javadoc) - * - * @see org.apache.opencmis.client.provider.spi.CMISSPI#clearAllCaches() - */ public void clearAllCaches() { } - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.client.provider.spi.CMISSPI#clearRepositoryCache( - * java.lang.String) - */ public void clearRepositoryCache(String repositoryId) { } + public void close() { + // no-op for Web Services + } } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java Sat Apr 17 18:13:10 2010 @@ -21,7 +21,7 @@ package org.apache.chemistry.opencmis.cl import java.util.HashMap; import java.util.Map; -import org.apache.chemistry.opencmis.client.bindings.factory.CmisBindingFactory; +import org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory; import org.apache.chemistry.opencmis.commons.SessionParameter; import org.apache.chemistry.opencmis.commons.api.CmisBinding; Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/WebServicesTestBindingFactory.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/WebServicesTestBindingFactory.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/WebServicesTestBindingFactory.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/WebServicesTestBindingFactory.java Sat Apr 17 18:13:10 2010 @@ -21,7 +21,7 @@ package org.apache.chemistry.opencmis.cl import java.util.HashMap; import java.util.Map; -import org.apache.chemistry.opencmis.client.bindings.factory.CmisBindingFactory; +import org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory; import org.apache.chemistry.opencmis.commons.SessionParameter; import org.apache.chemistry.opencmis.commons.api.CmisBinding; Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java Sat Apr 17 18:13:10 2010 @@ -601,9 +601,6 @@ public abstract class AbstractPersistent */ public Acl getAcl(boolean onlyBasicPermissions) { String objectId = getObjectId(); - - ObjectFactory of = getObjectFactory(); - return getBinding().getAclService().getAcl(getRepositoryId(), objectId, onlyBasicPermissions, null); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java Sat Apr 17 18:13:10 2010 @@ -20,7 +20,7 @@ package org.apache.chemistry.opencmis.cl import java.util.Map; -import org.apache.chemistry.opencmis.client.bindings.factory.CmisBindingFactory; +import org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory; import org.apache.chemistry.opencmis.commons.SessionParameter; import org.apache.chemistry.opencmis.commons.api.CmisBinding; import org.apache.chemistry.opencmis.commons.enums.BindingType; Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java Sat Apr 17 18:13:10 2010 @@ -539,7 +539,6 @@ public class PersistentObjectFactoryImpl * convertQueryProperties(org.apache.opencmis * .commons.provider.PropertiesData) */ - @SuppressWarnings("unchecked") public List> convertQueryProperties(Properties properties) { // check input if ((properties == null) || (properties.getProperties() == null)) { Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/CmisBinding.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/CmisBinding.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/CmisBinding.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/CmisBinding.java Sat Apr 17 18:13:10 2010 @@ -32,9 +32,6 @@ import java.io.Serializable; * accessible in this session. All CMIS operations and extension points are * provided if they are supported by the underlying binding. *

- * - * @author Florian Müller - * */ public interface CmisBinding extends Serializable { @@ -101,4 +98,9 @@ public interface CmisBinding extends Ser * the repository id */ void clearRepositoryCache(String repositoryId); + + /** + * Releases all resources assigned to this binding instance. + */ + void close(); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/CallContext.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/CallContext.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/CallContext.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/CallContext.java Sat Apr 17 18:13:10 2010 @@ -42,6 +42,11 @@ public interface CallContext { String getBinding(); /** + * Returns if true object infos can improve the performance. + */ + boolean isObjectInfoRequired(); + + /** * Returns context data by key. * * @param key Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java Sat Apr 17 18:13:10 2010 @@ -27,7 +27,6 @@ import java.math.BigInteger; import java.util.ArrayList; import java.util.EnumSet; import java.util.GregorianCalendar; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -96,11 +95,11 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery; import org.apache.chemistry.opencmis.commons.enums.CapabilityRenditions; import org.apache.chemistry.opencmis.commons.enums.Cardinality; +import org.apache.chemistry.opencmis.commons.enums.ChangeType; import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; import org.apache.chemistry.opencmis.commons.enums.DateTimeResolution; import org.apache.chemistry.opencmis.commons.enums.PropertyType; import org.apache.chemistry.opencmis.commons.enums.SupportedPermissions; -import org.apache.chemistry.opencmis.commons.enums.ChangeType; import org.apache.chemistry.opencmis.commons.enums.Updatability; import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyData; @@ -129,22 +128,22 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyIdListImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyTypeDefinitionImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl; -import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanDefinitionImpl; -import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeDefinitionImpl; -import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl; -import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlDefinitionImpl; -import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl; -import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl; -import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl; -import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriDefinitionImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.RelationshipTypeDefinitionImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.RenditionDataImpl; import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryCapabilitiesImpl; Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java Sat Apr 17 18:13:10 2010 @@ -1,7 +1,9 @@ package org.apache.chemistry.opencmis.commons.impl.server; import java.math.BigInteger; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.chemistry.opencmis.commons.PropertyIds; import org.apache.chemistry.opencmis.commons.api.Acl; @@ -31,11 +33,32 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.enums.VersioningState; import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException; import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException; +import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException; import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; public abstract class AbstractCmisService implements CmisService { - public abstract RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension); + private Map objectInfoMap; + + public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) { + RepositoryInfo result = null; + + List repositories = getRepositoryInfos(extension); + if (repositories != null) { + for (RepositoryInfo ri : repositories) { + if (ri.getId().equals(repositoryId)) { + result = ri; + break; + } + } + } + + if (result == null) { + throw new CmisObjectNotFoundException("Repository '" + repositoryId + "' does not exist!"); + } + + return result; + } public abstract List getRepositoryInfos(ExtensionsData extension); @@ -302,7 +325,17 @@ public abstract class AbstractCmisServic } public ObjectInfo getObjectInfo(String objectId) { - return null; + return objectInfoMap.get(objectId); + } + + public void addObjectInfo(ObjectInfo objectInfo) { + if (objectInfoMap == null) { + objectInfoMap = new HashMap(); + } + + if (objectInfo != null && objectInfo.getId() != null) { + objectInfoMap.put(objectInfo.getId(), objectInfo); + } } public void close() { Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java Sat Apr 17 18:13:10 2010 @@ -28,19 +28,26 @@ import org.apache.chemistry.opencmis.com */ public class CallContextImpl implements CallContext { - private String fBinding; - private Map fParameter = new HashMap(); - - public CallContextImpl(String binding) { - fBinding = binding; + private String binding; + private boolean objectInfoRequired; + private Map parameter = new HashMap(); + + public CallContextImpl(String binding, String repositoryId, boolean objectInfoRequired) { + this.binding = binding; + this.objectInfoRequired = objectInfoRequired; + put(REPOSITORY_ID, repositoryId); } public String getBinding() { - return fBinding; + return binding; + } + + public boolean isObjectInfoRequired() { + return objectInfoRequired; } public String get(String key) { - return fParameter.get(key); + return parameter.get(key); } public String getRepositoryId() { @@ -63,14 +70,14 @@ public class CallContextImpl implements * Adds a parameter. */ public void put(String key, String value) { - fParameter.put(key, value); + parameter.put(key, value); } /** * Removes a parameter. */ public String remove(String key) { - return fParameter.remove(key); + return parameter.remove(key); } } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java Sat Apr 17 18:13:10 2010 @@ -216,7 +216,14 @@ public class CmisAtomPubServlet extends * Decodes basic auth and creates a {@link CallContext} object. */ protected CallContext createContext(HttpServletRequest request) { - CallContextImpl context = new CallContextImpl(CallContext.BINDING_ATOMPUB); + String[] pathFragments = splitPath(request); + + String repositoryId = null; + if (pathFragments.length > 0) { + repositoryId = pathFragments[0]; + } + + CallContextImpl context = new CallContextImpl(CallContext.BINDING_ATOMPUB, repositoryId, true); // call call text handler if (fCallContextHandler != null) { Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java Sat Apr 17 18:13:10 2010 @@ -48,9 +48,6 @@ import org.apache.chemistry.opencmis.ser /** * This class contains operations used by all services. - * - * @author Florian Müller - * */ public abstract class AbstractService { @@ -70,8 +67,8 @@ public abstract class AbstractService { * Creates a CallContext object for the Web Service context. */ @SuppressWarnings("unchecked") - protected CallContext createContext(WebServiceContext wsContext) { - CallContextImpl context = new CallContextImpl(CallContext.BINDING_WEBSERVICES); + protected CallContext createContext(WebServiceContext wsContext, String repositoryId) { + CallContextImpl context = new CallContextImpl(CallContext.BINDING_WEBSERVICES, repositoryId, false); MessageContext mc = wsContext.getMessageContext(); Map callContextMap = (Map) mc.get(CALL_CONTEXT_MAP); Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java Sat Apr 17 18:13:10 2010 @@ -38,22 +38,19 @@ import org.apache.chemistry.opencmis.ser /** * CMIS ACL Service. - * - * @author Florian Müller - * */ @WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort") public class AclService extends AbstractService implements ACLServicePort { @Resource - WebServiceContext fContext; + WebServiceContext wsContext; public CmisACLType applyACL(String repositoryId, String objectId, CmisAccessControlListType addAces, CmisAccessControlListType removeAces, EnumACLPropagation aclPropagation, CmisExtensionType extension) throws CmisException { try { - AbstractServicesFactory factory = getServicesFactory(fContext); + AbstractServicesFactory factory = getServicesFactory(wsContext); CmisAclService service = factory.getAclService(); - CallContext context = createContext(fContext); + CallContext context = createContext(wsContext, repositoryId); Acl acl = service.applyAcl(context, repositoryId, objectId, convert(addAces, null), convert(removeAces, null), convert(AclPropagation.class, aclPropagation), convert(extension)); @@ -75,9 +72,9 @@ public class AclService extends Abstract public CmisACLType getACL(String repositoryId, String objectId, Boolean onlyBasicPermissions, CmisExtensionType extension) throws CmisException { try { - AbstractServicesFactory factory = getServicesFactory(fContext); + AbstractServicesFactory factory = getServicesFactory(wsContext); CmisAclService service = factory.getAclService(); - CallContext context = createContext(fContext); + CallContext context = createContext(wsContext, repositoryId); Acl acl = service.getAcl(context, repositoryId, objectId, onlyBasicPermissions, convert(extension)); Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java Sat Apr 17 18:13:10 2010 @@ -42,22 +42,19 @@ import org.apache.chemistry.opencmis.ser /** * CMIS Discovery Service. - * - * @author Florian Müller - * */ @WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort") public class DiscoveryService extends AbstractService implements DiscoveryServicePort { @Resource - WebServiceContext fContext; + WebServiceContext wsContext; public void getContentChanges(String repositoryId, Holder changeLogToken, Boolean includeProperties, String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, CmisExtensionType extension, Holder objects) throws CmisException { try { - AbstractServicesFactory factory = getServicesFactory(fContext); + AbstractServicesFactory factory = getServicesFactory(wsContext); CmisDiscoveryService service = factory.getDiscoveryService(); - CallContext context = createContext(fContext); + CallContext context = createContext(wsContext, repositoryId); org.apache.chemistry.opencmis.commons.api.Holder changeLogTokenHolder = convertHolder(changeLogToken); @@ -78,9 +75,9 @@ public class DiscoveryService extends Ab Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension) throws CmisException { try { - AbstractServicesFactory factory = getServicesFactory(fContext); + AbstractServicesFactory factory = getServicesFactory(wsContext); CmisDiscoveryService service = factory.getDiscoveryService(); - CallContext context = createContext(fContext); + CallContext context = createContext(wsContext, repositoryId); return convert(service.query(context, repositoryId, statement, searchAllVersions, includeAllowableActions, convert(IncludeRelationships.class, includeRelationships), renditionFilter, maxItems, skipCount, Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java?rev=935219&r1=935218&r2=935219&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java Sat Apr 17 18:13:10 2010 @@ -36,21 +36,18 @@ import org.apache.chemistry.opencmis.ser /** * CMIS MultiFiling Service. - * - * @author Florian Müller - * */ @WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.MultiFilingServicePort") public class MultiFilingService extends AbstractService implements MultiFilingServicePort { @Resource - WebServiceContext fContext; + WebServiceContext wsContext; public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions, Holder extension) throws CmisException { try { - AbstractServicesFactory factory = getServicesFactory(fContext); + AbstractServicesFactory factory = getServicesFactory(wsContext); CmisMultiFilingService service = factory.getMultiFilingService(); - CallContext context = createContext(fContext); + CallContext context = createContext(wsContext, repositoryId); ExtensionsData extData = convertExtensionHolder(extension); @@ -65,9 +62,9 @@ public class MultiFilingService extends public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, Holder extension) throws CmisException { try { - AbstractServicesFactory factory = getServicesFactory(fContext); + AbstractServicesFactory factory = getServicesFactory(wsContext); CmisMultiFilingService service = factory.getMultiFilingService(); - CallContext context = createContext(fContext); + CallContext context = createContext(wsContext, repositoryId); ExtensionsData extData = convertExtensionHolder(extension);