Author: matthieu
Date: Fri Dec 11 10:07:04 2015
New Revision: 1719314

URL: http://svn.apache.org/viewvc?rev=1719314&view=rev
Log:
JAMES-1644 Define AccessTokenRepository interface

Added:
    james/project/trunk/server/data/data-jmap/src/
    james/project/trunk/server/data/data-jmap/src/main/
    james/project/trunk/server/data/data-jmap/src/main/java/
    james/project/trunk/server/data/data-jmap/src/main/java/org/
    james/project/trunk/server/data/data-jmap/src/main/java/org/apache/
    james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/
    
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/
    
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/
    
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/
    
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessToken.java
    
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessTokenRepository.java
    
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/exceptions/
    
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/exceptions/AccessTokenAlreadyStored.java

Added: 
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessToken.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessToken.java?rev=1719314&view=auto
==============================================================================
--- 
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessToken.java
 (added)
+++ 
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessToken.java
 Fri Dec 11 10:07:04 2015
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.james.jmap.api.access;
+
+import java.util.Objects;
+
+public class AccessToken {
+
+    public static AccessToken fromString(String tokenString) {
+        return new AccessToken(tokenString);
+    }
+
+    private final String token;
+
+    private AccessToken(String token) {
+        this.token = token;
+    }
+
+    public String serialize() {
+        return token;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        return o != null
+            && o instanceof AccessToken
+            && Objects.equals(this.token, ((AccessToken)o).token);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(token);
+    }
+}

Added: 
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessTokenRepository.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessTokenRepository.java?rev=1719314&view=auto
==============================================================================
--- 
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessTokenRepository.java
 (added)
+++ 
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/AccessTokenRepository.java
 Fri Dec 11 10:07:04 2015
@@ -0,0 +1,32 @@
+/****************************************************************
+ * 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.james.jmap.api.access;
+
+import org.apache.james.jmap.api.access.exceptions.AccessTokenAlreadyStored;
+
+public interface AccessTokenRepository {
+
+    void addToken(AccessToken accessToken) throws AccessTokenAlreadyStored;
+
+    void removeToken(AccessToken accessToken);
+
+    boolean verifyToken(AccessToken accessToken);
+
+}

Added: 
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/exceptions/AccessTokenAlreadyStored.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/exceptions/AccessTokenAlreadyStored.java?rev=1719314&view=auto
==============================================================================
--- 
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/exceptions/AccessTokenAlreadyStored.java
 (added)
+++ 
james/project/trunk/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/access/exceptions/AccessTokenAlreadyStored.java
 Fri Dec 11 10:07:04 2015
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.james.jmap.api.access.exceptions;
+
+import org.apache.james.jmap.api.access.AccessToken;
+
+public class AccessTokenAlreadyStored extends Exception {
+
+    public AccessTokenAlreadyStored(AccessToken token) {
+        super(token.serialize() + " is already stored");
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to