chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1726247 - in /chemistry/opencmis/trunk: ./ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/s...
Date Fri, 22 Jan 2016 16:00:47 GMT
Author: fmui
Date: Fri Jan 22 16:00:46 2016
New Revision: 1726247

URL: http://svn.apache.org/viewvc?rev=1726247&view=rev
Log:
CMIS-967: added support for asynchronous servlets

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisTooManyRequestsException.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/pom.xml
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisExecutor.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisServiceFactory.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AbstractAsyncServiceFactory.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AsyncCmisServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisAsyncHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisRequestRunner.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleAsyncCmisExecutor.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleCmisAsyncListener.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/atompub/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/atompub/AsyncCmisAtomPubServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/browser/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/browser/AsyncCmisBrowserBindingServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/webservices/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/webservices/AsyncCmisWebServicesServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/src/main/webapp/WEB-INF/web-async.xml
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/pom.xml
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/CmisWebServicesServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConnectionErrorDialog.java
    chemistry/opencmis/trunk/pom.xml

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java Fri Jan 22 16:00:46 2016
@@ -73,6 +73,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisServiceUnavailableException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisTooManyRequestsException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
@@ -511,6 +512,8 @@ public abstract class AbstractAtomPubSer
                 return new CmisNameConstraintViolationException(message, errorContent, additionalData, t);
             }
             return new CmisConstraintException(message, errorContent, additionalData, t);
+        case 429:
+            return new CmisTooManyRequestsException(message, errorContent, additionalData, t);
         case 503:
             return new CmisServiceUnavailableException(message, errorContent, additionalData, t);
         default:

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java Fri Jan 22 16:00:46 2016
@@ -56,6 +56,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisServiceUnavailableException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisTooManyRequestsException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
@@ -331,6 +332,8 @@ public abstract class AbstractBrowserBin
             return new CmisProxyAuthenticationException(message, errorContent, t);
         case 409:
             return new CmisConstraintException(message, errorContent, t);
