Merge branch 'release/2.17'
diff --git a/pom.xml b/pom.xml
index ad3e6bd..84b9ec2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
 
   <groupId>edu.psu.swe.scim</groupId>
   <artifactId>scim-parent</artifactId>
-  <version>2.16</version>
+  <version>2.17</version>
   <packaging>pom</packaging>
   <name>SCIM - Parent</name>
   <description>Penn State's Open Source JavaEE implmentation of the SCIM version 2.0 specification (RFC7642, RFC7643 and RFC7644)</description>
diff --git a/scim-client/pom.xml b/scim-client/pom.xml
index 2a6ade7..7338e5e 100644
--- a/scim-client/pom.xml
+++ b/scim-client/pom.xml
@@ -3,7 +3,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
   <artifactId>scim-client</artifactId>
   <name>SCIM - Client</name>
diff --git a/scim-common/pom.xml b/scim-common/pom.xml
index b01f2d1..601743b 100644
--- a/scim-common/pom.xml
+++ b/scim-common/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-common</artifactId>
@@ -14,12 +14,12 @@
     <dependency>
       <groupId>edu.psu.swe.scim</groupId>
       <artifactId>scim-spec-protocol</artifactId>
-      <version>2.16</version>
+      <version>2.17</version>
     </dependency>
     <dependency>
       <groupId>edu.psu.swe.scim</groupId>
       <artifactId>scim-spec-schema</artifactId>
-      <version>2.16</version>
+      <version>2.17</version>
     </dependency>
   </dependencies>
 
diff --git a/scim-compliance/pom.xml b/scim-compliance/pom.xml
index 66e167c..03d519f 100644
--- a/scim-compliance/pom.xml
+++ b/scim-compliance/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-compliance</artifactId>
diff --git a/scim-compliance/scim-compliance-client/pom.xml b/scim-compliance/scim-compliance-client/pom.xml
index 776fcc3..3202199 100644
--- a/scim-compliance/scim-compliance-client/pom.xml
+++ b/scim-compliance/scim-compliance-client/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-compliance</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-compliance-client</artifactId>
diff --git a/scim-compliance/scim-compliance-server/pom.xml b/scim-compliance/scim-compliance-server/pom.xml
index 7e23f13..df0a030 100644
--- a/scim-compliance/scim-compliance-server/pom.xml
+++ b/scim-compliance/scim-compliance-server/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-compliance</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-compliance-server</artifactId>
diff --git a/scim-errai/pom.xml b/scim-errai/pom.xml
index 699189e..46226e1 100644
--- a/scim-errai/pom.xml
+++ b/scim-errai/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-errai</artifactId>
diff --git a/scim-server/pom.xml b/scim-server/pom.xml
index d907bb2..7b39058 100644
--- a/scim-server/pom.xml
+++ b/scim-server/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-server</artifactId>
diff --git a/scim-server/scim-server-common/pom.xml b/scim-server/scim-server-common/pom.xml
index b5a46ad..c4e4d94 100644
--- a/scim-server/scim-server-common/pom.xml
+++ b/scim-server/scim-server-common/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-server-common</artifactId>
diff --git a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/SelfIdResolver.java b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/SelfIdResolver.java
new file mode 100644
index 0000000..8e2f488
--- /dev/null
+++ b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/SelfIdResolver.java
@@ -0,0 +1,9 @@
+package edu.psu.swe.scim.server.provider;
+
+import java.security.Principal;
+
+public interface SelfIdResolver {
+
+  String resolveToInternalId(Principal principal) throws UnableToResolveIdException;
+  
+}
diff --git a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UnableToResolveIdException.java b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UnableToResolveIdException.java
new file mode 100644
index 0000000..1b83309
--- /dev/null
+++ b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UnableToResolveIdException.java
@@ -0,0 +1,26 @@
+package edu.psu.swe.scim.server.provider;
+
+public class UnableToResolveIdException extends Exception {
+
+  private static final long serialVersionUID = -7401709416973728017L;
+
+  public UnableToResolveIdException() {
+  }
+
+  public UnableToResolveIdException(String message) {
+    super(message);
+  }
+
+  public UnableToResolveIdException(Throwable cause) {
+    super(cause);
+  }
+
+  public UnableToResolveIdException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+  public UnableToResolveIdException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+    super(message, cause, enableSuppression, writableStackTrace);
+  }
+
+}
diff --git a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/rest/BaseResourceTypeResourceImpl.java b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/rest/BaseResourceTypeResourceImpl.java
index d01bbc6..d66577d 100644
--- a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/rest/BaseResourceTypeResourceImpl.java
+++ b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/rest/BaseResourceTypeResourceImpl.java
@@ -505,7 +505,7 @@
   }
 
   @Override
