chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r934361 [1/9] - 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 Thu, 15 Apr 2010 10:33:51 GMT
Author: fguillaume
Date: Thu Apr 15 10:33:49 2010
New Revision: 934361

URL: http://svn.apache.org/viewvc?rev=934361&view=rev
Log:
Missing files

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/CmisBindingFactory.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/SessionImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TransientWrapper.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/AbstractAuthenticationProvider.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpi.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpiFactory.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/Session.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/MultiFilingServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/SpiSessionParameter.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/Acl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AllowableActions.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomBase.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomElement.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomEntry.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomFeed.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomLink.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/RepositoryWorkspace.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/ServiceDoc.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/DiscoveryServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SpiSessionParameter.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AclMergeTest.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/SimpleReadOnlyTests.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/SimpleReadWriteTests.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/cache/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheTest.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/Tools.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/misc/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/misc/ConverterTest.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/misc/MiscTest.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/SimpleReadOnlyTests.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/SimpleReadWriteTests.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/WebServicesTestBindingFactory.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractBindingIT.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractSimpleBindingIT.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AtomPubSimpleBindingIT.java   (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/WebServicesSimpleBindingIT.java   (with props)

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.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/cache/Cache.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,98 @@
+/*
+ * 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.cache;
+
+import java.io.Serializable;
+
+/**
+ * An interface for an hierarchical cache.
+ * 
+ * <p>
+ * Each level of the hierarchy could use a different caching strategy. The cache is initialize by
+ * defining the classes that handle the caching for one level. These classes must implement the
+ * {@link CacheLevel} interface.<br/>
+ * <br/>
+ * Level configuration string format: "
+ * <code>&lt;class name&gt; [param1=value1,param2=value2,...]</code>".<br/>
+ * For example:
+ * <code>org.apache.opencmis.client.bindings.cache.impl.MapCacheLevelImpl capacity=10</code><br/>
+ * </p>
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ * @see CacheLevel
+ */
+public interface Cache extends Serializable {
+
+  /**
+   * Initializes the cache.
+   * 
+   * @param cacheLevelConfig
+   *          the level configuration strings from the root to the leafs
+   */
+  void initialize(String[] cacheLevelConfig);
+
+  /**
+   * Adds an object to the cache.
+   * 
+   * @param value
+   *          the object
+   * @param keys
+   *          the keys for this object
+   */
+  void put(Object value, String... keys);
+
+  /**
+   * Retrieves an object from the cache.
+   * 
+   * @param keys
+   *          the keys
+   * @return the object or <code>null<code> if the branch or leaf doesn't exist
+   */
+  Object get(String... keys);
+
+  /**
+   * Removes a branch or leaf from the cache.
+   * 
+   * @param keys
+   *          the keys of the branch or leaf
+   */
+  void remove(String... keys);
+
+  /**
+   * Checks if a given key is in the cache.
+   * 
+   * @param keys
+   *          the keys of the branch or leaf
+   * 
+   * @return the index of the first key part that is not in the cache or <code>keys.length</code> if
+   *         the object is in the cache
+   */
+  int check(String... keys);
+
+  /**
+   * Applies a write lock.
+   */
+  void writeLock();
+
+  /**
+   * Releases a write lock.
+   */
+  void writeUnlock();
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.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/cache/CacheLevel.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,67 @@
+/*
+ * 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.cache;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * Interface for a level of an hierarchical cache.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ * @see Cache
+ */
+public interface CacheLevel extends Serializable {
+
+  /**
+   * Initialize the cache level.
+   * 
+   * @param parameters
+   *          level parameters
+   */
+  void initialize(Map<String, String> parameters);
+
+  /**
+   * Adds an object to the cache level.
+   * 
+   * @param value
+   *          the object
+   * @param key
+   *          the key at this level
+   */
+  void put(Object value, String key);
+
+  /**
+   * Retrieves an object from the cache level.
+   * 
+   * @param key
+   *          the key at this cache level
+   * @return the object or <code>null</code> if the object doesn't exist
+   */
+  Object get(String key);
+
+  /**
+   * Removes an object from this cache level.
+   * 
+   * @param key
+   *          the key at this cache level
+   */
+  void remove(String key);
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.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/cache/impl/AbstractMapCacheLevel.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,198 @@
+/*
+ * 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.cache.impl;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.bindings.cache.CacheLevel;
+
+/**
+ * Abstract Map cache.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public abstract class AbstractMapCacheLevel implements CacheLevel {
+
+  private static final long serialVersionUID = 1L;
+
+  private Map<String, Object> fMap;
+  private boolean fFallbackEnabled = false;
+  private String fFallbackKey = null;
+  private boolean fSingleValueEnabled = false;
+
+  public abstract void initialize(Map<String, String> parameters);
+
+  public Object get(String key) {
+    Object value = fMap.get(key);
+
+    if ((value == null) && fFallbackEnabled) {
+      value = fMap.get(fFallbackKey);
+    }
+
+    if ((value == null) && fSingleValueEnabled) {
+      if (fMap.size() == 1) {
+        value = fMap.values().iterator().next();
+      }
+    }
+
+    return value;
+  }
+
+  public void put(Object value, String key) {
+    fMap.put(key, value);
+  }
+
+  public void remove(String key) {
+    fMap.remove(key);
+  }
+
+  /**
+   * Returns the internal map.
+   */
+  protected Map<String, Object> getMap() {
+    return fMap;
+  }
+
+  /**
+   * Sets the internal map.
+   */
+  protected void setMap(Map<String, Object> map) {
+    fMap = map;
+  }
+
+  /**
+   * Enables a fallback key if no value was found for a requested key.
+   */
+  protected void enableKeyFallback(String key) {
+    fFallbackKey = key;
+    fFallbackEnabled = true;
+  }
+
+  /**
+   * Disables the fallback key.
+   */
+  protected void disableKeyFallback() {
+    fFallbackEnabled = false;
+  }
+
+  /**
+   * Enables the single value fallback.
+   */
+  protected void enableSingeValueFallback() {
+    fSingleValueEnabled = true;
+  }
+
+  /**
+   * Disables the single value fallback.
+   */
+  protected void disableSingeValueFallback() {
+    fSingleValueEnabled = false;
+  }
+
+  /**
+   * Extracts an integer parameter from the parameters.
+   * 
+   * @param parameters
+   *          the parameter map
+   * @param name
+   *          the parameter name
+   * @param defValue
+   *          the default value if the parameter can't be found
+   */
+  protected int getIntParameter(Map<String, String> parameters, String name, int defValue) {
+    if (parameters == null) {
+      return defValue;
+    }
+
+    String value = parameters.get(name);
+    if ((value == null) || (value.trim().length() == 0)) {
+      return defValue;
+    }
+
+    try {
+      return Integer.valueOf(value);
+    }
+    catch (NumberFormatException e) {
+      return defValue;
+    }
+  }
+
+  /**
+   * Extracts a float parameter from the parameters.
+   * 
+   * @param parameters
+   *          the parameter map
+   * @param name
+   *          the parameter name
+   * @param defValue
+   *          the default value if the parameter can't be found
+   */
+  protected float getFloatParameter(Map<String, String> parameters, String name, float defValue) {
+    if (parameters == null) {
+      return defValue;
+    }
+
+    String value = parameters.get(name);
+    if ((value == null) || (value.trim().length() == 0)) {
+      return defValue;
+    }
+
+    try {
+      return Float.valueOf(value);
+    }
+    catch (NumberFormatException e) {
+      return defValue;
+    }
+  }
+
+  /**
+   * Extracts a boolean parameter from the parameters.
+   * 
+   * @param parameters
+   *          the parameter map
+   * @param name
+   *          the parameter name
+   * @param defValue
+   *          the default value if the parameter can't be found
+   */
+  protected boolean getBooleanParameter(Map<String, String> parameters, String name,
+      boolean defValue) {
+    if (parameters == null) {
+      return defValue;
+    }
+
+    String value = parameters.get(name);
+    if ((value == null) || (value.trim().length() == 0)) {
+      return defValue;
+    }
+
+    return Boolean.parseBoolean(value);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see java.lang.Object#toString()
+   */
+  @Override
+  public String toString() {
+    return (fMap == null ? "[no map]" : fMap.toString());
+  }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.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/cache/impl/CacheImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,332 @@
+/*
+ * 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.cache.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.chemistry.opencmis.client.bindings.cache.Cache;
+import org.apache.chemistry.opencmis.client.bindings.cache.CacheLevel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Default cache implementation.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class CacheImpl implements Cache {
+
+  private static Log log = LogFactory.getLog(CacheImpl.class);
+
+  private static final long serialVersionUID = 1L;
+
+  private List<Class<?>> fLevels;
+  private List<Map<String, String>> fLevelParameters;
+
+  private String fName;
+
+  private CacheLevel fRoot;
+
+  private final ReentrantReadWriteLock fLock = new ReentrantReadWriteLock();
+
+  /**
+   * Constructor.
+   */
+  public CacheImpl() {
+    fName = "Cache";
+  }
+
+  /**
+   * Constructor.
+   */
+  public CacheImpl(String name) {
+    fName = name;
+  }
+
+  public void initialize(String[] cacheLevelConfig) {
+    if (fLevels != null) {
+      throw new IllegalStateException("Cache already initialize!");
+    }
+
+    if ((cacheLevelConfig == null) || (cacheLevelConfig.length == 0)) {
+      throw new IllegalArgumentException("Cache config must not be empty!");
+    }
+
+    fLock.writeLock().lock();
+    try {
+      fLevels = new ArrayList<Class<?>>();
+      fLevelParameters = new ArrayList<Map<String, String>>();
+
+      // build level lists
+      for (String config : cacheLevelConfig) {
+        int x = config.indexOf(' ');
+        if (x == -1) {
+          addLevel(config, null);
+        }
+        else {
+          addLevel(config.substring(0, x), config.substring(x + 1));
+        }
+      }
+
+      // create root
+      fRoot = createCacheLevel(0);
+    }
+    finally {
+      fLock.writeLock().unlock();
+    }
+  }
+
+  private void addLevel(String className, String parameters) {
+    // get the class
+    Class<?> clazz;
+    try {
+      clazz = Class.forName(className);
+    }
+    catch (ClassNotFoundException e) {
+      throw new IllegalArgumentException("Class '" + className + "' not found!", e);
+    }
+
+    // check the class
+    if (!CacheLevel.class.isAssignableFrom(clazz)) {
+      throw new IllegalArgumentException("Class '" + className
+          + "' does not implement the CacheLevel interface!");
+    }
+
+    fLevels.add(clazz);
+
+    // process parameters
+    if (parameters == null) {
+      fLevelParameters.add(null);
+    }
+    else {
+      Map<String, String> parameterMap = new HashMap<String, String>();
+      fLevelParameters.add(parameterMap);
+
+      for (String pair : parameters.split(",")) {
+        String[] keyValue = pair.split("=");
+        if (keyValue.length == 1) {
+          parameterMap.put(keyValue[0], "");
+        }
+        else {
+          parameterMap.put(keyValue[0], keyValue[1]);
+        }
+      }
+    }
+  }
+
+  public Object get(String... keys) {
+    // check keys
+    if (keys == null) {
+      return null;
+    }
+
+    // check level depth
+    if (fLevels.size() != keys.length) {
+      throw new IllegalArgumentException("Wrong number of keys!");
+    }
+
+    Object result = null;
+
+    fLock.readLock().lock();
+    try {
+      CacheLevel cacheLevel = fRoot;
+
+      // follow the branch
+      for (int i = 0; i < keys.length - 1; i++) {
+        Object level = cacheLevel.get(keys[i]);
+
+        // does the branch exist?
+        if (level == null) {
+          return null;
+        }
+
+        // next level
+        cacheLevel = (CacheLevel) level;
+      }
+
+      // get the value
+      result = cacheLevel.get(keys[keys.length - 1]);
+    }
+    finally {
+      fLock.readLock().unlock();
+    }
+
+    return result;
+  }
+
+  public void put(Object value, String... keys) {
+    // check keys
+    if (keys == null) {
+      return;
+    }
+
+    // check level depth
+    if (fLevels.size() != keys.length) {
+      throw new IllegalArgumentException("Wrong number of keys!");
+    }
+
+    fLock.writeLock().lock();
+    try {
+      CacheLevel cacheLevel = fRoot;
+
+      // follow the branch
+      for (int i = 0; i < keys.length - 1; i++) {
+        Object level = cacheLevel.get(keys[i]);
+
+        // does the branch exist?
+        if (level == null) {
+          level = createCacheLevel(i + 1);
+          cacheLevel.put(level, keys[i]);
+        }
+
+        // next level
+        cacheLevel = (CacheLevel) level;
+      }
+
+      cacheLevel.put(value, keys[keys.length - 1]);
+
+      if (log.isDebugEnabled()) {
+        log.debug(fName + ": put [" + getFormattedKeys(keys) + "] = " + value);
+      }
+    }
+    finally {
+      fLock.writeLock().unlock();
+    }
+  }
+
+  public void remove(String... keys) {
+    if (keys == null) {
+      return;
+    }
+
+    fLock.writeLock().lock();
+    try {
+      CacheLevel cacheLevel = fRoot;
+
+      // follow the branch
+      for (int i = 0; i < keys.length - 1; i++) {
+        Object level = cacheLevel.get(keys[i]);
+
+        // does the branch exist?
+        if (level == null) {
+          return;
+        }
+
+        // next level
+        cacheLevel = (CacheLevel) level;
+      }
+
+      cacheLevel.remove(keys[keys.length - 1]);
+
+      if (log.isDebugEnabled()) {
+        log.debug(fName + ": removed [" + getFormattedKeys(keys) + "]");
+      }
+    }
+    finally {
+      fLock.writeLock().unlock();
+    }
+  }
+
+  public int check(String... keys) {
+    if (keys == null) {
+      return -1;
+    }
+
+    fLock.readLock().lock();
+    try {
+      CacheLevel cacheLevel = fRoot;
+
+      // follow the branch
+      for (int i = 0; i < keys.length - 1; i++) {
+        Object level = cacheLevel.get(keys[i]);
+
+        // does the branch exist?
+        if (level == null) {
+          return i;
+        }
+
+        // next level
+        cacheLevel = (CacheLevel) level;
+      }
+    }
+    finally {
+      fLock.readLock().unlock();
+    }
+
+    return keys.length;
+  }
+
+  public void writeLock() {
+    fLock.writeLock().lock();
+  }
+
+  public void writeUnlock() {
+    fLock.writeLock().unlock();
+  }
+
+  // ---- internal ----
+
+  /**
+   * Creates a cache level object.
+   */
+  private CacheLevel createCacheLevel(int level) {
+    if ((level < 0) || (level >= fLevels.size())) {
+      throw new IllegalArgumentException("Cache level doesn't fit the configuration!");
+    }
+
+    // get the class and create an instance
+    Class<?> clazz = fLevels.get(level);
+    CacheLevel cacheLevel = null;
+    try {
+      cacheLevel = (CacheLevel) clazz.newInstance();
+    }
+    catch (Exception e) {
+      throw new IllegalArgumentException("Cache level problem?!", e);
+    }
+
+    // initialize it
+    cacheLevel.initialize(fLevelParameters.get(level));
+
+    return cacheLevel;
+  }
+
+  @Override
+  public String toString() {
+    return (fRoot == null ? "(no cache root)" : fRoot.toString());
+  }
+
+  // ---- internal ----
+
+  private String getFormattedKeys(String[] keys) {
+    StringBuilder sb = new StringBuilder();
+    for (String k : keys) {
+      if (sb.length() > 0) {
+        sb.append(", ");
+      }
+      sb.append(k);
+    }
+
+    return sb.toString();
+  }
+}
\ No newline at end of file

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.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/cache/impl/ContentTypeCacheLevelImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,143 @@
+/*
+ * 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.cache.impl;
+
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * Content type cache.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class ContentTypeCacheLevelImpl extends MapCacheLevelImpl {
+
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Constructor.
+   */
+  public ContentTypeCacheLevelImpl() {
+    enableKeyFallback(null);
+  }
+
+  @Override
+  public Object get(String key) {
+    return super.get(normalize(key));
+  }
+
+  @Override
+  public void put(Object value, String key) {
+    super.put(value, normalize(key));
+  }
+
+  @Override
+  public void remove(String key) {
+    super.remove(normalize(key));
+  }
+
+  /**
+   * Normalizes the key which should be a content type. It's quite simple at the moment but should
+   * cover most cases.
+   */
+  private String normalize(String key) {
+    if (key == null) {
+      return null;
+    }
+
+    StringBuilder sb = new StringBuilder();
+    int parameterStart = 0;
+
+    // first, get the MIME type
+    for (int i = 0; i < key.length(); i++) {
+      char c = key.charAt(i);
+
+      if (Character.isWhitespace(c)) {
+        continue;
+      }
+      else if (c == ';') {
+        parameterStart = i;
+        break;
+      }
+
+      sb.append(Character.toLowerCase(c));
+    }
+
+    // if parameters have been found, gather them
+    if (parameterStart > 0) {
+      SortedMap<String, String> parameter = new TreeMap<String, String>();
+      StringBuilder ksb = new StringBuilder();
+      StringBuilder vsb = new StringBuilder();
+      boolean isKey = true;
+
+      for (int i = parameterStart + 1; i < key.length(); i++) {
+        char c = key.charAt(i);
+        if (Character.isWhitespace(c)) {
+          continue;
+        }
+
+        if (isKey) {
+          if (c == '=') {
+            // value start
+            isKey = false;
+            continue;
+          }
+
+          ksb.append(Character.toLowerCase(c));
+        }
+        else {
+          if (c == ';') {
+            // next key
+            isKey = true;
+
+            parameter.put(ksb.toString(), vsb.toString());
+
+            ksb = new StringBuilder();
+            vsb = new StringBuilder();
+
+            continue;
+          }
+          else if (c == '"') {
+            // filter quotes
+            continue;
+          }
+
+          vsb.append(Character.toLowerCase(c));
+        }
+      }
+
+      // add last parameter
+      if (ksb.length() > 0) {
+        parameter.put(ksb.toString(), vsb.toString());
+      }
+
+      // write parameters sorted by key
+      for (Map.Entry<String, String> entry : parameter.entrySet()) {
+        sb.append(";");
+        sb.append(entry.getKey());
+        sb.append("=");
+        sb.append(entry.getValue());
+      }
+    }
+
+    return sb.toString();
+  }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.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/cache/impl/LruCacheLevelImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,48 @@
+/*
+ * 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.cache.impl;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * LRU cache.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class LruCacheLevelImpl extends AbstractMapCacheLevel {
+
+  private static final long serialVersionUID = 1L;
+
+  public final static String MAX_ENTRIES = "maxEntries";
+
+  public void initialize(Map<String, String> parameters) {
+    final int maxEntries = getIntParameter(parameters, MAX_ENTRIES, 100);
+
+    setMap(new LinkedHashMap<String, Object>(maxEntries + 1, 0.70f, true) {
+      private static final long serialVersionUID = 1L;
+
+      @Override
+      public boolean removeEldestEntry(Map.Entry<String, Object> eldest) {
+        return size() > maxEntries;
+      }
+    });
+  }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.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/cache/impl/MapCacheLevelImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,55 @@
+/*
+ * 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.cache.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Map cache.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class MapCacheLevelImpl extends AbstractMapCacheLevel {
+
+  private static final long serialVersionUID = 1L;
+
+  public final static String CAPACITY = "capacity";
+  public final static String LOAD_FACTOR = "loadFactor";
+  public final static String SINGLE_VALUE = "singleValue";
+
+  /**
+   * Constructor.
+   */
+  public MapCacheLevelImpl() {
+  }
+
+  public void initialize(Map<String, String> parameters) {
+    int initialCapacity = getIntParameter(parameters, CAPACITY, 32);
+    float loadFactor = getFloatParameter(parameters, LOAD_FACTOR, 0.75f);
+    boolean singleValue = getBooleanParameter(parameters, SINGLE_VALUE, false);
+
+    setMap(new HashMap<String, Object>(initialCapacity, loadFactor));
+    disableKeyFallback();
+    if (singleValue) {
+      enableSingeValueFallback();
+    }
+  }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/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/factory/CmisBindingFactory.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/CmisBindingFactory.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/CmisBindingFactory.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,194 @@
+/*
+ * 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.factory;
+
+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.provider.CmisBinding;
+
+/**
+ * Default factory for a CMIS binding instance.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+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";
+  /** 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<String, String> fDefaults;
+
+  /**
+   * Private constructor -- it's a factory.
+   */
+  private CmisBindingFactory() {
+    fDefaults = createNewDefaultParameters();
+  }
+
+  /**
+   * Creates a new factory instance.
+   */
+  public static CmisBindingFactory newInstance() {
+    return new CmisBindingFactory();
+  }
+
+  /**
+   * Returns the default session parameters.
+   */
+  public Map<String, String> getDefaultSessionParameters() {
+    return fDefaults;
+  }
+
+  /**
+   * Sets the default session parameters.
+   */
+  public void setDefaultSessionParameters(Map<String, String> sessionParameters) {
+    if (sessionParameters == null) {
+      fDefaults = createNewDefaultParameters();
+    }
+    else {
+      fDefaults = sessionParameters;
+    }
+  }
+
+  /**
+   * Creates a CMIS binding instance. A binding class has to be provided in the session parameters.
+   */
+  public CmisBinding createCmisBinding(Map<String, String> sessionParameters) {
+    checkSessionParameters(sessionParameters, true);
+
+    addDefaultParameters(sessionParameters);
+
+    return new CmisBindingImpl(sessionParameters);
+  }
+
+  /**
+   * Creates a default CMIS AtomPub binding instance.
+   */
+  public CmisBinding createCmisAtomPubBinding(Map<String, String> 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<String, String> 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<String, String> 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
+   * <code>IllegalArgumentException</code>.
+   */
+  private void check(Map<String, String> 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<String, String> sessionParameters) {
+    for (String key : fDefaults.keySet()) {
+      if (!sessionParameters.containsKey(key)) {
+        sessionParameters.put(key, fDefaults.get(key));
+      }
+    }
+  }
+
+  /**
+   * Creates a default session parameters map with some reasonable defaults.
+   */
+  private Map<String, String> createNewDefaultParameters() {
+    Map<String, String> result = new HashMap<String, String>();
+
+    result.put(SessionParameter.CACHE_SIZE_REPOSITORIES, "10");
+    result.put(SessionParameter.CACHE_SIZE_TYPES, "100");
+    result.put(SessionParameter.CACHE_SIZE_OBJECTS, "400");
+
+    return result;
+  }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/CmisBindingFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/CmisBindingFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/CmisBindingFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 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=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,194 @@
+/*
+ * 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.impl;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider;
+import org.apache.chemistry.opencmis.client.bindings.spi.CmisSpi;
+import org.apache.chemistry.opencmis.client.bindings.spi.Session;
+import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
+import org.apache.chemistry.opencmis.commons.provider.AclService;
+import org.apache.chemistry.opencmis.commons.provider.BindingsObjectFactory;
+import org.apache.chemistry.opencmis.commons.provider.CmisBinding;
+import org.apache.chemistry.opencmis.commons.provider.DiscoveryService;
+import org.apache.chemistry.opencmis.commons.provider.MultiFilingService;
+import org.apache.chemistry.opencmis.commons.provider.NavigationService;
+import org.apache.chemistry.opencmis.commons.provider.ObjectService;
+import org.apache.chemistry.opencmis.commons.provider.PolicyService;
+import org.apache.chemistry.opencmis.commons.provider.RelationshipService;
+import org.apache.chemistry.opencmis.commons.provider.RepositoryService;
+import org.apache.chemistry.opencmis.commons.provider.VersioningService;
+
+/**
+ * CMIS binding implementation.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class CmisBindingImpl implements CmisBinding {
+
+  private static final long serialVersionUID = 1L;
+
+  private Session fSession;
+  private BindingsObjectFactory fObjectFactory;
+  private RepositoryService fRepositoryService;
+
+  /**
+   * Constructor.
+   * 
+   * @param sessionParameters
+   *          the session parameters
+   */
+  public CmisBindingImpl(Map<String, String> sessionParameters) {
+    // some checks first
+    if (sessionParameters == null) {
+      throw new IllegalArgumentException("Session parameters must be set!");
+    }
+    if (!sessionParameters.containsKey(SessionParameter.BINDING_SPI_CLASS)) {
+      throw new IllegalArgumentException("Session parameters do not contain a SPI class name!");
+    }
+
+    // initialize session
+    fSession = new SessionImpl();
+    for (Map.Entry<String, String> entry : sessionParameters.entrySet()) {
+      fSession.put(entry.getKey(), entry.getValue());
+    }
+
+    // create authentication provider and add it session
+    String authProvider = sessionParameters.get(SessionParameter.AUTHENTICATION_PROVIDER_CLASS);
+    if (authProvider != null) {
+      Object authProviderObj = null;
+
+      try {
+        authProviderObj = Class.forName(authProvider).newInstance();
+      }
+      catch (Exception e) {
+        throw new IllegalArgumentException("Could not load authentication provider: " + e, e);
+      }
+
+      if (!(authProviderObj instanceof AbstractAuthenticationProvider)) {
+        throw new IllegalArgumentException(
+            "Authentication provider does not extend AbstractAuthenticationProvider!");
+      }
+
+      fSession.put(CmisBindingsHelper.AUTHENTICATION_PROVIDER_OBJECT,
+          (AbstractAuthenticationProvider) authProviderObj);
+      ((AbstractAuthenticationProvider) authProviderObj).setSession(fSession);
+    }
+
+    // set up caches
+    clearAllCaches();
+
+    // initialize the SPI
+    CmisBindingsHelper.getSPI(fSession);
+
+    // set up object factory
+    fObjectFactory = new BindingsObjectFactoryImpl();
+
+    // set up repository service
+    fRepositoryService = new RepositoryServiceImpl(fSession);
+  }
+
+  public RepositoryService getRepositoryService() {
+    return fRepositoryService;
+  }
+
+  public NavigationService getNavigationService() {
+    CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+    return spi.getNavigationService();
+  }
+
+  public ObjectService getObjectService() {
+    CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+    return spi.getObjectService();
+  }
+
+  public DiscoveryService getDiscoveryService() {
+    CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+    return spi.getDiscoveryService();
+  }
+
+  public RelationshipService getRelationshipService() {
+    CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+    return spi.getRelationshipService();
+  }
+
+  public VersioningService getVersioningService() {
+    CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+    return spi.getVersioningService();
+  }
+
+  public AclService getAclService() {
+    CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+    return spi.getAclService();
+  }
+
+  public MultiFilingService getMultiFilingService() {
+    CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+    return spi.getMultiFilingService();
+  }
+
+  public PolicyService getPolicyService() {
+    CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+    return spi.getPolicyService();
+  }
+
+  public BindingsObjectFactory getObjectFactory() {
+    return fObjectFactory;
+  }
+
+  public void clearAllCaches() {
+    fSession.writeLock();
+    try {
+      fSession.put(CmisBindingsHelper.REPOSITORY_INFO_CACHE, new RepositoryInfoCache(fSession));
+      fSession.put(CmisBindingsHelper.TYPE_DEFINTION_CACHE, new TypeDefinitionCache(fSession));
+
+      CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+      spi.clearAllCaches();
+    }
+    finally {
+      fSession.writeUnlock();
+    }
+  }
+
+  public void clearRepositoryCache(String repositoryId) {
+    if (repositoryId == null) {
+      return;
+    }
+
+    fSession.writeLock();
+    try {
+      RepositoryInfoCache repInfoCache = (RepositoryInfoCache) fSession
+          .get(CmisBindingsHelper.REPOSITORY_INFO_CACHE);
+      repInfoCache.remove(repositoryId);
+
+      TypeDefinitionCache typeDefCache = (TypeDefinitionCache) fSession
+          .get(CmisBindingsHelper.TYPE_DEFINTION_CACHE);
+      typeDefCache.remove(repositoryId);
+
+      CmisSpi spi = CmisBindingsHelper.getSPI(fSession);
+      spi.clearRepositoryCache(repositoryId);
+    }
+    finally {
+      fSession.writeUnlock();
+    }
+  }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 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=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,126 @@
+/*
+ * 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.impl;
+
+import org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider;
+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.SessionParameter;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+
+/**
+ * A collection of static methods that are used in multiple places within the bindings
+ * implementation.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public final class CmisBindingsHelper {
+
+  public static final String REPOSITORY_INFO_CACHE = "org.apache.chemistry.opencmis.bindings.repositoryInfoCache";
+  public static final String TYPE_DEFINTION_CACHE = "org.apache.chemistry.opencmis.bindings.typeDefintionCache";
+  public static final String SPI_OBJECT = "org.apache.chemistry.opencmis.bindings.spi.object";
+  public static final String AUTHENTICATION_PROVIDER_OBJECT = "org.apache.chemistry.opencmis.bindings.auth.object";
+
+  /**
+   * Private constructor.
+   */
+  private CmisBindingsHelper() {
+  }
+
+  /**
+   * Gets the SPI object for the given session. If there is already a SPI object in the session it
+   * will be returned. If there is no SPI object it will be created and put into the session.
+   * 
+   * @param session
+   *          the session object
+   * 
+   * @return the SPI object
+   */
+  public static CmisSpi getSPI(Session session) {
+    // fetch from session
+    CmisSpi spi = (CmisSpi) session.get(SPI_OBJECT);
+    if (spi != null) {
+      return spi;
+    }
+
+    session.writeLock();
+    try {
+      // try again
+      spi = (CmisSpi) session.get(SPI_OBJECT);
+      if (spi != null) {
+        return spi;
+      }
+
+      // ok, we have to create it...
+      try {
+        String spiFactoryName = (String) session.get(SessionParameter.BINDING_SPI_CLASS);
+        Class<?> spiFactoryClass = Class.forName(spiFactoryName);
+        Object spiFactory = spiFactoryClass.newInstance();
+
+        if (!(spiFactory instanceof CmisSpiFactory)) {
+          throw new CmisRuntimeException("Not a CMISSPIFactory class!");
+        }
+
+        spi = ((CmisSpiFactory) spiFactory).getSpiInstance(session);
+        if (spi == null) {
+          throw new CmisRuntimeException("SPI factory returned null!");
+        }
+      }
+      catch (CmisBaseException e) {
+        throw e;
+      }
+      catch (Exception e) {
+        throw new CmisRuntimeException("SPI cannot be initialized: " + e.getMessage(), e);
+      }
+
+      // we have a SPI object -> put it into the session
+      session.put(SPI_OBJECT, spi, true);
+    }
+    finally {
+      session.writeUnlock();
+    }
+
+    return spi;
+  }
+
+  /**
+   * Returns the authentication provider from the session or <code>null</code> if no authentication
+   * provider is set.
+   */
+  public static AbstractAuthenticationProvider getAuthenticationProvider(Session session) {
+    return (AbstractAuthenticationProvider) session.get(AUTHENTICATION_PROVIDER_OBJECT);
+  }
+
+  /**
+   * Returns the repository info cache from the session.
+   */
+  public static RepositoryInfoCache getRepositoryInfoCache(Session session) {
+    return (RepositoryInfoCache) session.get(REPOSITORY_INFO_CACHE);
+  }
+
+  /**
+   * Returns the type definition cache from the session.
+   */
+  public static TypeDefinitionCache getTypeDefinitionCache(Session session) {
+    return (TypeDefinitionCache) session.get(TYPE_DEFINTION_CACHE);
+  }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 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=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,101 @@
+/*
+ * 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.impl;
+
+import java.io.Serializable;
+
+import org.apache.chemistry.opencmis.client.bindings.cache.Cache;
+import org.apache.chemistry.opencmis.client.bindings.cache.impl.CacheImpl;
+import org.apache.chemistry.opencmis.client.bindings.cache.impl.MapCacheLevelImpl;
+import org.apache.chemistry.opencmis.client.bindings.spi.Session;
+import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.provider.RepositoryInfoData;
+
+/**
+ * A cache for repository info objects.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class RepositoryInfoCache implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final int CACHE_SIZE_REPOSITORIES = 10;
+
+  private Cache fCache;
+
+  /**
+   * Constructor.
+   * 
+   * @param session
+   *          the session object
+   */
+  public RepositoryInfoCache(Session session) {
+    int repCount = session.get(SessionParameter.CACHE_SIZE_REPOSITORIES, CACHE_SIZE_REPOSITORIES);
+    if (repCount < 1) {
+      repCount = CACHE_SIZE_REPOSITORIES;
+    }
+
+    fCache = new CacheImpl("Repository Info Cache");
+    fCache.initialize(new String[] { MapCacheLevelImpl.class.getName() + " "
+        + MapCacheLevelImpl.CAPACITY + "=" + repCount });
+  }
+
+  /**
+   * Adds a repository info object to the cache.
+   * 
+   * @param repositoryInfo
+   *          the repository info object
+   */
+  public void put(RepositoryInfoData repositoryInfo) {
+    if ((repositoryInfo == null) || (repositoryInfo.getRepositoryId() == null)) {
+      return;
+    }
+
+    fCache.put(repositoryInfo, repositoryInfo.getRepositoryId());
+  }
+
+  /**
+   * Retrieves a repository info object from the cache.
+   * 
+   * @param repositoryId
+   *          the repository id
+   * @return the repository info object or <code>null</code> if the object is not in the cache
+   */
+  public RepositoryInfoData get(String repositoryId) {
+    return (RepositoryInfoData) fCache.get(repositoryId);
+  }
+
+  /**
+   * Removes a repository info object from the cache.
+   * 
+   * @param repositoryId
+   *          the repository id
+   */
+  public void remove(String repositoryId) {
+    fCache.remove(repositoryId);
+  }
+
+  @Override
+  public String toString() {
+    return fCache.toString();
+  }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message