You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2012/05/14 09:52:43 UTC
svn commit: r1338045 - in /chemistry/opencmis/trunk: ./
chemistry-opencmis-bridge/
chemistry-opencmis-bridge/chemistry-opencmis-bridge/
chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/
chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/mai...
Author: fmui
Date: Mon May 14 07:52:42 2012
New Revision: 1338045
URL: http://svn.apache.org/viewvc?rev=1338045&view=rev
Log:
Initial CMIS bridge code
Added:
chemistry/opencmis/trunk/chemistry-opencmis-bridge/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/pom.xml (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/CachedBindingCmisService.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/SimpleCmisBindingFactory.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionBridgeServiceFactory.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionCmisService.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/SimpleForwardingCmisService.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/CmisBindingCache.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheBridgeServiceFactory.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheCmisService.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/repository.properties (with props)
chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/web.xml (with props)
Modified:
chemistry/opencmis/trunk/pom.xml
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/pom.xml?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/pom.xml (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/pom.xml Mon May 14 07:52:42 2012
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Licensed 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. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.chemistry.opencmis</groupId>
+ <artifactId>chemistry-opencmis</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>chemistry-opencmis-bridge</artifactId>
+ <name>OpenCMIS Bridge WAR packaging</name>
+ <packaging>war</packaging>
+
+ <properties>
+ <parentBasedir>../../</parentBasedir>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Bundle-Name>org.apache.chemistry.opencmis.bridge</Bundle-Name>
+ <Bundle-SymbolicName>org.apache.chemistry.opencmis.bridge</Bundle-SymbolicName>
+ <Bundle-Version>0.0.1</Bundle-Version>
+ <Import-Package>javax.servlet,javax.servlet.http,javax.servlet.resources</Import-Package>
+ <Bundle-Classpath>.</Bundle-Classpath>
+ <Web-ContextPath>bridge</Web-ContextPath>
+ </manifestEntries>
+ </archive>
+ <overlays>
+ <overlay>
+ </overlay>
+ <overlay>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>chemistry-opencmis-server-bindings</artifactId>
+ </overlay>
+ </overlays>
+ <archiveClasses>true</archiveClasses>
+ <attachClasses>true</attachClasses>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.9</version>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>chemistry-opencmis-commons-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.chemistry.opencmis</groupId>
+ <artifactId>chemistry-opencmis-commons-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>chemistry-opencmis-client-bindings</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>chemistry-opencmis-server-support</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>chemistry-opencmis-server-bindings</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- copy the dependencies from the server bindings here, because mvn eclipse ignores them from a .war -->
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java Mon May 14 07:52:42 2012
@@ -0,0 +1,163 @@
+/*
+ * 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.bridge;
+
+import java.io.File;
+import java.math.BigInteger;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
+import org.apache.chemistry.opencmis.commons.server.CmisService;
+import org.apache.chemistry.opencmis.server.support.CmisServiceWrapper;
+
+public abstract class AbstractBridgeServiceFactory extends AbstractServiceFactory {
+
+ public static final String BRIDGE_TEMP_DIRECTORY = "bridge.tempDirectory";
+ public static final String BRIDGE_MEMORY_THERESHOLD = "bridge.memoryThreshold";
+ public static final String BRIDGE_MAX_CONTENT_SIZE = "bridge.maxContentSize";
+
+ public static final String SERVICE_CLASS = "service.class";
+ public static final String SERVICE_DEFAULT_MAX_ITEMS_OBJECTS = "service.defaultMaxItems";
+ public static final String SERVICE_DEFAULT_DEPTH_OBJECTS = "service.defaultDepth";
+ public static final String SERVICE_DEFAULT_MAX_ITEMS_TYPES = "service.defaultTypesMaxItems";
+ public static final String SERVICE_DEFAULT_DEPTH_TYPES = "service.defaultTypesDepth";
+
+ private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(100000);
+ private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(100);
+ private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(1000);
+ private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(10);
+
+ private ThreadLocal<CmisServiceWrapper<FilterCmisService>> threadLocalService = new ThreadLocal<CmisServiceWrapper<FilterCmisService>>();
+
+ private Map<String, String> parameters;
+
+ private Class<?> serviceClass;
+
+ private BigInteger defaultMaxItems;
+ private BigInteger defaultDepth;
+ private BigInteger defaultTypesMaxItems;
+ private BigInteger defaultTypesDepth;
+
+ private File tempDirectory;
+ private int memoryThreshold;
+ private long maxContentSize;
+
+ @Override
+ public void init(Map<String, String> parameters) {
+ this.parameters = parameters;
+
+ // get bridge configuration
+ String tempDirectoryStr = parameters.get(BRIDGE_TEMP_DIRECTORY);
+ tempDirectory = (tempDirectoryStr == null || tempDirectoryStr.trim().length() == 0 ? super.getTempDirectory()
+ : new File(tempDirectoryStr.trim()));
+
+ try {
+ String memoryThresholdStr = parameters.get(BRIDGE_MEMORY_THERESHOLD);
+ memoryThreshold = (memoryThresholdStr == null || memoryThresholdStr.trim().length() == 0 ? super
+ .getMemoryThreshold() : Integer.parseInt(memoryThresholdStr.trim()));
+
+ String maxContentSizeStr = parameters.get(BRIDGE_MAX_CONTENT_SIZE);
+ maxContentSize = (maxContentSizeStr == null || maxContentSizeStr.trim().length() == 0 ? super
+ .getMaxContentSize() : Long.parseLong(maxContentSizeStr.trim()));
+ } catch (NumberFormatException e) {
+ throw new RuntimeException("Could not parse bride configuration values: " + e.getMessage(), e);
+ }
+
+ // find service class
+ String className = parameters.get(SERVICE_CLASS);
+ if (className == null || className.trim().length() == 0) {
+ throw new RuntimeException("Service class name is not set!");
+ }
+
+ try {
+ serviceClass = Class.forName(className);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Service class name cannot be found: " + e.getMessage(), e);
+ }
+
+ if (serviceClass.isAssignableFrom(FilterCmisService.class)) {
+ throw new RuntimeException("Service class is not a sub class of FilterCmisService!");
+ }
+
+ // get service defaults
+ try {
+ defaultMaxItems = getBigIntegerParameter(SERVICE_DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_MAX_ITEMS_OBJECTS);
+ defaultDepth = getBigIntegerParameter(SERVICE_DEFAULT_DEPTH_OBJECTS, DEFAULT_DEPTH_OBJECTS);
+ defaultTypesMaxItems = getBigIntegerParameter(SERVICE_DEFAULT_MAX_ITEMS_TYPES, DEFAULT_MAX_ITEMS_TYPES);
+ defaultTypesDepth = getBigIntegerParameter(SERVICE_DEFAULT_DEPTH_TYPES, DEFAULT_DEPTH_TYPES);
+ } catch (NumberFormatException e) {
+ throw new RuntimeException("Could not parse service default values: " + e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public CmisService getService(CallContext context) {
+ CmisServiceWrapper<FilterCmisService> wrapperService = threadLocalService.get();
+ if (wrapperService == null) {
+ wrapperService = new CmisServiceWrapper<FilterCmisService>(createService(context), defaultTypesMaxItems,
+ defaultTypesDepth, defaultMaxItems, defaultDepth);
+ threadLocalService.set(wrapperService);
+ }
+
+ wrapperService.getWrappedService().setCallContext(context);
+
+ return wrapperService;
+ }
+
+ /**
+ * Creates a new service instance.
+ */
+ protected abstract FilterCmisService createService(CallContext context);
+
+ protected Class<?> getServiceClass() {
+ return serviceClass;
+ }
+
+ protected Map<String, String> getParameters() {
+ return parameters;
+ }
+
+ @Override
+ public File getTempDirectory() {
+ return tempDirectory;
+ }
+
+ @Override
+ public int getMemoryThreshold() {
+ return memoryThreshold;
+ }
+
+ @Override
+ public long getMaxContentSize() {
+ return maxContentSize;
+ }
+
+ /**
+ * Gets a BigInteger parameter from the parameters.
+ */
+ protected BigInteger getBigIntegerParameter(String key, BigInteger def) {
+ String value = parameters.get(key);
+ if (value == null || value.trim().length() == 0) {
+ return def;
+ }
+
+ return new BigInteger(value);
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/CachedBindingCmisService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/CachedBindingCmisService.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/CachedBindingCmisService.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/CachedBindingCmisService.java Mon May 14 07:52:42 2012
@@ -0,0 +1,141 @@
+/*
+ * 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.bridge;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.chemistry.opencmis.commons.server.CallContext;
+import org.apache.chemistry.opencmis.commons.spi.AclService;
+import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
+import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
+import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
+import org.apache.chemistry.opencmis.commons.spi.NavigationService;
+import org.apache.chemistry.opencmis.commons.spi.ObjectService;
+import org.apache.chemistry.opencmis.commons.spi.PolicyService;
+import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
+import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
+import org.apache.chemistry.opencmis.commons.spi.VersioningService;
+
+/**
+ * Provides a framework to cache a {@link CmisBinding} object for a
+ * {@link FilterCmisService}.
+ */
+public abstract class CachedBindingCmisService extends FilterCmisService {
+
+ private static final long serialVersionUID = 1L;
+
+ private CmisBinding clientBinding;
+
+ @Override
+ public void setCallContext(CallContext context) {
+ super.setCallContext(context);
+
+ clientBinding = getCmisBindingFromCache();
+ if (clientBinding == null) {
+ clientBinding = putCmisBindingIntoCache(createCmisBinding());
+ }
+ }
+
+ /**
+ * Returns a cached {@link CmisBinding} object or <code>null</code> if no
+ * appropriate object can be found in the cache.
+ */
+ public abstract CmisBinding getCmisBindingFromCache();
+
+ /**
+ * Puts the provided {@link CmisBinding} object into the cache and
+ * associates it somehow with the current {@link CallContext}.
+ *
+ * The implementation may return another {@link CmisBinding} object if
+ * another thread has already added an object for the current
+ * {@link CallContext}.
+ */
+ public abstract CmisBinding putCmisBindingIntoCache(CmisBinding binding);
+
+ /**
+ * Creates a new {@link CmisBinding} object based on the current
+ * {@link CallContext}.
+ */
+ public abstract CmisBinding createCmisBinding();
+
+ /**
+ * Returns the current {@link CmisBinding} object.
+ */
+ public CmisBinding getCmisBinding() {
+ return clientBinding;
+ }
+
+ /**
+ * Returns the current {@link HttpServletRequest}.
+ */
+ public HttpServletRequest getHttpServletRequest() {
+ return (HttpServletRequest) getCallContext().get(CallContext.HTTP_SERVLET_REQUEST);
+ }
+
+ @Override
+ public RepositoryService getRepositoryService() {
+ return clientBinding.getRepositoryService();
+ }
+
+ @Override
+ public NavigationService getNavigationService() {
+ return clientBinding.getNavigationService();
+ }
+
+ @Override
+ public ObjectService getObjectService() {
+ return clientBinding.getObjectService();
+ }
+
+ @Override
+ public VersioningService getVersioningService() {
+ return clientBinding.getVersioningService();
+ }
+
+ @Override
+ public DiscoveryService getDiscoveryService() {
+ return clientBinding.getDiscoveryService();
+ }
+
+ @Override
+ public MultiFilingService getMultiFilingService() {
+ return clientBinding.getMultiFilingService();
+ }
+
+ @Override
+ public RelationshipService getRelationshipService() {
+ return clientBinding.getRelationshipService();
+ }
+
+ @Override
+ public AclService getAclService() {
+ return clientBinding.getAclService();
+ }
+
+ @Override
+ public PolicyService getPolicyService() {
+ return clientBinding.getPolicyService();
+ }
+
+ @Override
+ public void close() {
+ super.close();
+ clientBinding = null;
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/CachedBindingCmisService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java Mon May 14 07:52:42 2012
@@ -0,0 +1,486 @@
+/*
+ * 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.bridge;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.commons.data.Ace;
+import org.apache.chemistry.opencmis.commons.data.Acl;
+import org.apache.chemistry.opencmis.commons.data.AllowableActions;
+import org.apache.chemistry.opencmis.commons.data.ContentStream;
+import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.data.FailedToDeleteData;
+import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer;
+import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
+import org.apache.chemistry.opencmis.commons.data.ObjectList;
+import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
+import org.apache.chemistry.opencmis.commons.data.Properties;
+import org.apache.chemistry.opencmis.commons.data.RenditionData;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
+import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
+import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
+import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
+import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
+import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
+import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
+import org.apache.chemistry.opencmis.commons.spi.AclService;
+import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
+import org.apache.chemistry.opencmis.commons.spi.Holder;
+import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
+import org.apache.chemistry.opencmis.commons.spi.NavigationService;
+import org.apache.chemistry.opencmis.commons.spi.ObjectService;
+import org.apache.chemistry.opencmis.commons.spi.PolicyService;
+import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
+import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
+import org.apache.chemistry.opencmis.commons.spi.VersioningService;
+
+/**
+ * Forwards incoming calls to a CMIS repository.
+ */
+public abstract class FilterCmisService extends AbstractCmisService implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private CallContext context;
+
+ /**
+ * Called after the object has been created.
+ *
+ * @param parameters
+ * the parameters provided to bridge service factory
+ * @param lock
+ * a lock object shared by all service instances
+ */
+ public void init(Map<String, String> parameters) {
+ }
+
+ /**
+ * Called at the beginning of a request.
+ */
+ public void setCallContext(CallContext context) {
+ this.context = context;
+ }
+
+ /**
+ * Returns the current call context.
+ */
+ public CallContext getCallContext() {
+ return context;
+ }
+
+ /**
+ * Returns a client repository service.
+ */
+ public abstract RepositoryService getRepositoryService();
+
+ /**
+ * Returns a client navigation service.
+ */
+ public abstract NavigationService getNavigationService();
+
+ /**
+ * Returns a client object service.
+ */
+ public abstract ObjectService getObjectService();
+
+ /**
+ * Returns a client versioning service.
+ */
+ public abstract VersioningService getVersioningService();
+
+ /**
+ * Returns a client discovery service.
+ */
+ public abstract DiscoveryService getDiscoveryService();
+
+ /**
+ * Returns a client multifiling service.
+ */
+ public abstract MultiFilingService getMultiFilingService();
+
+ /**
+ * Returns a client relationship service.
+ */
+ public abstract RelationshipService getRelationshipService();
+
+ /**
+ * Returns a client ACL service.
+ */
+ public abstract AclService getAclService();
+
+ /**
+ * Returns a client policy service.
+ */
+ public abstract PolicyService getPolicyService();
+
+ @Override
+ public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
+ return getRepositoryService().getRepositoryInfo(repositoryId, extension);
+ }
+
+ @Override
+ public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
+ return getRepositoryService().getRepositoryInfos(extension);
+ }
+
+ @Override
+ public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
+ BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ return getRepositoryService().getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems,
+ skipCount, extension);
+ }
+
+ @Override
+ public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
+ Boolean includePropertyDefinitions, ExtensionsData extension) {
+ return getRepositoryService().getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions,
+ extension);
+ }
+
+ @Override
+ public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
+ return getRepositoryService().getTypeDefinition(repositoryId, typeId, extension);
+ }
+
+ @Override
+ public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ return getNavigationService().getChildren(repositoryId, folderId, filter, orderBy, includeAllowableActions,
+ includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension);
+ }
+
+ @Override
+ public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId, BigInteger depth,
+ String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
+ return getNavigationService().getDescendants(repositoryId, folderId, depth, filter, includeAllowableActions,
+ includeRelationships, renditionFilter, includePathSegment, extension);
+ }
+
+ @Override
+ public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId, BigInteger depth,
+ String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
+ return getNavigationService().getFolderTree(repositoryId, folderId, depth, filter, includeAllowableActions,
+ includeRelationships, renditionFilter, includePathSegment, extension);
+ }
+
+ @Override
+ public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includeRelativePathSegment, ExtensionsData extension) {
+ return getNavigationService().getObjectParents(repositoryId, objectId, filter, includeAllowableActions,
+ includeRelationships, renditionFilter, includeRelativePathSegment, extension);
+ }
+
+ @Override
+ public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) {
+ return getNavigationService().getFolderParent(repositoryId, folderId, filter, extension);
+ }
+
+ @Override
+ public ObjectList getCheckedOutDocs(String repositoryId, String folderId, String filter, String orderBy,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+ BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ return getNavigationService().getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
+ includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension);
+ }
+
+ @Override
+ public String create(String repositoryId, Properties properties, String folderId, ContentStream contentStream,
+ VersioningState versioningState, List<String> policies, ExtensionsData extension) {
+ return super.create(repositoryId, properties, folderId, contentStream, versioningState, policies, extension);
+ }
+
+ @Override
+ public String createDocument(String repositoryId, Properties properties, String folderId,
+ ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
+ Acl removeAces, ExtensionsData extension) {
+ return getObjectService().createDocument(repositoryId, properties, folderId, contentStream, versioningState,
+ policies, addAces, removeAces, extension);
+ }
+
+ @Override
+ public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
+ String folderId, VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces,
+ ExtensionsData extension) {
+ return getObjectService().createDocumentFromSource(repositoryId, sourceId, properties, folderId,
+ versioningState, policies, addAces, removeAces, extension);
+ }
+
+ @Override
+ public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
+ Acl addAces, Acl removeAces, ExtensionsData extension) {
+ return getObjectService().createFolder(repositoryId, properties, folderId, policies, addAces, removeAces,
+ extension);
+ }
+
+ @Override
+ public String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces,
+ Acl removeAces, ExtensionsData extension) {
+ return getObjectService()
+ .createRelationship(repositoryId, properties, policies, addAces, removeAces, extension);
+ }
+
+ @Override
+ public String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies,
+ Acl addAces, Acl removeAces, ExtensionsData extension) {
+ return getObjectService().createPolicy(repositoryId, properties, folderId, policies, addAces, removeAces,
+ extension);
+ }
+
+ @Override
+ public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
+ return getObjectService().getAllowableActions(repositoryId, objectId, extension);
+ }
+
+ @Override
+ public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
+ Boolean includeAcl, ExtensionsData extension) {
+ return getObjectService().getObject(repositoryId, objectId, filter, includeAllowableActions,
+ includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
+ }
+
+ @Override
+ public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) {
+ return getObjectService().getProperties(repositoryId, objectId, filter, extension);
+ }
+
+ @Override
+ public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
+ BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ return getObjectService()
+ .getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);
+ }
+
+ @Override
+ public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
+ Boolean includeAcl, ExtensionsData extension) {
+ return getObjectService().getObjectByPath(repositoryId, path, filter, includeAllowableActions,
+ includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
+ }
+
+ @Override
+ public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
+ BigInteger length, ExtensionsData extension) {
+ return getObjectService().getContentStream(repositoryId, objectId, streamId, offset, length, extension);
+ }
+
+ @Override
+ public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
+ Properties properties, ExtensionsData extension) {
+ getObjectService().updateProperties(repositoryId, objectId, changeToken, properties, extension);
+ }
+
+ @Override
+ public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
+ ExtensionsData extension) {
+ getObjectService().moveObject(repositoryId, objectId, targetFolderId, sourceFolderId, extension);
+ }
+
+ @Override
+ public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
+ getObjectService().deleteObject(repositoryId, objectId, allVersions, extension);
+ }
+
+ @Override
+ public void deleteObjectOrCancelCheckOut(String repositoryId, String objectId, Boolean allVersions,
+ ExtensionsData extension) {
+ // TODO: rework -> object cache
+ getObjectService().deleteObject(repositoryId, objectId, allVersions, extension);
+ }
+
+ @Override
+ public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
+ UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
+ return getObjectService().deleteTree(repositoryId, folderId, allVersions, unfileObjects, continueOnFailure,
+ extension);
+ }
+
+ @Override
+ public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
+ Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
+ getObjectService().setContentStream(repositoryId, objectId, overwriteFlag, changeToken, contentStream,
+ extension);
+ }
+
+ @Override
+ public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
+ ExtensionsData extension) {
+ getObjectService().deleteContentStream(repositoryId, objectId, changeToken, extension);
+ }
+
+ @Override
+ public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
+ Holder<Boolean> contentCopied) {
+ getVersioningService().checkOut(repositoryId, objectId, extension, contentCopied);
+ }
+
+ @Override
+ public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
+ getVersioningService().cancelCheckOut(repositoryId, objectId, extension);
+ }
+
+ @Override
+ public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
+ ContentStream contentStream, String checkinComment, List<String> policies, Acl addAces, Acl removeAces,
+ ExtensionsData extension) {
+ getVersioningService().checkIn(repositoryId, objectId, major, properties, contentStream, checkinComment,
+ policies, addAces, removeAces, extension);
+ }
+
+ @Override
+ public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
+ Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
+ return getVersioningService()
+ .getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter,
+ includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl,
+ extension);
+ }
+
+ @Override
+ public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
+ Boolean major, String filter, ExtensionsData extension) {
+ return getVersioningService().getPropertiesOfLatestVersion(repositoryId, objectId, versionSeriesId, major,
+ filter, extension);
+ }
+
+ @Override
+ public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
+ Boolean includeAllowableActions, ExtensionsData extension) {
+ return getVersioningService().getAllVersions(repositoryId, objectId, versionSeriesId, filter,
+ includeAllowableActions, extension);
+ }
+
+ @Override
+ public ObjectList getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
+ String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, ExtensionsData extension) {
+ return getDiscoveryService().getContentChanges(repositoryId, changeLogToken, includeProperties, filter,
+ includePolicyIds, includeAcl, maxItems, extension);
+ }
+
+ @Override
+ public ObjectList query(String repositoryId, String statement, Boolean searchAllVersions,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+ BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ return getDiscoveryService().query(repositoryId, statement, searchAllVersions, includeAllowableActions,
+ includeRelationships, renditionFilter, maxItems, skipCount, extension);
+ }
+
+ @Override
+ public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
+ ExtensionsData extension) {
+ getMultiFilingService().addObjectToFolder(repositoryId, objectId, folderId, allVersions, extension);
+ }
+
+ @Override
+ public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension) {
+ getMultiFilingService().removeObjectFromFolder(repositoryId, objectId, folderId, extension);
+ }
+
+ @Override
+ public ObjectList getObjectRelationships(String repositoryId, String objectId, Boolean includeSubRelationshipTypes,
+ RelationshipDirection relationshipDirection, String typeId, String filter, Boolean includeAllowableActions,
+ BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ return getRelationshipService().getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes,
+ relationshipDirection, typeId, filter, includeAllowableActions, maxItems, skipCount, extension);
+ }
+
+ @Override
+ public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces,
+ AclPropagation aclPropagation, ExtensionsData extension) {
+ return getAclService().applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension);
+ }
+
+ @Override
+ public Acl applyAcl(String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) {
+ Acl orgAcl = getAclService().getAcl(repositoryId, objectId, Boolean.FALSE, null);
+
+ Acl removeAces = null;
+ if (orgAcl != null && orgAcl.getAces() != null && !orgAcl.getAces().isEmpty()) {
+ List<Ace> directAces = new ArrayList<Ace>();
+
+ for (Ace ace : orgAcl.getAces()) {
+ if (ace.isDirect()) {
+ directAces.add(ace);
+ }
+ }
+
+ if (!directAces.isEmpty()) {
+ removeAces = new AccessControlListImpl(directAces);
+ }
+ }
+
+ return getAclService().applyAcl(repositoryId, objectId, aces, removeAces, aclPropagation, null);
+ }
+
+ @Override
+ public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
+ return getAclService().getAcl(repositoryId, objectId, onlyBasicPermissions, extension);
+ }
+
+ @Override
+ public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
+ getPolicyService().applyPolicy(repositoryId, policyId, objectId, extension);
+ }
+
+ @Override
+ public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
+ ExtensionsData extension) {
+ return getPolicyService().getAppliedPolicies(repositoryId, objectId, filter, extension);
+ }
+
+ @Override
+ public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
+ getPolicyService().removePolicy(repositoryId, policyId, objectId, extension);
+ }
+
+ @Override
+ public ObjectInfo getObjectInfo(String repositoryId, String objectId) {
+ // TODO: add intelligent object info cache
+ return super.getObjectInfo(repositoryId, objectId);
+ }
+
+ @Override
+ protected ObjectInfo getObjectInfoIntern(String repositoryId, ObjectData object) {
+ // TODO: add intelligent object info cache
+ return super.getObjectInfoIntern(repositoryId, object);
+ }
+
+ @Override
+ public void close() {
+ super.close();
+ context = null;
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/SimpleCmisBindingFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/SimpleCmisBindingFactory.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/SimpleCmisBindingFactory.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/SimpleCmisBindingFactory.java Mon May 14 07:52:42 2012
@@ -0,0 +1,61 @@
+/*
+ * 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.bridge.client;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory;
+import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.enums.BindingType;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
+import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
+
+/**
+ * Creates a {@link CmisBinding} object for a set of parameters and a
+ * {@link CallContext}.
+ */
+public class SimpleCmisBindingFactory {
+
+ private static final CmisBindingFactory BINDING_FACTORY = CmisBindingFactory.newInstance();
+
+ public static CmisBinding createCmisBinding(CallContext context, Map<String, String> bindingParameters) {
+ Map<String, String> parameters = new HashMap<String, String>(bindingParameters);
+
+ // forward user name and password
+ parameters.put(SessionParameter.USER, context.getUsername());
+ parameters.put(SessionParameter.PASSWORD, context.getPassword());
+
+ // create the binding object
+ String bindingTypeStr = parameters.get(SessionParameter.BINDING_TYPE);
+ BindingType bindingType = BindingType.fromValue(bindingTypeStr);
+
+ CmisBinding binding = null;
+ switch (bindingType) {
+ case WEBSERVICES:
+ binding = BINDING_FACTORY.createCmisWebServicesBinding(parameters);
+ case BROWSER:
+ binding = BINDING_FACTORY.createCmisBrowserBinding(parameters);
+ default:
+ binding = BINDING_FACTORY.createCmisAtomPubBinding(parameters);
+ }
+
+ return binding;
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/client/SimpleCmisBindingFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionBridgeServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionBridgeServiceFactory.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionBridgeServiceFactory.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionBridgeServiceFactory.java Mon May 14 07:52:42 2012
@@ -0,0 +1,46 @@
+/*
+ * 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.bridge.httpsession;
+
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.chemistry.opencmis.bridge.AbstractBridgeServiceFactory;
+import org.apache.chemistry.opencmis.bridge.FilterCmisService;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
+
+public class HttpSessionBridgeServiceFactory extends AbstractBridgeServiceFactory {
+
+ private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+
+ @Override
+ protected FilterCmisService createService(CallContext context) {
+ HttpSessionCmisService service = null;
+ try {
+ service = (HttpSessionCmisService) getServiceClass().newInstance();
+ } catch (Exception e) {
+ throw new CmisRuntimeException("Could not create service instance: " + e, e);
+ }
+
+ service.init(getParameters(), lock);
+
+ return service;
+ }
+
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionBridgeServiceFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionCmisService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionCmisService.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionCmisService.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionCmisService.java Mon May 14 07:52:42 2012
@@ -0,0 +1,90 @@
+/*
+ * 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.bridge.httpsession;
+
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.chemistry.opencmis.bridge.CachedBindingCmisService;
+import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
+
+/**
+ * Uses HTTP sessions to cache {@link CmisBinding} objects.
+ */
+public abstract class HttpSessionCmisService extends CachedBindingCmisService {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Key in the HTTP session. **/
+ public static final String CMIS_BINDING = "org.apache.chemistry.opencmis.bridge.binding";
+
+ private ReentrantReadWriteLock lock;
+
+ public void init(Map<String, String> parameters, ReentrantReadWriteLock lock) {
+ init(parameters);
+ this.lock = lock;
+ }
+
+ @Override
+ public CmisBinding getCmisBindingFromCache() {
+ HttpSession httpSession = getHttpSession(false);
+ if (httpSession == null) {
+ return null;
+ }
+
+ lock.readLock().lock();
+ try {
+ return (CmisBinding) httpSession.getAttribute(CMIS_BINDING);
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ @Override
+ public CmisBinding putCmisBindingIntoCache(CmisBinding binding) {
+ HttpSession httpSession = getHttpSession(true);
+
+ lock.writeLock().lock();
+ try {
+ CmisBinding existingBinding = (CmisBinding) httpSession.getAttribute(CMIS_BINDING);
+ if (existingBinding == null) {
+ httpSession.setAttribute(CMIS_BINDING, binding);
+ } else {
+ binding = existingBinding;
+ }
+
+ return binding;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Returns the current {@link HttpSession}.
+ *
+ * @param create
+ * <code>true</code> to create a new session, <code>false</code>
+ * to return <code>null</code> if there is no current session
+ */
+ public HttpSession getHttpSession(boolean create) {
+ return getHttpServletRequest().getSession(create);
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/HttpSessionCmisService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/SimpleForwardingCmisService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/SimpleForwardingCmisService.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/SimpleForwardingCmisService.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/SimpleForwardingCmisService.java Mon May 14 07:52:42 2012
@@ -0,0 +1,73 @@
+/*
+ * 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.bridge.httpsession.sample;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.bridge.FilterCmisService;
+import org.apache.chemistry.opencmis.bridge.client.SimpleCmisBindingFactory;
+import org.apache.chemistry.opencmis.bridge.httpsession.HttpSessionCmisService;
+import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
+import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
+
+/**
+ * Very simple example of a concrete {@link FilterCmisService} implementation.
+ */
+public class SimpleForwardingCmisService extends HttpSessionCmisService {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String BINDING_PARAMETERS_PREFIX = "forwarding.binding.";
+
+ private Map<String, String> bindingParameters;
+
+ @Override
+ public void init(Map<String, String> parameters) {
+ super.init(parameters);
+
+ // gather binding parameters
+ bindingParameters = new HashMap<String, String>();
+
+ for (Map.Entry<String, String> p : parameters.entrySet()) {
+ if (p.getKey().startsWith(BINDING_PARAMETERS_PREFIX)) {
+ bindingParameters.put(p.getKey().substring(BINDING_PARAMETERS_PREFIX.length()), p.getValue());
+ }
+ }
+ }
+
+ @Override
+ public CmisBinding createCmisBinding() {
+ return SimpleCmisBindingFactory.createCmisBinding(getCallContext(), bindingParameters);
+ }
+
+ @Override
+ public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
+
+ RepositoryInfo repInfo = getCmisBinding().getRepositoryService().getRepositoryInfo(repositoryId, extension);
+
+ RepositoryInfoImpl newRepInfo = new RepositoryInfoImpl(repInfo);
+ newRepInfo.setDescription(repInfo.getDescription() + " (forwarded by the OpenCMIS Bridge)");
+
+ return newRepInfo;
+ }
+
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/httpsession/sample/SimpleForwardingCmisService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/CmisBindingCache.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/CmisBindingCache.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/CmisBindingCache.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/CmisBindingCache.java Mon May 14 07:52:42 2012
@@ -0,0 +1,89 @@
+/*
+ * 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.bridge.lrucache;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.chemistry.opencmis.commons.server.CallContext;
+import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
+
+/**
+ * Simple LRU cache for {@link CmisBinding} objects. The cache key is consists
+ * of the repository id and the user.
+ */
+public class CmisBindingCache implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+ private final LinkedHashMap<String, CmisBinding> cache;
+
+ public CmisBindingCache(final int size) {
+ cache = new LinkedHashMap<String, CmisBinding>(size + 1, 0.70f, true) {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean removeEldestEntry(Map.Entry<String, CmisBinding> eldest) {
+ return size() > size;
+ }
+ };
+ }
+
+ public CmisBinding getCmisBinding(CallContext context) {
+ lock.writeLock().lock();
+ try {
+ return cache.get(getCacheKey(context));
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public CmisBinding putCmisBinding(CallContext context, CmisBinding binding) {
+ lock.writeLock().lock();
+ try {
+ String key = getCacheKey(context);
+ CmisBinding extistingBinding = cache.get(getCacheKey(context));
+ if (extistingBinding == null) {
+ cache.put(key, binding);
+ } else {
+ binding = extistingBinding;
+ }
+
+ return binding;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ protected String getCacheKey(CallContext context) {
+ String repositoryId = context.getRepositoryId();
+ String user = context.getUsername();
+
+ String key = (repositoryId == null ? "" : repositoryId);
+ if (user != null) {
+ key = key + "\n" + user;
+ }
+
+ return key;
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/CmisBindingCache.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheBridgeServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheBridgeServiceFactory.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheBridgeServiceFactory.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheBridgeServiceFactory.java Mon May 14 07:52:42 2012
@@ -0,0 +1,65 @@
+/*
+ * 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.bridge.lrucache;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.bridge.AbstractBridgeServiceFactory;
+import org.apache.chemistry.opencmis.bridge.FilterCmisService;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
+
+public class LruCacheBridgeServiceFactory extends AbstractBridgeServiceFactory {
+
+ public static final String CACHE_SIZE = "cache.size";
+ public static final int DEFAULT_CACHE_SIZE = 1000;
+
+ private CmisBindingCache cache;
+
+ @Override
+ public void init(Map<String, String> parameters) {
+ super.init(parameters);
+
+ // initialize LRU cache
+ int size = 0;
+ try {
+ String sizeStr = parameters.get(CACHE_SIZE);
+ size = (sizeStr == null || sizeStr.trim().length() == 0 ? DEFAULT_CACHE_SIZE : Integer.parseInt(sizeStr
+ .trim()));
+ } catch (NumberFormatException e) {
+ throw new RuntimeException("Could not parse cache configuration values: " + e.getMessage(), e);
+ }
+
+ cache = new CmisBindingCache(size);
+ }
+
+ @Override
+ protected FilterCmisService createService(CallContext context) {
+ LruCacheCmisService service = null;
+ try {
+ service = (LruCacheCmisService) getServiceClass().newInstance();
+ } catch (Exception e) {
+ throw new CmisRuntimeException("Could not create service instance: " + e, e);
+ }
+
+ service.init(getParameters(), cache);
+
+ return service;
+ }
+}
\ No newline at end of file
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheBridgeServiceFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheCmisService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheCmisService.java?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheCmisService.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheCmisService.java Mon May 14 07:52:42 2012
@@ -0,0 +1,49 @@
+/*
+ * 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.bridge.lrucache;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.bridge.CachedBindingCmisService;
+import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
+
+/**
+ * Uses a LRU cache to cache {@link CmisBinding} objects.
+ */
+public abstract class LruCacheCmisService extends CachedBindingCmisService {
+
+ private static final long serialVersionUID = 1L;
+
+ private CmisBindingCache cache;
+
+ public void init(Map<String, String> parameters, CmisBindingCache cache) {
+ init(parameters);
+ this.cache = cache;
+ }
+
+ @Override
+ public CmisBinding getCmisBindingFromCache() {
+ return cache.getCmisBinding(getCallContext());
+ }
+
+ @Override
+ public CmisBinding putCmisBindingIntoCache(CmisBinding binding) {
+ return cache.putCmisBinding(getCallContext(), binding);
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/lrucache/LruCacheCmisService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/repository.properties
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/repository.properties?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/repository.properties (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/repository.properties Mon May 14 07:52:42 2012
@@ -0,0 +1,59 @@
+# 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.
+
+
+###########################################################
+#
+# Bridge configuration
+#
+# Note: class MUST be set
+#
+###########################################################
+
+class=org.apache.chemistry.opencmis.bridge.httpsession.HttpSessionBridgeServiceFactory
+# bridge.tempDirectory=/tmp
+# bridge.memoryThreshold=4194304
+# bridge.maxContentSize=4294967296
+
+# cache.size=1000
+
+
+###########################################################
+#
+# Service configuration
+#
+# Note: service.class MUST be set
+#
+###########################################################
+
+service.class=org.apache.chemistry.opencmis.bridge.httpsession.sample.SimpleForwardingCmisService
+# service.defaultMaxItems=100000
+# service.defaultDepth=-1
+# service.defaultTypesMaxItems=1000
+# service.defaultTypesDepth=10
+
+
+###########################################################
+#
+# Sample configuration for the SimpleForwardingCmisService
+#
+# Note: user name and password are added on-the-fly
+#
+###########################################################
+
+forwarding.binding.org.apache.chemistry.opencmis.binding.spi.type=atompub
+forwarding.binding.org.apache.chemistry.opencmis.binding.atompub.url=http://cmis.alfresco.com/cmisatom
+forwarding.binding.org.apache.chemistry.opencmis.binding.compression=true
+forwarding.binding.org.apache.chemistry.opencmis.binding.cookies=true
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/classes/repository.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/web.xml?rev=1338045&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/web.xml (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/web.xml Mon May 14 07:52:42 2012
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>OpenCMIS Bridge</display-name>
+
+ <listener>
+ <listener-class>org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>cmisws</servlet-name>
+ <servlet-class>org.apache.chemistry.opencmis.server.impl.webservices.CmisWebServicesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>cmisatom</servlet-name>
+ <servlet-class>org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet</servlet-class>
+ <init-param>
+ <param-name>callContextHandler</param-name>
+ <param-value>org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler</param-value>
+ </init-param>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>cmisbrowser</servlet-name>
+ <servlet-class>org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet</servlet-class>
+ <init-param>
+ <param-name>callContextHandler</param-name>
+ <param-value>org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler</param-value>
+ </init-param>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>cmisws</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>cmisatom</servlet-name>
+ <url-pattern>/atom/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>cmisbrowser</servlet-name>
+ <url-pattern>/browser/*</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>60</session-timeout>
+ </session-config>
+</web-app>
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: chemistry/opencmis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/pom.xml?rev=1338045&r1=1338044&r2=1338045&view=diff
==============================================================================
--- chemistry/opencmis/trunk/pom.xml (original)
+++ chemistry/opencmis/trunk/pom.xml Mon May 14 07:52:42 2012
@@ -182,6 +182,7 @@
<module>chemistry-opencmis-server/chemistry-opencmis-server-inmemory</module>
<module>chemistry-opencmis-server/chemistry-opencmis-server-fileshare</module>
<module>chemistry-opencmis-server/chemistry-opencmis-server-jcr</module>
+ <module>chemistry-opencmis-bridge/chemistry-opencmis-bridge</module>
<module>chemistry-opencmis-test/chemistry-opencmis-test-client</module>
<module>chemistry-opencmis-test/chemistry-opencmis-test-fit</module>
<module>chemistry-opencmis-test/chemistry-opencmis-test-tck</module>