-  public Response patch(PatchRequest patchRequest, String id, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) throws Exception {
+  public Response patch(PatchRequest patchRequest, String id, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) {
     try {
       Provider<T> provider = getProviderInternal();
 
@@ -632,6 +632,7 @@
     }
   }
 
+  @SuppressWarnings("unchecked")
   private T processFilterAttributeExtensions(Provider<T> provider, T resource, Set<AttributeReference> attributeReferences, Set<AttributeReference> excludedAttributeReferences) throws ClientFilterException {
     ScimProcessingExtension annotation = provider.getClass()
                                                  .getAnnotation(ScimProcessingExtension.class);
diff --git a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/rest/SelfResourceImpl.java b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/rest/SelfResourceImpl.java
index 79c5fe0..93de10d 100644
--- a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/rest/SelfResourceImpl.java
+++ b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/rest/SelfResourceImpl.java
@@ -1,7 +1,107 @@
 package edu.psu.swe.scim.server.rest;
 
-import edu.psu.swe.scim.spec.protocol.SelfResource;
+import java.security.Principal;
 
+import javax.annotation.Resource;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+import javax.inject.Inject;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import edu.psu.swe.scim.server.provider.ProviderRegistry;
+import edu.psu.swe.scim.server.provider.SelfIdResolver;
+import edu.psu.swe.scim.server.provider.UnableToResolveIdException;
+import edu.psu.swe.scim.spec.protocol.SelfResource;
+import edu.psu.swe.scim.spec.protocol.UserResource;
+import edu.psu.swe.scim.spec.protocol.attribute.AttributeReferenceListWrapper;
+import edu.psu.swe.scim.spec.protocol.data.ErrorResponse;
+import edu.psu.swe.scim.spec.protocol.data.PatchRequest;
+import edu.psu.swe.scim.spec.protocol.exception.ScimException;
+import edu.psu.swe.scim.spec.resources.ScimUser;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@Stateless
 public class SelfResourceImpl implements SelfResource {
 
+  @Inject
+  ProviderRegistry providerRegistry;
+
+  @Inject
+  UserResource userResource;
+
+  @Inject
+  SelfIdResolver selfIdResolver;
+
+  @Resource
+  private SessionContext sessionContext;
+
+  @Override
+  public Response getSelf(AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) {
+    try {
+      String internalId = getInternalId();
+      return userResource.getById(internalId, attributes, excludedAttributes);
+    } catch (UnableToResolveIdException | ScimException e) {
+      return createErrorResponse(e);
+    }
+  }
+
+  // @Override
+  // public Response create(ScimUser resource, AttributeReferenceListWrapper
+  // attributes, AttributeReferenceListWrapper excludedAttributes) {
+  // String internalId = getInternalId();
+  // //TODO check if ids match in request
+  // return userResourceImpl.create(resource, attributes, excludedAttributes);
+  // }
+
+  @Override
+  public Response update(ScimUser resource, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) {
+    try {
+      String internalId = getInternalId();
+      return userResource.update(resource, internalId, attributes, excludedAttributes);
+    } catch (UnableToResolveIdException | ScimException e) {
+      return createErrorResponse(e);
+    }
+  }
+
+  @Override
+  public Response patch(PatchRequest patchRequest, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) {
+    try {
+      String internalId = getInternalId();
+      return userResource.patch(patchRequest, internalId, attributes, excludedAttributes);
+    } catch (UnableToResolveIdException | ScimException e) {
+      return createErrorResponse(e);
+    }
+  }
+
+  @Override
+  public Response delete() {
+    try {
+      String internalId = getInternalId();
+      return userResource.delete(internalId);
+    } catch (UnableToResolveIdException | ScimException e) {
+      return createErrorResponse(e);
+    }
+  }
+
+  private Response createErrorResponse(Exception e) {
+    ErrorResponse er = new ErrorResponse(Status.BAD_REQUEST, "Error");
+    er.addErrorMessage(e.getMessage());
+    return er.toResponse();
+  }
+
+  private String getInternalId() throws UnableToResolveIdException {
+    Principal callerPrincipal = sessionContext.getCallerPrincipal();
+
+    if (callerPrincipal != null) {
+      log.info("Resolved SelfResource principal to : {}", callerPrincipal.getName());
+    } else {
+      throw new UnableToResolveIdException("Caller Principal was null");
+    }
+
+    String internalId = selfIdResolver.resolveToInternalId(callerPrincipal);
+    return internalId;
+  }
+
 }
diff --git a/scim-server/scim-server-example/pom.xml b/scim-server/scim-server-example/pom.xml
index 6ef1798..4068e9e 100644
--- a/scim-server/scim-server-example/pom.xml
+++ b/scim-server/scim-server-example/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-server-examples</artifactId>
diff --git a/scim-server/scim-server-example/scim-server-couchdb/pom.xml b/scim-server/scim-server-example/scim-server-couchdb/pom.xml
index fc5b75f..7101376 100644
--- a/scim-server/scim-server-example/scim-server-couchdb/pom.xml
+++ b/scim-server/scim-server-example/scim-server-couchdb/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server-examples</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-server-couchdb</artifactId>
diff --git a/scim-server/scim-server-example/scim-server-memory/pom.xml b/scim-server/scim-server-example/scim-server-memory/pom.xml
index 7339fa9..ab330c8 100644
--- a/scim-server/scim-server-example/scim-server-memory/pom.xml
+++ b/scim-server/scim-server-example/scim-server-memory/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server-examples</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-server-memory</artifactId>
diff --git a/scim-server/scim-server-example/scim-server-memory/src/main/java/edu/psu/swe/scim/memory/service/InMemorySelfResolverImpl.java b/scim-server/scim-server-example/scim-server-memory/src/main/java/edu/psu/swe/scim/memory/service/InMemorySelfResolverImpl.java
new file mode 100644
index 0000000..0b68f13
--- /dev/null
+++ b/scim-server/scim-server-example/scim-server-memory/src/main/java/edu/psu/swe/scim/memory/service/InMemorySelfResolverImpl.java
@@ -0,0 +1,18 @@
+package edu.psu.swe.scim.memory.service;
+
+import java.security.Principal;
+
+import javax.ejb.Stateless;
+
+import edu.psu.swe.scim.server.provider.SelfIdResolver;
+import edu.psu.swe.scim.server.provider.UnableToResolveIdException;
+
+@Stateless
+public class InMemorySelfResolverImpl implements SelfIdResolver {
+
+  @Override
+  public String resolveToInternalId(Principal principal) throws UnableToResolveIdException {
+    throw new UnableToResolveIdException("Caller Principal not available");
+  }
+
+}
diff --git a/scim-server/scim-server-example/scim-server-rdbms/pom.xml b/scim-server/scim-server-example/scim-server-rdbms/pom.xml
index 0af396b..7e0eb19 100644
--- a/scim-server/scim-server-example/scim-server-rdbms/pom.xml
+++ b/scim-server/scim-server-example/scim-server-rdbms/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server-examples</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-server-rdbms</artifactId>
diff --git a/scim-spec/pom.xml b/scim-spec/pom.xml
index 4c7af53..b11217c 100644
--- a/scim-spec/pom.xml
+++ b/scim-spec/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-spec</artifactId>
diff --git a/scim-spec/scim-spec-protocol/pom.xml b/scim-spec/scim-spec-protocol/pom.xml
index e030079..a13af73 100644
--- a/scim-spec/scim-spec-protocol/pom.xml
+++ b/scim-spec/scim-spec-protocol/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-spec</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-spec-protocol</artifactId>
diff --git a/scim-spec/scim-spec-protocol/src/main/java/edu/psu/swe/scim/spec/protocol/BaseResourceTypeResource.java b/scim-spec/scim-spec-protocol/src/main/java/edu/psu/swe/scim/spec/protocol/BaseResourceTypeResource.java
index 754c6b4..9e6de10 100644
--- a/scim-spec/scim-spec-protocol/src/main/java/edu/psu/swe/scim/spec/protocol/BaseResourceTypeResource.java
+++ b/scim-spec/scim-spec-protocol/src/main/java/edu/psu/swe/scim/spec/protocol/BaseResourceTypeResource.java
@@ -18,6 +18,7 @@
 import edu.psu.swe.scim.spec.protocol.data.ListResponse;
 import edu.psu.swe.scim.spec.protocol.data.PatchRequest;
 import edu.psu.swe.scim.spec.protocol.data.SearchRequest;
+import edu.psu.swe.scim.spec.protocol.exception.ScimException;
 import edu.psu.swe.scim.spec.protocol.search.SortOrder;
 import edu.psu.swe.scim.spec.resources.ScimResource;
 import io.swagger.annotations.Api;
@@ -34,6 +35,7 @@
    * @see <a href="https://tools.ietf.org/html/rfc7644#section-3.4.1">Scim spec,
    *      retrieving known resources</a>
    * @return
+   * @throws ScimException 
    * @throws UnableToRetrieveResourceException 
    */
   @GET
@@ -48,7 +50,7 @@
                 })
     default Response getById(@ApiParam(value="id", required=true) @PathParam("id") String id, 
                              @ApiParam(value="attributes", required=false) @QueryParam("attributes") AttributeReferenceListWrapper attributes,
-                             @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) throws Exception {
+                             @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) throws ScimException {
     return Response.status(Status.NOT_IMPLEMENTED).build();
   }
 
