You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2015/01/01 14:29:05 UTC

svn commit: r1648841 - in /directory/escimo/trunk/common/src/main/java/org/apache/directory/scim: ./ exception/

Author: kayyagari
Date: Thu Jan  1 13:29:04 2015
New Revision: 1648841

URL: http://svn.apache.org/r1648841
Log:
reorganized existing exceptions and added few more

Added:
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/AttributeNotFoundException.java
      - copied, changed from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/AttributeNotFoundException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/EscimoException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/InternalException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/MissingParameterException.java
      - copied, changed from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/MissingParameterException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceConflictException.java
      - copied, changed from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceConflictException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceNotFoundException.java
      - copied, changed from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceNotFoundException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceUpdateException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/UnauthorizedException.java
      - copied, changed from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/UnauthorizedException.java
Removed:
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/AttributeNotFoundException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/MissingParameterException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceConflictException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceNotFoundException.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/UnauthorizedException.java
Modified:
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceProvider.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java

Modified: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceProvider.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceProvider.java?rev=1648841&r1=1648840&r2=1648841&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceProvider.java (original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceProvider.java Thu Jan  1 13:29:04 2015
@@ -25,6 +25,9 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.UriInfo;
 
+import org.apache.directory.scim.exception.EscimoException;
+import org.apache.directory.scim.exception.MissingParameterException;
+import org.apache.directory.scim.exception.ResourceNotFoundException;
 import org.apache.directory.scim.schema.JsonSchema;
 
 import com.google.gson.JsonArray;
@@ -40,13 +43,13 @@ public interface ResourceProvider
     String SERVLET_CONTEXT_ATTRIBUTE_KEY = "ESCIMO_PROVIDER";
 
 
-    void init() throws Exception;
+    void init() throws EscimoException;
 
 
     void stop();
 
 
-    RequestContext createCtx( UriInfo uriInfo, HttpServletRequest httpReq ) throws Exception;
+    RequestContext createCtx( UriInfo uriInfo, HttpServletRequest httpReq ) throws EscimoException;
 
 
     ServerResource getResource( RequestContext ctx, String id ) throws ResourceNotFoundException;
@@ -61,22 +64,22 @@ public interface ResourceProvider
     List<JsonSchema> getJsonSchemas();
 
 
-    ServerResource addResource( String jsonData, RequestContext ctx ) throws Exception;
+    ServerResource addResource( String jsonData, RequestContext ctx ) throws EscimoException;
 
 
-    void deleteResource( String id, RequestContext ctx ) throws Exception;
+    void deleteResource( String id, RequestContext ctx ) throws EscimoException;
 
 
-    ServerResource putResource( String id, String jsonData, RequestContext ctx ) throws Exception;
+    ServerResource putResource( String id, String jsonData, RequestContext ctx ) throws EscimoException;
 
 
-    ServerResource patchResource( String id, String jsonData, RequestContext ctx ) throws Exception;
+    ServerResource patchResource( String id, String jsonData, RequestContext ctx ) throws EscimoException;
 
 
-    ListResponse search( String filter, String attributes, RequestContext ctx ) throws Exception;
+    ListResponse search( String filter, String attributes, RequestContext ctx ) throws EscimoException;
 
 
-    String authenticate( String userName, String password ) throws Exception;
+    String authenticate( String userName, String password ) throws EscimoException;
 
 
     void setAllowAuthorizedUsers( boolean allowAuthorizedUsers );

Modified: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java?rev=1648841&r1=1648840&r2=1648841&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java (original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java Thu Jan  1 13:29:04 2015
@@ -19,7 +19,11 @@
 package org.apache.directory.scim;
 
 
-import static org.apache.directory.scim.schema.ErrorCode.*;
+import static org.apache.directory.scim.schema.ErrorCode.BAD_REQUEST;
+import static org.apache.directory.scim.schema.ErrorCode.CONFLICT;
+import static org.apache.directory.scim.schema.ErrorCode.INTERNAL_SERVER_ERROR;
+import static org.apache.directory.scim.schema.ErrorCode.NOT_FOUND;
+import static org.apache.directory.scim.schema.ErrorCode.UNAUTHORIZED;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -27,6 +31,10 @@ import java.io.StringWriter;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 
+import org.apache.directory.scim.exception.AttributeNotFoundException;
+import org.apache.directory.scim.exception.ResourceConflictException;
+import org.apache.directory.scim.exception.ResourceNotFoundException;
+import org.apache.directory.scim.exception.UnauthorizedException;
 import org.apache.directory.scim.json.ResourceSerializer;
 import org.apache.directory.scim.schema.ErrorCode;
 import org.apache.directory.scim.schema.ErrorResponse;

Copied: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/AttributeNotFoundException.java (from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/AttributeNotFoundException.java)
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/AttributeNotFoundException.java?p2=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/AttributeNotFoundException.java&p1=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/AttributeNotFoundException.java&r1=1647526&r2=1648841&rev=1648841&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/AttributeNotFoundException.java (original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/AttributeNotFoundException.java Thu Jan  1 13:29:04 2015
@@ -17,7 +17,8 @@
  *   under the License.
  *
  */
-package org.apache.directory.scim;
+package org.apache.directory.scim.exception;
+
 
 /**
  * TODO AttributeNotFoundException.

Added: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/EscimoException.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/EscimoException.java?rev=1648841&view=auto
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/EscimoException.java (added)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/EscimoException.java Thu Jan  1 13:29:04 2015
@@ -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.directory.scim.exception;
+
+/**
+ * TODO EscimoException.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class EscimoException extends Exception
+{
+    public EscimoException( String message )
+    {
+        super( message );
+    }
+
+
+    public EscimoException( Throwable t )
+    {
+        super( t );
+    }
+
+
+    public EscimoException( String message, Throwable t )
+    {
+        super( message, t );
+    }
+
+}

Added: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/InternalException.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/InternalException.java?rev=1648841&view=auto
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/InternalException.java (added)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/InternalException.java Thu Jan  1 13:29:04 2015
@@ -0,0 +1,49 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.scim.exception;
+
+
+/**
+ * TODO MissingParameterException.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InternalException extends EscimoException
+{
+
+    public InternalException( String message )
+    {
+        super( message );
+    }
+
+
+    public InternalException( Throwable e )
+    {
+        super( e );
+    }
+
+
+    public InternalException( String message, Throwable e )
+    {
+        super( message, e );
+    }
+
+
+}

Copied: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/MissingParameterException.java (from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/MissingParameterException.java)
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/MissingParameterException.java?p2=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/MissingParameterException.java&p1=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/MissingParameterException.java&r1=1647526&r2=1648841&rev=1648841&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/MissingParameterException.java (original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/MissingParameterException.java Thu Jan  1 13:29:04 2015
@@ -17,7 +17,7 @@
  *   under the License.
  *
  */
-package org.apache.directory.scim;
+package org.apache.directory.scim.exception;
 
 
 /**
@@ -25,14 +25,12 @@ package org.apache.directory.scim;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class MissingParameterException extends Exception
+public class MissingParameterException extends EscimoException
 {
-    String message;
-
 
     public MissingParameterException( String message )
     {
-        this.message = message;
+        super( message );
     }
 
 
@@ -44,20 +42,8 @@ public class MissingParameterException e
 
     public MissingParameterException( String message, Throwable t )
     {
-        super( t );
-        this.message = message;
+        super( message, t );
     }
 
 
-    @Override
-    public String getMessage()
-    {
-        if ( message == null )
-        {
-            return super.getMessage();
-        }
-
-        return message;
-    }
-
 }

Copied: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceConflictException.java (from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceConflictException.java)
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceConflictException.java?p2=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceConflictException.java&p1=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceConflictException.java&r1=1647526&r2=1648841&rev=1648841&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceConflictException.java (original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceConflictException.java Thu Jan  1 13:29:04 2015
@@ -17,7 +17,7 @@
  *   under the License.
  *
  */
-package org.apache.directory.scim;
+package org.apache.directory.scim.exception;
 
 
 /**
@@ -25,7 +25,7 @@ package org.apache.directory.scim;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ResourceConflictException extends Exception
+public class ResourceConflictException extends EscimoException
 {
     public ResourceConflictException( String message )
     {

Copied: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceNotFoundException.java (from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceNotFoundException.java)
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceNotFoundException.java?p2=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceNotFoundException.java&p1=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceNotFoundException.java&r1=1647526&r2=1648841&rev=1648841&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ResourceNotFoundException.java (original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceNotFoundException.java Thu Jan  1 13:29:04 2015
@@ -17,7 +17,7 @@
  *   under the License.
  *
  */
-package org.apache.directory.scim;
+package org.apache.directory.scim.exception;
 
 
 /**
@@ -25,7 +25,7 @@ package org.apache.directory.scim;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ResourceNotFoundException extends Exception
+public class ResourceNotFoundException extends EscimoException
 {
     public ResourceNotFoundException( String message )
     {

Added: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceUpdateException.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceUpdateException.java?rev=1648841&view=auto
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceUpdateException.java (added)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/ResourceUpdateException.java Thu Jan  1 13:29:04 2015
@@ -0,0 +1,46 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.scim.exception;
+
+
+/**
+ * TODO ResourceNotFoundException.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ResourceUpdateException extends EscimoException
+{
+    public ResourceUpdateException( String message )
+    {
+        super( message );
+    }
+
+
+    public ResourceUpdateException( Throwable t )
+    {
+        super( t );
+    }
+
+
+    public ResourceUpdateException( String message, Throwable t )
+    {
+        super( message, t );
+    }
+}

Copied: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/UnauthorizedException.java (from r1647526, directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/UnauthorizedException.java)
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/UnauthorizedException.java?p2=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/UnauthorizedException.java&p1=directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/UnauthorizedException.java&r1=1647526&r2=1648841&rev=1648841&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/UnauthorizedException.java (original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/exception/UnauthorizedException.java Thu Jan  1 13:29:04 2015
@@ -17,7 +17,7 @@
  *   under the License.
  *
  */
-package org.apache.directory.scim;
+package org.apache.directory.scim.exception;
 
 
 /**
@@ -25,7 +25,7 @@ package org.apache.directory.scim;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class UnauthorizedException extends Exception
+public class UnauthorizedException extends EscimoException
 {
     public UnauthorizedException( String message )
     {