+        case 429:
+            return new CmisTooManyRequestsException(message, errorContent, t);
         case 503:
             return new CmisServiceUnavailableException(message, errorContent, t);
         default:

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java Fri Jan 22 16:00:46 2016
@@ -57,6 +57,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisProxyAuthenticationException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisTooManyRequestsException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.impl.IOUtils;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
@@ -524,6 +525,8 @@ public abstract class AbstractPortProvid
                 throw new CmisObjectNotFoundException(message, he);
             } else if (he.getStatusCode() == 407) {
                 throw new CmisProxyAuthenticationException(message, he);
+            } else if (he.getStatusCode() == 429) {
+                throw new CmisTooManyRequestsException(message, he);
             } else if (he.getStatusCode() == 301 || he.getStatusCode() == 302 || he.getStatusCode() == 303
                     || he.getStatusCode() == 307) {
                 throw new CmisConnectionException("Redirects are not supported (HTTP status code " + he.getStatusCode()

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisTooManyRequestsException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisTooManyRequestsException.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisTooManyRequestsException.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisTooManyRequestsException.java Fri Jan 22 16:00:46 2016
@@ -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.commons.exceptions;
+
+import java.math.BigInteger;
+import java.util.Map;
+
+/**
+ * Too Many Requests exception.
+ * 
+ * (This is exception is not defined in the CMIS specification and is therefore
+ * derived from {@link CmisRuntimeException}.)
+ */
+public class CmisTooManyRequestsException extends CmisRuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Default constructor.
+     */
+    public CmisTooManyRequestsException() {
+        super();
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message
+     *            error message
+     * @param code
+     *            error code
+     * @param cause
+     *            the cause
+     */
+    public CmisTooManyRequestsException(String message, BigInteger code, Throwable cause) {
+        super(message, code, cause);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message
+     *            error message
+     * @param errorContent
+     *            error page content
+     */
+    public CmisTooManyRequestsException(String message, String errorContent) {
+        super(message, errorContent);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message
+     *            error message
+     * @param code
+     *            error code
+     */
+    public CmisTooManyRequestsException(String message, BigInteger code) {
+        super(message, code);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message
+     *            error message
+     * @param code
+     *            error code
+     * @param errorContent
+     *            error page content
+     */
+    public CmisTooManyRequestsException(String message, BigInteger code, String errorContent) {
+        super(message, code, errorContent);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message
+     *            error message
+     * @param code
+     *            error code
+     * @param errorContent
+     *            error page content
+     * @param additionalData
+     *            additional data
+     */
+    public CmisTooManyRequestsException(String message, BigInteger code, String errorContent,
+            Map<String, String> additionalData) {
+        super(message, code, errorContent, additionalData);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message
+     *            error message
+     * @param errorContent
+     *            error page content
+     * @param additionalData
+     *            additional data
+     * @param cause
+     *            the cause
+     */
+    public CmisTooManyRequestsException(String message, String errorContent, Map<String, String> additionalData,
+            Throwable cause) {
+        super(message, errorContent, additionalData, cause);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message
+     *            error message
+     * @param errorContent
+     *            error page content
+     * @param cause
+     *            the cause
+     */
+    public CmisTooManyRequestsException(String message, String errorContent, Throwable cause) {
+        super(message, errorContent, cause);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message
+     *            error message
+     * @param cause
+     *            the cause
+     */
+    public CmisTooManyRequestsException(String message, Throwable cause) {
+        super(message, BigInteger.ZERO, cause);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message
+     *            error message
+     */
+    public CmisTooManyRequestsException(String message) {
+        super(message, BigInteger.ZERO);
+    }
+
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/pom.xml?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/pom.xml (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/pom.xml Fri Jan 22 16:00:46 2016
@@ -0,0 +1,54 @@
+<?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.
+-->
+
+<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>1.0.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>chemistry-opencmis-server-async</artifactId>
+    <name>OpenCMIS Server Async Implementation</name>
+    <packaging>jar</packaging>
+
+    <properties>
+        <parentBasedir>../../</parentBasedir>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>chemistry-opencmis-server-bindings</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.0.1</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisExecutor.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisExecutor.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisExecutor.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisExecutor.java Fri Jan 22 16:00:46 2016
@@ -0,0 +1,42 @@
+/*
+ * 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.server.async;
+
+import java.util.concurrent.RejectedExecutionException;
+
+import javax.servlet.AsyncContext;
+
+/**
+ * Implementations of this interface are responsible for executing a CMIS
+ * request asynchronously.
+ */
+public interface AsyncCmisExecutor {
+
+    /**
+     * Executes a CMIS request.
+     * 
+     * @param asyncContext
+     *            the {@link AsyncContext} object
+     * @param runnable
+     *            the {@link Runnable} that executes the request
+     * @throws RejectedExecutionException
+     *             if the request could not be scheduled for execution
+     */
+    void execute(AsyncContext asyncContext, Runnable runnable);
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisServiceFactory.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisServiceFactory.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/AsyncCmisServiceFactory.java Fri Jan 22 16:00:46 2016
@@ -0,0 +1,47 @@
+/*
+ * 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.server.async;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.chemistry.opencmis.commons.server.CmisService;
+import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
+
+/**
+ * Factory for {@link CmisService} objects that support asynchronous execution.
+ */
+public interface AsyncCmisServiceFactory extends CmisServiceFactory {
+
+    /**
+     * Returns an {@link AsyncCmisExecutor} instance that handles the
+     * asynchronous execution of this request.
+     *
+     * If this method returns {@code null} the request is executed
+     * synchronously.
+     * 
+     * @param request
+     *            the request object
+     * @param response
+     *            the response object
+     * 
+     * @return the {@link AsyncCmisExecutor} instance or {@code null}
+     */
+    AsyncCmisExecutor getAsyncCmisExecutor(HttpServletRequest request, HttpServletResponse response);
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AbstractAsyncServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AbstractAsyncServiceFactory.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AbstractAsyncServiceFactory.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AbstractAsyncServiceFactory.java Fri Jan 22 16:00:46 2016
@@ -0,0 +1,58 @@
+/*
+ * 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.server.async.impl;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
+import org.apache.chemistry.opencmis.server.async.AsyncCmisExecutor;
+import org.apache.chemistry.opencmis.server.async.AsyncCmisServiceFactory;
+
+/**
+ * An {@link AsyncCmisServiceFactory} implementation that sets up one simple
+ * {@code ThreadPoolExecutor} for executing asynchronous all CMIS requests.
+ */
+public abstract class AbstractAsyncServiceFactory extends AbstractServiceFactory implements AsyncCmisServiceFactory {
+
+    private SimpleAsyncCmisExecutor executor;
+
+    @Override
+    public void init(Map<String, String> parameters) {
+        super.init(parameters);
+        executor = new SimpleAsyncCmisExecutor();
+    }
+
+    @Override
+    public void destroy() {
+        if (executor != null) {
+            executor.destroy();
+        }
+
+        super.destroy();
+    }
+
+    @Override
+    public AsyncCmisExecutor getAsyncCmisExecutor(HttpServletRequest request, HttpServletResponse response) {
+        // all requests share one thread pool
+        return executor;
+    }
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AsyncCmisServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AsyncCmisServlet.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AsyncCmisServlet.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/AsyncCmisServlet.java Fri Jan 22 16:00:46 2016
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.server.async.impl;
+
+import java.io.IOException;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Marks a servlet as an asynchronous CMIS servlet.
+ */
+public interface AsyncCmisServlet extends Servlet {
+
+    /**
+     * Executes the synchronous part of this servlet.
+     * 
+     * It is called in the thread that eventually executes the CMIS call. This
+     * can be a servlet thread or a thread in a different thread pool.
+     */
+    void executeSync(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException;
+
+    /**
+     * Sends an error to client.
+     * 
+     * This method should only be use to signal problems with scheduling a CMIS
+     * call in thread pool.
+     */
+    void sendError(Exception ex, HttpServletRequest request, HttpServletResponse response) throws IOException;
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisAsyncHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisAsyncHelper.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisAsyncHelper.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisAsyncHelper.java Fri Jan 22 16:00:46 2016
@@ -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.server.async.impl;
+
+import java.io.IOException;
+import java.util.concurrent.RejectedExecutionException;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.chemistry.opencmis.commons.exceptions.CmisServiceUnavailableException;
+import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
+import org.apache.chemistry.opencmis.server.async.AsyncCmisExecutor;
+import org.apache.chemistry.opencmis.server.async.AsyncCmisServiceFactory;
+import org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class CmisAsyncHelper {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CmisAsyncHelper.class);
+
+    /**
+     * Gets the service factory and get the AsyncCmisExecutor instance.
+     */
+    public static AsyncCmisExecutor getAsyncCmisExecutor(ServletConfig config, HttpServletRequest request,
+            HttpServletResponse response) throws ServletException {
+        CmisServiceFactory serviceFactory = CmisRepositoryContextListener.getServiceFactory(config.getServletContext());
+        if (!(serviceFactory instanceof AsyncCmisServiceFactory)) {
+            throw new ServletException("CMIS service factory does not support asynchronous execution!");
+        }
+
+        return ((AsyncCmisServiceFactory) serviceFactory).getAsyncCmisExecutor(request, response);
+    }
+
+    /**
+     * Executes a request asynchronously.
+     */
+    public static void executeAsync(AsyncCmisServlet servlet, HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        AsyncCmisExecutor executor = getAsyncCmisExecutor(servlet.getServletConfig(), request, response);
+
+        if (executor == null) {
+            // there is no executor -> execute synchronously
+            servlet.executeSync(request, response);
+        } else {
+            // there is an executor -> start asynchronous execution
+            AsyncContext asyncContext = request.startAsync();
+
+            try {
+                executor.execute(asyncContext, new CmisRequestRunner(asyncContext, servlet));
+            } catch (RejectedExecutionException ree) {
+                if (LOG.isWarnEnabled()) {
+                    LOG.warn("Submitting async request failed: {}", ree.toString(), ree);
+                }
+
+                servlet.sendError(new CmisServiceUnavailableException("CMIS server is busy", ree), request, response);
+                asyncContext.complete();
+            } catch (Exception e) {
+                LOG.error("Executing async request failed: {}", e.toString(), e);
+
+                servlet.sendError(e, request, response);
+                asyncContext.complete();
+            }
+        }
+    }
+
+    private CmisAsyncHelper() {
+    }
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisRequestRunner.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisRequestRunner.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisRequestRunner.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/CmisRequestRunner.java Fri Jan 22 16:00:46 2016
@@ -0,0 +1,64 @@
+/*
+ * 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.server.async.impl;
+
+import java.io.IOException;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Runner that executes an asynchronous CMIS request.
+ */
+public class CmisRequestRunner implements Runnable {
+    private static final Logger LOG = LoggerFactory.getLogger(CmisRequestRunner.class);
+
+    private final AsyncContext asyncContext;
+    private final AsyncCmisServlet asyncServlet;
+
+    public CmisRequestRunner(AsyncContext asyncContext, AsyncCmisServlet asyncServlet) {
+        this.asyncContext = asyncContext;
+        this.asyncServlet = asyncServlet;
+    }
+
+    @Override
+    public void run() {
+        try {
+            asyncServlet.executeSync((HttpServletRequest) asyncContext.getRequest(),
+                    (HttpServletResponse) asyncContext.getResponse());
+        } catch (Exception e) {
+            LOG.error("Async Excpetion: {}", e.toString(), e);
+
+            try {
+                asyncServlet.sendError(e, (HttpServletRequest) asyncContext.getRequest(),
+                        (HttpServletResponse) asyncContext.getResponse());
+            } catch (IOException ioe) {
+                if (LOG.isWarnEnabled()) {
+                    LOG.warn("Failed to send error responds: {}", ioe.toString(), ioe);
+                }
+            }
+        } finally {
+            asyncContext.complete();
+        }
+    }
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleAsyncCmisExecutor.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleAsyncCmisExecutor.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleAsyncCmisExecutor.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleAsyncCmisExecutor.java Fri Jan 22 16:00:46 2016
@@ -0,0 +1,91 @@
+package org.apache.chemistry.opencmis.server.async.impl;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import javax.servlet.AsyncContext;
+
+import org.apache.chemistry.opencmis.server.async.AsyncCmisExecutor;
+
+/**
+ * A simple {@link AsyncCmisExecutor} implementation that uses a
+ * {@code ThreadPoolExecutor} for executing asynchronous CMIS requests.
+ */
+public class SimpleAsyncCmisExecutor implements AsyncCmisExecutor {
+
+    private static int cmisThreadInitNumber = 0;
+
+    private ExecutorService executorService;
+    private long timeout;
+
+    public SimpleAsyncCmisExecutor() {
+        executorService = createExecutorService();
+        timeout = 24 * 60 * 60 * 1000; // 24 hours
+    }
+
+    private static synchronized int nextThreadNum() {
+        return cmisThreadInitNumber++;
+    }
+
+    /**
+     * Creates an ExecutorService instance.
+     */
+    private ExecutorService createExecutorService() {
+        final ThreadGroup threadGroup = new ThreadGroup("cmis-thread-group");
+        final ThreadFactory threadFactory = new ThreadFactory() {
+            @Override
+            public Thread newThread(Runnable r) {
+                return new Thread(threadGroup, r, "cmis-" + nextThreadNum());
+            }
+        };
+
+        int processors = Runtime.getRuntime().availableProcessors();
+        int maximumPoolSize = processors * 100;
+        int corePoolSize = processors;
+        int queueSize = maximumPoolSize / 2;
+
+        ThreadPoolExecutor threadPoolexecutor = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, 60L,
+                TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(queueSize), threadFactory);
+
+        return threadPoolexecutor;
+    }
+
+    /**
+     * Waits until all running threads are stopped.
+     */
+    public void destroy() {
+        executorService.shutdown();
+    }
+
+    /**
+     * Gets the timeout for the AsyncContext.
+     * 
+     * @return the timeout in milliseconds
+     */
+    public long getTimeout() {
+        return timeout;
+    }
+
+    /**
+     * Sets the timeout for the AsyncContext.
+     * 
+     * @param timeout
+     *            the timeout in milliseconds
+     * 
+     * @see AsyncContext#setTimeout(long)
+     */
+    public void setTimeout(long timeout) {
+        this.timeout = timeout;
+    }
+
+    @Override
+    public void execute(AsyncContext asyncContext, Runnable runable) {
+        asyncContext.setTimeout(timeout);
+        asyncContext.addListener(new SimpleCmisAsyncListener());
+
+        executorService.submit(runable);
+    }
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleCmisAsyncListener.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleCmisAsyncListener.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleCmisAsyncListener.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/SimpleCmisAsyncListener.java Fri Jan 22 16:00:46 2016
@@ -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.server.async.impl;
+
+import java.io.IOException;
+
+import javax.servlet.AsyncEvent;
+import javax.servlet.AsyncListener;
+import javax.servlet.annotation.WebListener;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Simple listener for asynchronous events (for debugging and error messages).
+ */
+@WebListener
+public class SimpleCmisAsyncListener implements AsyncListener {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SimpleCmisAsyncListener.class);
+
+    @Override
+    public void onComplete(AsyncEvent asyncEvent) throws IOException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Request complete.");
+        }
+    }
+
+    @Override
+    public void onError(AsyncEvent asyncEvent) throws IOException {
+        LOG.error("Request failed!", asyncEvent.getThrowable());
+    }
+
+    @Override
+    public void onStartAsync(AsyncEvent asyncEvent) throws IOException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Request starts.");
+        }
+    }
+
+    @Override
+    public void onTimeout(AsyncEvent asyncEvent) throws IOException {
+        LOG.error("Request timed out!", asyncEvent.getThrowable());
+    }
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/atompub/AsyncCmisAtomPubServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/atompub/AsyncCmisAtomPubServlet.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/atompub/AsyncCmisAtomPubServlet.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/atompub/AsyncCmisAtomPubServlet.java Fri Jan 22 16:00:46 2016
@@ -0,0 +1,54 @@
+/*
+ * 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.server.async.impl.atompub;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.chemistry.opencmis.server.async.impl.AsyncCmisServlet;
+import org.apache.chemistry.opencmis.server.async.impl.CmisAsyncHelper;
+import org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet;
+
+/**
+ * Async CMIS AtomPub servlet.
+ */
+@WebServlet(asyncSupported = true)
+public class AsyncCmisAtomPubServlet extends CmisAtomPubServlet implements AsyncCmisServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        CmisAsyncHelper.executeAsync(this, req, resp);
+    }
+
+    @Override
+    public void executeSync(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        super.service(req, resp);
+    }
+
+    @Override
+    public void sendError(Exception ex, HttpServletRequest request, HttpServletResponse response) throws IOException {
+        printError(ex, request, response);
+    }
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/browser/AsyncCmisBrowserBindingServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/browser/AsyncCmisBrowserBindingServlet.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/browser/AsyncCmisBrowserBindingServlet.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/browser/AsyncCmisBrowserBindingServlet.java Fri Jan 22 16:00:46 2016
@@ -0,0 +1,54 @@
+/*
+ * 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.server.async.impl.browser;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.chemistry.opencmis.server.async.impl.AsyncCmisServlet;
+import org.apache.chemistry.opencmis.server.async.impl.CmisAsyncHelper;
+import org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet;
+
+/**
+ * Async CMIS Browser binding servlet.
+ */
+@WebServlet(asyncSupported = true)
+public class AsyncCmisBrowserBindingServlet extends CmisBrowserBindingServlet implements AsyncCmisServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        CmisAsyncHelper.executeAsync(this, req, resp);
+    }
+
+    @Override
+    public void executeSync(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        super.service(req, resp);
+    }
+
+    @Override
+    public void sendError(Exception ex, HttpServletRequest request, HttpServletResponse response) throws IOException {
+        printError(null, ex, request, response);
+    }
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/webservices/AsyncCmisWebServicesServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/webservices/AsyncCmisWebServicesServlet.java?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/webservices/AsyncCmisWebServicesServlet.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-async/src/main/java/org/apache/chemistry/opencmis/server/async/impl/webservices/AsyncCmisWebServicesServlet.java Fri Jan 22 16:00:46 2016
@@ -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.
+ */
+package org.apache.chemistry.opencmis.server.async.impl.webservices;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.chemistry.opencmis.commons.exceptions.CmisServiceUnavailableException;
+import org.apache.chemistry.opencmis.server.async.impl.AsyncCmisServlet;
+import org.apache.chemistry.opencmis.server.async.impl.CmisAsyncHelper;
+import org.apache.chemistry.opencmis.server.impl.webservices.CmisWebServicesServlet;
+
+/**
+ * Async CMIS Web Services servlet.
+ */
+@WebServlet(asyncSupported = true)
+public class AsyncCmisWebServicesServlet extends CmisWebServicesServlet implements AsyncCmisServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        CmisAsyncHelper.executeAsync(this, req, resp);
+    }
+
+    @Override
+    public void executeSync(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        super.service(req, resp);
+    }
+
+    @Override
+    public void sendError(Exception ex, HttpServletRequest request, HttpServletResponse response) throws IOException {
+        if (ex instanceof CmisServiceUnavailableException) {
+            response.sendError(503, ex.getMessage());
+        } else {
+            printError(request, response, ex.getMessage());
+        }
+    }
+}

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/pom.xml?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/pom.xml (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/pom.xml Fri Jan 22 16:00:46 2016
@@ -33,13 +33,11 @@
             <artifactId>chemistry-opencmis-server-bindings</artifactId>
             <version>${project.version}</version>
         </dependency>
-         <!--
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>chemistry-opencmis-server-async</artifactId>
             <version>${project.version}</version>
         </dependency>
-        -->
         <!-- Uncomment for CORS support 
         <dependency>
             <groupId>com.thetransactioncompany</groupId>
@@ -47,19 +45,5 @@
             <version>2.1.2</version>
         </dependency>
         -->
-        <!--
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>2.4</version>
-            <scope>provided</scope>
-        </dependency>
-         -->
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <version>3.0.1</version>
-            <scope>provided</scope>
-        </dependency>
     </dependencies>
 </project>

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/src/main/webapp/WEB-INF/web-async.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/src/main/webapp/WEB-INF/web-async.xml?rev=1726247&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/src/main/webapp/WEB-INF/web-async.xml (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/src/main/webapp/WEB-INF/web-async.xml Fri Jan 22 16:00:46 2016
@@ -0,0 +1,267 @@
+<?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="3.0"
+    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+    
+    <display-name>OpenCMIS Server</display-name>
+
+    <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+
+    <listener>
+        <listener-class>org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener</listener-class>
+    </listener>
+    
+    <!-- 
+         A servlet filter that logs all requests in files. Useful for monitoring and debugging.
+         Use it with care! It can generate a huge amount of files and will slow down performance
+         significantly.
+    -->
+    <!-- - ->
+    <filter>
+           <filter-name>LoggingFilter</filter-name>
+          <filter-class>org.apache.chemistry.opencmis.server.support.filter.LoggingFilter</filter-class>
+           <init-param>
+              <param-name>LogDir</param-name>
+              <param-value></param-value>
+           </init-param>
+           <init-param>
+              <param-name>PrettyPrint</param-name>
+              <param-value>true</param-value>
+           </init-param>
+           <init-param>
+              <param-name>LogHeader</param-name>
+              <param-value>true</param-value>
+           </init-param>
+           <init-param>
+              <param-name>Indent</param-name>
+              <param-value>4</param-value>
+           </init-param>
+    </filter>
+    
+    <filter-mapping>
+           <filter-name>LoggingFilter</filter-name>
+           <servlet-name>cmisatom10</servlet-name> 
+    </filter-mapping>
+    <filter-mapping>
+           <filter-name>LoggingFilter</filter-name>
+           <servlet-name>cmisatom11</servlet-name> 
+    </filter-mapping>
+    <filter-mapping>
+           <filter-name>LoggingFilter</filter-name>
+           <servlet-name>cmisws10</servlet-name> 
+    </filter-mapping>
+    <filter-mapping>
+           <filter-name>LoggingFilter</filter-name>
+           <servlet-name>cmisws11</servlet-name> 
+    </filter-mapping>
+    <filter-mapping>
+           <filter-name>LoggingFilter</filter-name>
+           <servlet-name>cmisbrowser</servlet-name> 
+    </filter-mapping>
+    <!- -   -->
+
+    <!--
+        Uncomment the following filter if the OpenCMIS server runs behind a proxy server or a load balancer.
+        The value of the 'trustedProxies' parameter is a regular expression. It must match the IP address of the proxy or load balancer.
+    -->
+    <!--
+    <filter>
+           <filter-name>ProxyFilter</filter-name>
+          <filter-class>org.apache.chemistry.opencmis.server.filter.ProxyFilter</filter-class>
+        <init-param>
+            <param-name>trustedProxies</param-name>
+            <param-value>10\.\d{1,3}\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3}|169\.254\.\d{1,3}\.\d{1,3}|127\.\d{1,3}\.\d{1,3}\.\d{1,3}</param-value>
+        </init-param>
+    </filter>
+
+    <filter-mapping>
+           <filter-name>ProxyFilter</filter-name>
+           <servlet-name>cmisatom10</servlet-name> 
+    </filter-mapping>
+    <filter-mapping>
+           <filter-name>ProxyFilter</filter-name>
+           <servlet-name>cmisatom11</servlet-name> 
+    </filter-mapping>
+    <filter-mapping>
+           <filter-name>ProxyFilter</filter-name>
+           <servlet-name>cmisbrowser</servlet-name> 
+    </filter-mapping>    
+    -->
+
+    <!--
+        Uncomment the following filter to enable CORS support for the browser binding.
+        See http://software.dzhuvinov.com/cors-filter.html for details.
+        Put the CORS libraries into the WEB-INF/lib directory or uncomment the CORS dependency in the pom.xml.
+    -->
+    <!--
+    <filter>
+        <filter-name>CORS</filter-name>
+        <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
+        <init-param>
+            <param-name>cors.allowGenericHttpRequests</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.allowOrigin</param-name>
+            <param-value>*</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.allowSubdomains</param-name>
+            <param-value>false</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.supportedMethods</param-name>
+            <param-value>GET, POST</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.supportedHeaders</param-name>
+            <param-value>*</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.exposedHeaders</param-name>
+            <param-value></param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.supportsCredentials</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.maxAge</param-name>
+            <param-value>3600</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.tagRequests</param-name>
+            <param-value>false</param-value>
+        </init-param>
+    </filter>
+
+    <filter-mapping>
+        <filter-name>CORS</filter-name>
+        <servlet-name>cmisbrowser</servlet-name>
+    </filter-mapping>
+    -->
+
+    <servlet>
+        <servlet-name>cmisws10</servlet-name>
+        <servlet-class>org.apache.chemistry.opencmis.server.async.impl.webservices.AsyncCmisWebServicesServlet</servlet-class>
+        <init-param>
+            <param-name>cmisVersion</param-name>
+            <param-value>1.0</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+        <async-supported>true</async-supported>
+    </servlet>
+    
+    <servlet>
+        <servlet-name>cmisws11</servlet-name>
+        <servlet-class>org.apache.chemistry.opencmis.server.async.impl.webservices.AsyncCmisWebServicesServlet</servlet-class>
+        <init-param>
+            <param-name>cmisVersion</param-name>
+            <param-value>1.1</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+        <async-supported>true</async-supported>
+    </servlet>
+
+    <servlet>
+        <servlet-name>cmisatom10</servlet-name>
+        <servlet-class>org.apache.chemistry.opencmis.server.async.impl.atompub.AsyncCmisAtomPubServlet</servlet-class>
+        <init-param>
+            <param-name>callContextHandler</param-name>
+            <param-value>org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cmisVersion</param-name>
+            <param-value>1.0</param-value>
+        </init-param>
+        <load-on-startup>2</load-on-startup>
+        <async-supported>true</async-supported>
+    </servlet>
+
+    <servlet>
+        <servlet-name>cmisatom11</servlet-name>
+        <servlet-class>org.apache.chemistry.opencmis.server.async.impl.atompub.AsyncCmisAtomPubServlet</servlet-class>
+        <init-param>
+            <param-name>callContextHandler</param-name>
+            <param-value>org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cmisVersion</param-name>
+            <param-value>1.1</param-value>
+        </init-param>
+        <load-on-startup>2</load-on-startup>
+        <async-supported>true</async-supported>
+    </servlet>
+    
+    <servlet>
+        <servlet-name>cmisbrowser</servlet-name>
+        <servlet-class>org.apache.chemistry.opencmis.server.async.impl.browser.AsyncCmisBrowserBindingServlet</servlet-class>
+        <init-param>
+            <param-name>callContextHandler</param-name>
+            <param-value>org.apache.chemistry.opencmis.server.impl.browser.token.TokenCallContextHandler</param-value>
+        </init-param>
+        <load-on-startup>2</load-on-startup>
+        <async-supported>true</async-supported>
+    </servlet>
+    
+    <servlet>
+        <servlet-name>cmisendpoints</servlet-name>
+        <servlet-class>org.apache.chemistry.opencmis.server.impl.endpoints.SimpleCmisEndpointsDocumentServlet</servlet-class>
+        <init-param>
+            <param-name>template</param-name>
+            <param-value>/WEB-INF/cmis-endpoints.json</param-value>
+        </init-param>
+        <load-on-startup>3</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>cmisws10</servlet-name>
+        <url-pattern>/services/*</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>cmisws11</servlet-name>
+        <url-pattern>/services11/*</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>cmisatom10</servlet-name>
+        <url-pattern>/atom/*</url-pattern>
+    </servlet-mapping>
+    
+    <servlet-mapping>
+        <servlet-name>cmisatom11</servlet-name>
+        <url-pattern>/atom11/*</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>cmisbrowser</servlet-name>
+        <url-pattern>/browser/*</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>cmisendpoints</servlet-name>
+        <url-pattern>/cmis-endpoints.json</url-pattern>
+    </servlet-mapping>
+</web-app>

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java Fri Jan 22 16:00:46 2016
@@ -69,6 +69,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisServiceUnavailableException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisTooManyRequestsException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
@@ -300,6 +301,8 @@ public class CmisAtomPubServlet extends
             return 409;
         } else if (ex instanceof CmisVersioningException) {
             return 409;
+        } else if (ex instanceof CmisTooManyRequestsException) {
+            return 429;
         } else if (ex instanceof CmisServiceUnavailableException) {
             return 503;
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java Fri Jan 22 16:00:46 2016
@@ -98,6 +98,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisServiceUnavailableException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisTooManyRequestsException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
@@ -119,6 +120,9 @@ import org.apache.chemistry.opencmis.ser
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * CMIS Browser binding servlet.
+ */
 public class CmisBrowserBindingServlet extends AbstractCmisHttpServlet {
 
     private static final long serialVersionUID = 1L;
@@ -467,6 +471,8 @@ public class CmisBrowserBindingServlet e
                 return 409;
             } else if (ex instanceof CmisVersioningException) {
                 return 409;
+            } else if (ex instanceof CmisTooManyRequestsException) {
+                return 429;
             } else if (ex instanceof CmisServiceUnavailableException) {
                 return 503;
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/CmisWebServicesServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/CmisWebServicesServlet.java?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/CmisWebServicesServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/CmisWebServicesServlet.java Fri Jan 22 16:00:46 2016
@@ -48,6 +48,9 @@ import org.apache.cxf.transport.servlet.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * CMIS Web Services servlet.
+ */
 public class CmisWebServicesServlet extends CXFServlet {
 
     public static final String PARAM_CMIS_VERSION = "cmisVersion";
@@ -207,8 +210,8 @@ public class CmisWebServicesServlet exte
         pw.flush();
     }
 
-    private void printError(HttpServletRequest request, HttpServletResponse response, String message)
-            throws ServletException, IOException {
+    protected void printError(HttpServletRequest request, HttpServletResponse response, String message)
+            throws IOException {
         response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
         response.setContentType("text/xml");
         response.setCharacterEncoding(IOUtils.UTF8);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml Fri Jan 22 16:00:46 2016
@@ -108,6 +108,11 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
+            <artifactId>chemistry-opencmis-server-async</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
             <artifactId>chemistry-opencmis-server-bindings-war</artifactId>
             <version>${project.version}</version>
             <scope>provided</scope>
@@ -122,8 +127,8 @@
         -->
         <dependency>
             <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>2.4</version>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.0.1</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java Fri Jan 22 16:00:46 2016
@@ -51,7 +51,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
-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.commons.spi.BindingsObjectFactory;
@@ -61,13 +60,14 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerFactory;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerImpl;
+import org.apache.chemistry.opencmis.server.async.impl.AbstractAsyncServiceFactory;
 import org.apache.chemistry.opencmis.server.support.TypeManager;
 import org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper;
 import org.apache.chemistry.opencmis.util.repository.ObjectGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class InMemoryServiceFactoryImpl extends AbstractServiceFactory {
+public class InMemoryServiceFactoryImpl extends AbstractAsyncServiceFactory {
 
     private static final Logger LOG = LoggerFactory.getLogger(InMemoryServiceFactoryImpl.class.getName());
     private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(1000);
@@ -90,6 +90,8 @@ public class InMemoryServiceFactoryImpl
         LOG.info("Initializing in-memory repository...");
         LOG.debug("Init paramaters: " + parameters);
 
+        super.init(parameters);
+
         String overrideCtxParam = parameters.get(ConfigConstants.OVERRIDE_CALL_CONTEXT);
         if (null != overrideCtxParam) {
             fUseOverrideCtx = true;
@@ -157,7 +159,7 @@ public class InMemoryServiceFactoryImpl
         ConformanceCmisServiceWrapper wrapperService;
         InMemoryService inMemoryService = new InMemoryService(storeManager, contextToUse);
         wrapperService = new ConformanceCmisServiceWrapper(inMemoryService, DEFAULT_MAX_ITEMS_TYPES,
-        		DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
+                DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
 
         return inMemoryService; // wrapperService;
     }
@@ -188,6 +190,8 @@ public class InMemoryServiceFactoryImpl
         if (null != cleanManager) {
             cleanManager.stopCleanRepositoryJob();
         }
+
+        super.destroy();
     }
 
     public StoreManager getStoreManger() {
@@ -501,7 +505,7 @@ public class InMemoryServiceFactoryImpl
             } catch (Exception e) {
                 LOG.error("Could not create folder hierarchy with documents. ", e);
             }
-            destroy();
+            svc.close();
         } // if
 
     } // fillRepositoryIfConfigured

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConnectionErrorDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConnectionErrorDialog.java?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConnectionErrorDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConnectionErrorDialog.java Fri Jan 22 16:00:46 2016
@@ -47,6 +47,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisProxyAuthenticationException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisTooManyRequestsException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParseException;
 import org.xml.sax.SAXParseException;
@@ -149,6 +150,8 @@ public class ConnectionErrorDialog exten
             return "The proxy server requires valid credentials.<br>Check the session parameters "
                     + "'org.apache.chemistry.opencmis.binding.proxyuser' and "
                     + "'org.apache.chemistry.opencmis.binding.proxypassword'." + getProxyConfig();
+        } else if (exception instanceof CmisTooManyRequestsException) {
+            return "The server indicated that you made too many request. Wait or contact the server administrator.";
         } else if (exception instanceof CmisRuntimeException) {
             return "Something fatal happend on the client or server side."
                     + "<br>Check your URL, the binding, and your proxy settings."

Modified: chemistry/opencmis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/pom.xml?rev=1726247&r1=1726246&r2=1726247&view=diff
==============================================================================
--- chemistry/opencmis/trunk/pom.xml (original)
+++ chemistry/opencmis/trunk/pom.xml Fri Jan 22 16:00:46 2016
@@ -187,6 +187,7 @@
         <!-- <module>chemistry-opencmis-server/chemistry-opencmis-server-jcr</module> -->
         <module>chemistry-opencmis-server/chemistry-opencmis-server-archetype</module>
         <module>chemistry-opencmis-server/chemistry-opencmis-server-extension-archetype</module>
+        <module>chemistry-opencmis-server/chemistry-opencmis-server-async</module>
         <module>chemistry-opencmis-bridge/chemistry-opencmis-bridge</module>
         <module>chemistry-opencmis-test/chemistry-opencmis-test-fit</module>
         <module>chemistry-opencmis-test/chemistry-opencmis-test-tck</module>



Mime
View raw message