@@ -72,7 +74,7 @@
                                  @ApiParam(value="sortBy", required=false) @QueryParam("sortBy") AttributeReference sortBy,
                                  @ApiParam(value="sortOrder", required=false) @QueryParam("sortOrder") SortOrder sortOrder,
                                  @ApiParam(value="startIndex", required=false) @QueryParam("startIndex") Integer startIndex,
-                                 @ApiParam(value="count", required=false) @QueryParam("count") Integer count) throws Exception {
+                                 @ApiParam(value="count", required=false) @QueryParam("count") Integer count) throws ScimException {
     return Response.status(Status.NOT_IMPLEMENTED).build();
   }
 
@@ -88,7 +90,7 @@
   @ApiResponses(value = { @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 409, message = "Conflict"), @ApiResponse(code = 500, message = "Internal Server Error"), @ApiResponse(code = 501, message = "Not Implemented") })
   default Response create(T resource,
                           @ApiParam(value="attributes", required=false) @QueryParam("attributes") AttributeReferenceListWrapper attributes,
-                          @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) throws Exception {
+                          @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) throws ScimException {
     return Response.status(Status.NOT_IMPLEMENTED).build();
   }
 
@@ -102,7 +104,7 @@
   @Produces(Constants.SCIM_CONTENT_TYPE)
   @ApiOperation(value = "Search", produces=Constants.SCIM_CONTENT_TYPE, response = ListResponse.class, code = 200)
   @ApiResponses(value = { @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 500, message = "Internal Server Error"), @ApiResponse(code = 501, message = "Not Implemented") })
