chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1133337 - 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/src/...
Date Wed, 08 Jun 2011 10:51:42 GMT
Author: fmui
Date: Wed Jun  8 10:51:42 2011
New Revision: 1133337

URL: http://svn.apache.org/viewvc?rev=1133337&view=rev
Log:
added authentication exceptions

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.java
  (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.java
  (with props)
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/webservices/AbstractPortProvider.java

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=1133337&r1=1133336&r2=1133337&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
Wed Jun  8 10:51:42 2011
@@ -58,9 +58,11 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
 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.CmisStorageException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
@@ -417,15 +419,19 @@ public class AbstractAtomPubService impl
                 return new CmisFilterNotValidException(message, errorContent, t);
             }
             return new CmisInvalidArgumentException(message, errorContent, t);
-        case 404:
-            return new CmisObjectNotFoundException(message, errorContent, t);
+        case 401:
+            return new CmisUnauthorizedException(message, errorContent, t);
         case 403:
             if (CmisStreamNotSupportedException.EXCEPTION_NAME.equals(exception)) {
                 return new CmisStreamNotSupportedException(message, errorContent, t);
             }
             return new CmisPermissionDeniedException(message, errorContent, t);
+        case 404:
+            return new CmisObjectNotFoundException(message, errorContent, t);
         case 405:
             return new CmisNotSupportedException(message, errorContent, t);
+        case 407:
+            return new CmisProxyAuthenticationException(message, errorContent, t);
         case 409:
             if (CmisContentAlreadyExistsException.EXCEPTION_NAME.equals(exception)) {
                 return new CmisContentAlreadyExistsException(message, errorContent, t);

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=1133337&r1=1133336&r2=1133337&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
Wed Jun  8 10:51:42 2011
@@ -28,13 +28,16 @@ import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Service;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.http.HTTPException;
 
 import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisProxyAuthenticationException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.ACLService;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryService;
@@ -249,8 +252,18 @@ public abstract class AbstractPortProvid
         } catch (CmisBaseException ce) {
             throw ce;
         } catch (Exception e) {
-            throw new CmisConnectionException("Cannot initalize Web Services service object
[" + serviceKey + "]: "
-                    + e.getMessage(), e);
+            String message = "Cannot initalize Web Services service object [" + serviceKey
+ "]: " + e.getMessage();
+
+            if (e instanceof HTTPException) {
+                HTTPException he = (HTTPException) e;
+                if (he.getStatusCode() == 401) {
+                    throw new CmisUnauthorizedException(message, e);
+                } else if (he.getStatusCode() == 407) {
+                    throw new CmisProxyAuthenticationException(message, e);
+                }
+            }
+
+            throw new CmisConnectionException(message, e);
         }
 
         return serviceObject;

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.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/CmisProxyAuthenticationException.java?rev=1133337&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.java
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.java
Wed Jun  8 10:51:42 2011
@@ -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.commons.exceptions;
+
+import java.math.BigInteger;
+
+/**
+ * Proxy authentication exception.
+ * 
+ * (This is exception is not defined in the CMIS specification and is therefore
+ * derived from {@link CmisRuntimeException}.)
+ */
+public class CmisProxyAuthenticationException extends CmisRuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    public CmisProxyAuthenticationException() {
+        super();
+    }
+
+    public CmisProxyAuthenticationException(String message, BigInteger code, Throwable cause)
{
+        super(message, code, cause);
+    }
+
+    public CmisProxyAuthenticationException(String message, String errorContent) {
+        super(message, errorContent);
+    }
+
+    public CmisProxyAuthenticationException(String message, BigInteger code) {
+        super(message, code);
+    }
+
+    public CmisProxyAuthenticationException(String message, BigInteger code, String errorContent)
{
+        super(message, code, errorContent);
+    }
+
+    public CmisProxyAuthenticationException(String message, String errorContent, Throwable
cause) {
+        super(message, errorContent, cause);
+    }
+
+    public CmisProxyAuthenticationException(String message, Throwable cause) {
+        super(message, BigInteger.ZERO, cause);
+    }
+
+    public CmisProxyAuthenticationException(String message) {
+        super(message, BigInteger.ZERO);
+    }
+
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.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/CmisUnauthorizedException.java?rev=1133337&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.java
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.java
Wed Jun  8 10:51:42 2011
@@ -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.commons.exceptions;
+
+import java.math.BigInteger;
+
+/**
+ * Unauthorized exception.
+ * 
+ * (This is exception is not defined in the CMIS specification and is therefore
+ * derived from {@link CmisRuntimeException}.)
+ */
+public class CmisUnauthorizedException extends CmisRuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    public CmisUnauthorizedException() {
+        super();
+    }
+
+    public CmisUnauthorizedException(String message, BigInteger code, Throwable cause) {
+        super(message, code, cause);
+    }
+
+    public CmisUnauthorizedException(String message, String errorContent) {
+        super(message, errorContent);
+    }
+
+    public CmisUnauthorizedException(String message, BigInteger code) {
+        super(message, code);
+    }
+
+    public CmisUnauthorizedException(String message, BigInteger code, String errorContent)
{
+        super(message, code, errorContent);
+    }
+
+    public CmisUnauthorizedException(String message, String errorContent, Throwable cause)
{
+        super(message, errorContent, cause);
+    }
+
+    public CmisUnauthorizedException(String message, Throwable cause) {
+        super(message, BigInteger.ZERO, cause);
+    }
+
+    public CmisUnauthorizedException(String message) {
+        super(message, BigInteger.ZERO);
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message