You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by dc...@apache.org on 2010/04/16 16:02:40 UTC

svn commit: r934881 [1/12] - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src: main/java/org/apache/chemistry/opencmis/client/bindings/cache/ main/java/org/apache/chemistry/opencmis/client/bindings...

Author: dcaruana
Date: Fri Apr 16 14:02:38 2010
New Revision: 934881

URL: http://svn.apache.org/viewvc?rev=934881&view=rev
Log:
Apply Chemistry code style.

Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/CmisBindingFactory.java
    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/AbstractAuthenticationProvider.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/CmisSpiFactory.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/Session.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.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/atompub/DiscoveryServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/MultiFilingServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/SpiSessionParameter.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAcl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAllowableActions.java
    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
    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
    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
    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
    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
    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
    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
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.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/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/DiscoveryServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SpiSessionParameter.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AclMergeTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.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/atompub/SimpleReadOnlyTests.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/SimpleReadWriteTests.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/Tools.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/misc/ConverterTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/misc/MiscTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/SimpleReadOnlyTests.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/SimpleReadWriteTests.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/WebServicesTestBindingFactory.java

Modified: 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=934881&r1=934880&r2=934881&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java Fri Apr 16 14:02:38 2010
@@ -24,14 +24,15 @@ 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/>
+ * 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/>
+ * <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>
@@ -40,59 +41,59 @@ import java.io.Serializable;
  */
 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();
+	/**
+	 * 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();
 }

Modified: 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=934881&r1=934880&r2=934881&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/CacheLevel.java Fri Apr 16 14:02:38 2010
@@ -30,38 +30,38 @@ import java.util.Map;
  */
 public interface CacheLevel extends Serializable {
 
-  /**
-   * Initialize the cache level.
-   * 
-   * @param parameters
-   *          level parameters
-   */
-  void initialize(Map<String, String> parameters);
+	/**
+	 * 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);
+	/**
+	 * 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);
+	/**
+	 * 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);
+	/**
+	 * Removes an object from this cache level.
+	 * 
+	 * @param key
+	 *            the key at this cache level
+	 */
+	void remove(String key);
 }

Modified: 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=934881&r1=934880&r2=934881&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/AbstractMapCacheLevel.java Fri Apr 16 14:02:38 2010
@@ -30,169 +30,166 @@ import org.apache.chemistry.opencmis.cli
  */
 public abstract class AbstractMapCacheLevel implements CacheLevel {
 
-  private static final long serialVersionUID = 1L;
+	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());
-  }
+	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());
+	}
 }

Modified: 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=934881&r1=934880&r2=934881&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java Fri Apr 16 14:02:38 2010
@@ -37,296 +37,285 @@ import org.apache.commons.logging.LogFac
  */
 public class CacheImpl implements Cache {
 
-  private static Log log = LogFactory.getLog(CacheImpl.class);
+	private static Log log = LogFactory.getLog(CacheImpl.class);
 
-  private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-  private List<Class<?>> fLevels;
-  private List<Map<String, String>> fLevelParameters;
+	private List<Class<?>> fLevels;
+	private List<Map<String, String>> fLevelParameters;
 
-  private String fName;
+	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);
-    }
+	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();
-  }
+		return sb.toString();
+	}
 }
\ No newline at end of file

Modified: 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=934881&r1=934880&r2=934881&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/ContentTypeCacheLevelImpl.java Fri Apr 16 14:02:38 2010
@@ -30,114 +30,111 @@ import java.util.TreeMap;
  */
 public class ContentTypeCacheLevelImpl extends MapCacheLevelImpl {
 
-  private static final long serialVersionUID = 1L;
+	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());
-      }
-    }
+	/**
+	 * 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();
-  }
+		return sb.toString();
+	}
 }

Modified: 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=934881&r1=934880&r2=934881&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/LruCacheLevelImpl.java Fri Apr 16 14:02:38 2010
@@ -29,20 +29,20 @@ import java.util.Map;
  */
 public class LruCacheLevelImpl extends AbstractMapCacheLevel {
 
-  private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-  public final static String MAX_ENTRIES = "maxEntries";
+	public final static String MAX_ENTRIES = "maxEntries";
 
-  public void initialize(Map<String, String> parameters) {
-    final int maxEntries = getIntParameter(parameters, MAX_ENTRIES, 100);
+	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;
+		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;
-      }
-    });
-  }
+			@Override
+			public boolean removeEldestEntry(Map.Entry<String, Object> eldest) {
+				return size() > maxEntries;
+			}
+		});
+	}
 }

Modified: 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=934881&r1=934880&r2=934881&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/MapCacheLevelImpl.java Fri Apr 16 14:02:38 2010
@@ -29,27 +29,27 @@ import java.util.Map;
  */
 public class MapCacheLevelImpl extends AbstractMapCacheLevel {
 
-  private static final long serialVersionUID = 1L;
+	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";
+	public final static String CAPACITY = "capacity";
+	public final static String LOAD_FACTOR = "loadFactor";
+	public final static String SINGLE_VALUE = "singleValue";
 
-  /**
-   * Constructor.
-   */
-  public MapCacheLevelImpl() {
-  }
+	/**
+	 * 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);
+	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();
-    }
-  }
+		setMap(new HashMap<String, Object>(initialCapacity, loadFactor));
+		disableKeyFallback();
+		if (singleValue) {
+			enableSingeValueFallback();
+		}
+	}
 }

Modified: 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=934881&r1=934880&r2=934881&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/CmisBindingFactory.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/factory/CmisBindingFactory.java Fri Apr 16 14:02:38 2010
@@ -33,162 +33,161 @@ import org.apache.chemistry.opencmis.com
  */
 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");
+	/** 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;
-  }
+		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=934881&r1=934880&r2=934881&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 Fri Apr 16 14:02:38 2010
@@ -45,150 +45,147 @@ import org.apache.chemistry.opencmis.com
  */
 public class CmisBindingImpl implements CmisBinding {
 
-  private static final long serialVersionUID = 1L;
+	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();
-    }
-  }
+	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();
+		}
+	}
 }

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=934881&r1=934880&r2=934881&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 Fri Apr 16 14:02:38 2010
@@ -27,100 +27,98 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 
 /**
- * A collection of static methods that are used in multiple places within the bindings
- * implementation.
+ * 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);
-  }
+	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);
+	}
 }

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=934881&r1=934880&r2=934881&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 Fri Apr 16 14:02:38 2010
@@ -36,66 +36,67 @@ import org.apache.chemistry.opencmis.com
  */
 public class RepositoryInfoCache implements Serializable {
 
-  private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-  private static final int CACHE_SIZE_REPOSITORIES = 10;
+	private static final int CACHE_SIZE_REPOSITORIES = 10;
 
-  private Cache fCache;
+	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(RepositoryInfo repositoryInfo) {
-    if ((repositoryInfo == null) || (repositoryInfo.getId() == null)) {
-      return;
-    }
-
-    fCache.put(repositoryInfo, repositoryInfo.getId());
-  }
-
-  /**
-   * 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 RepositoryInfo get(String repositoryId) {
-    return (RepositoryInfo) 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();
-  }
+	/**
+	 * 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(RepositoryInfo repositoryInfo) {
+		if ((repositoryInfo == null) || (repositoryInfo.getId() == null)) {
+			return;
+		}
+
+		fCache.put(repositoryInfo, repositoryInfo.getId());
+	}
+
+	/**
+	 * 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 RepositoryInfo get(String repositoryId) {
+		return (RepositoryInfo) 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();
+	}
 }