-  default Response find(SearchRequest request) throws Exception {
+  default Response find(SearchRequest request) throws ScimException {
     return Response.status(Status.NOT_IMPLEMENTED).build();
   }
 
@@ -120,7 +122,7 @@
   default Response update(T resource, 
                           @PathParam("id") String id,
                           @ApiParam(value="attributes", required=false) @QueryParam("attributes") AttributeReferenceListWrapper attributes,
-                          @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) throws Exception {
+                          @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) throws ScimException {
     return Response.status(Status.NOT_IMPLEMENTED).build();
   }
 
@@ -133,7 +135,7 @@
   default Response patch(PatchRequest patchRequest,
                          @PathParam("id") String id,
                          @ApiParam(value="attributes", required=false) @QueryParam("attributes") AttributeReferenceListWrapper attributes,
-                         @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) throws Exception {
+                         @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) throws ScimException {
     return Response.status(Status.NOT_IMPLEMENTED).build();
   }
 
@@ -141,7 +143,7 @@
   @Path("{id}")
   @ApiOperation(value = "Delete from the backing store", code = 204)
   @ApiResponses(value = { @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 404, message = "Not found"), @ApiResponse(code = 500, message = "Internal Server Error"), @ApiResponse(code = 501, message = "Not Implemented") })
-  default Response delete(@ApiParam(value = "id", required = true) @PathParam("id") String id) throws Exception {
+  default Response delete(@ApiParam(value = "id", required = true) @PathParam("id") String id) throws ScimException {
     return Response.status(Status.NOT_IMPLEMENTED).build();
   }
 }
diff --git a/scim-spec/scim-spec-protocol/src/main/java/edu/psu/swe/scim/spec/protocol/SelfResource.java b/scim-spec/scim-spec-protocol/src/main/java/edu/psu/swe/scim/spec/protocol/SelfResource.java
index 9ea7263..42f9987 100644
--- a/scim-spec/scim-spec-protocol/src/main/java/edu/psu/swe/scim/spec/protocol/SelfResource.java
+++ b/scim-spec/scim-spec-protocol/src/main/java/edu/psu/swe/scim/spec/protocol/SelfResource.java
@@ -1,10 +1,26 @@
 package edu.psu.swe.scim.spec.protocol;
 
-import io.swagger.annotations.Api;
-
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
 
+import edu.psu.swe.scim.spec.protocol.attribute.AttributeReferenceListWrapper;
+import edu.psu.swe.scim.spec.protocol.data.PatchRequest;
+import edu.psu.swe.scim.spec.resources.ScimResource;
 import edu.psu.swe.scim.spec.resources.ScimUser;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import io.swagger.jaxrs.PATCH;
 
 //@formatter:off
 /**
@@ -28,6 +44,75 @@
 
 @Path("Me")
 @Api("SCIM")
-public interface SelfResource extends BaseResourceTypeResource<ScimUser> {
-  
+public interface SelfResource {
+
+  /**
+   * @see <a href="https://tools.ietf.org/html/rfc7644#section-3.4.1">Scim spec,
+   *      retrieving known resources</a>
+   * @return
+   * @throws UnableToRetrieveResourceException 
+   */
+  @GET
+  @Produces(Constants.SCIM_CONTENT_TYPE)
+  @ApiOperation(value="Get self record", produces=Constants.SCIM_CONTENT_TYPE, response=ScimResource.class, code=200)
+  @ApiResponses(value={
+                  @ApiResponse(code=400, message="Bad Request"),
+                  @ApiResponse(code=404, message="Not found"),
+                  @ApiResponse(code=500, message="Internal Server Error"),
+                  @ApiResponse(code=501, message="Not Implemented")
+                })
+    default Response getSelf(@ApiParam(value="attributes", required=false) @QueryParam("attributes") AttributeReferenceListWrapper attributes,
+                             @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) {
+    return Response.status(Status.NOT_IMPLEMENTED).build();
+  }
+
+  /**
+   * @see <a href="https://tools.ietf.org/html/rfc7644#section-3.3">Scim spec,
+   *      query resources</a>
+   * @return
+   */
+  @POST
+  @Consumes(Constants.SCIM_CONTENT_TYPE)
+  @Produces(Constants.SCIM_CONTENT_TYPE)
+  @ApiOperation(value = "Create self record", produces=Constants.SCIM_CONTENT_TYPE, consumes=Constants.SCIM_CONTENT_TYPE, response = ScimResource.class, code = 201)
+  @ApiResponses(value = { @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 409, message = "Conflict"), @ApiResponse(code = 500, message = "Internal Server Error"), @ApiResponse(code = 501, message = "Not Implemented") })
+  default Response create(ScimUser resource,
+                          @ApiParam(value="attributes", required=false) @QueryParam("attributes") AttributeReferenceListWrapper attributes,
+                          @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) {
+    return Response.status(Status.NOT_IMPLEMENTED).build();
+  }
+
+  /**
+   * @see <a href="https://tools.ietf.org/html/rfc7644#section-3.5.1">Scim spec,
+   *      update</a>
+   * @return
+   */
+  @PUT
+  @Consumes(Constants.SCIM_CONTENT_TYPE)
+  @Produces(Constants.SCIM_CONTENT_TYPE)
+  @ApiOperation(value = "Update self record", produces=Constants.SCIM_CONTENT_TYPE, consumes=Constants.SCIM_CONTENT_TYPE, response = ScimResource.class, code = 200)
+  @ApiResponses(value = { @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 500, message = "Internal Server Error"), @ApiResponse(code = 501, message = "Not Implemented") })
+  default Response update(ScimUser resource, 
+                          @ApiParam(value="attributes", required=false) @QueryParam("attributes") AttributeReferenceListWrapper attributes,
+                          @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes) {
+    return Response.status(Status.NOT_IMPLEMENTED).build();
+  }
+
+  @PATCH
+  @Consumes(Constants.SCIM_CONTENT_TYPE)
+  @Produces(Constants.SCIM_CONTENT_TYPE)
+  @ApiOperation(value = "Patch a portion of the backing store", produces=Constants.SCIM_CONTENT_TYPE, consumes=Constants.SCIM_CONTENT_TYPE, code = 204)
+  @ApiResponses(value = { @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 404, message = "Not found"), @ApiResponse(code = 500, message = "Internal Server Error"), @ApiResponse(code = 501, message = "Not Implemented") })
+  default Response patch(PatchRequest patchRequest,
+                         @ApiParam(value="attributes", required=false) @QueryParam("attributes") AttributeReferenceListWrapper attributes,
+                         @ApiParam(value="excludedAttributes", required=false) @QueryParam("excludedAttributes") AttributeReferenceListWrapper excludedAttributes)  {
+    return Response.status(Status.NOT_IMPLEMENTED).build();
+  }
+
+  @DELETE
+  @ApiOperation(value = "Delete self record", code = 204)
+  @ApiResponses(value = { @ApiResponse(code = 400, message = "Bad Request"), @ApiResponse(code = 404, message = "Not found"), @ApiResponse(code = 500, message = "Internal Server Error"), @ApiResponse(code = 501, message = "Not Implemented") })
+  default Response delete() {
+    return Response.status(Status.NOT_IMPLEMENTED).build();
+  }
 }
diff --git a/scim-spec/scim-spec-schema/pom.xml b/scim-spec/scim-spec-schema/pom.xml
index 77106d1..c404447 100644
--- a/scim-spec/scim-spec-schema/pom.xml
+++ b/scim-spec/scim-spec-schema/pom.xml
@@ -4,7 +4,7 @@
 	<parent>
 		<groupId>edu.psu.swe.scim</groupId>
 		<artifactId>scim-spec</artifactId>
-		<version>2.16</version>
+		<version>2.17</version>
 	</parent>
 
 	<artifactId>scim-spec-schema</artifactId>
diff --git a/scim-tools/pom.xml b/scim-tools/pom.xml
index 9b9e047..c7ffbce 100644
--- a/scim-tools/pom.xml
+++ b/scim-tools/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-tools</artifactId>
diff --git a/scim-tools/scim-tools-cli/pom.xml b/scim-tools/scim-tools-cli/pom.xml
index 8b865e5..03568e5 100644
--- a/scim-tools/scim-tools-cli/pom.xml
+++ b/scim-tools/scim-tools-cli/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-tools</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-tools-cli</artifactId>
diff --git a/scim-tools/scim-tools-common/pom.xml b/scim-tools/scim-tools-common/pom.xml
index 11cb24c..06d6aad 100644
--- a/scim-tools/scim-tools-common/pom.xml
+++ b/scim-tools/scim-tools-common/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-tools</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-tools-common</artifactId>
diff --git a/scim-tools/scim-tools-studio/pom.xml b/scim-tools/scim-tools-studio/pom.xml
index 7d96296..3aff30d 100644
--- a/scim-tools/scim-tools-studio/pom.xml
+++ b/scim-tools/scim-tools-studio/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-tools</artifactId>
-    <version>2.16</version>
+    <version>2.17</version>
   </parent>
 
   <artifactId>scim-tools-studio</artifactId>