You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oltu.apache.org by si...@apache.org on 2010/07/08 20:46:13 UTC
svn commit: r961875 - in
/incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server: ./
Access.java AccessStorage.java StorageException.java
TemporaryCredentialsGenerator.java TokenCredentialsGenerator.java
Author: simonetripodi
Date: Thu Jul 8 18:46:13 2010
New Revision: 961875
URL: http://svn.apache.org/viewvc?rev=961875&view=rev
Log:
started migrating server stuff
Added:
incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/
incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/Access.java (with props)
incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/AccessStorage.java (with props)
incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/StorageException.java (with props)
incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TemporaryCredentialsGenerator.java (with props)
incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TokenCredentialsGenerator.java (with props)
Added: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/Access.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/Access.java?rev=961875&view=auto
==============================================================================
--- incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/Access.java (added)
+++ incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/Access.java Thu Jul 8 18:46:13 2010
@@ -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.amber.server;
+
+import java.util.Collection;
+
+/**
+ * Association of nonce(s) and timestamp.
+ *
+ * @version $Id$
+ */
+public interface Access extends Comparable<Long> {
+
+ /**
+ * Returns the timestamp access.
+ *
+ * @return the timestamp access
+ */
+ long getTimestamp();
+
+ /**
+ * Add a nonce to an access.
+ *
+ * @param nonce the nonce has o be added.
+ * @return true, if the nonce has not used yet, false otherwise.
+ */
+ boolean addNonce(String nonce);
+
+ /**
+ * Checks if the access already contains a nonce.
+ *
+ * @param nonce the nonce has to be checked.
+ * @return true if the nonce is contained, false otherwise.
+ */
+ boolean containsNonce(String nonce);
+
+ /**
+ * Returns the whole list of nonces associated to the timestamp.
+ *
+ * @return the whole list of nonces associated to the timestamp.
+ */
+ Collection<String> getNonces();
+
+}
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/Access.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/Access.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/Access.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/AccessStorage.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/AccessStorage.java?rev=961875&view=auto
==============================================================================
--- incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/AccessStorage.java (added)
+++ incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/AccessStorage.java Thu Jul 8 18:46:13 2010
@@ -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.amber.server;
+
+/**
+ * Nonce/timestamp storage definition.
+ *
+ * @version $Id$
+ */
+public interface AccessStorage {
+
+ /**
+ * Stores a new nonce / timestamp pair associated with a consumer key.
+ *
+ * @param clientCredentials the consumer to be associated with the access.
+ * @param timestamp the timestamp of the request.
+ * @param nonce the nonce associated with the timestamp.
+ * @throws StorageException if a backend error occurs.
+ */
+ void add(String clientCredentials, long timestamp, String nonce) throws StorageException;
+
+ /**
+ * Get the last access (by timestamp) of a consumer.
+ *
+ * @param clientCredentials the consumer whose access needs to be read.
+ * @return the access object.
+ * @throws StorageException if a backend error occurs.
+ */
+ Access getLastAccess(String clientCredentials) throws StorageException;
+
+ /**
+ * Remove a consumer access.
+ *
+ * @param clientCredentials the consumer key.
+ * @param timestamp the timestamp.
+ * @throws StorageException if a backend error occurs.
+ */
+ void remove(String clientCredentials, long timestamp) throws StorageException;
+
+}
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/AccessStorage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/AccessStorage.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/AccessStorage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/StorageException.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/StorageException.java?rev=961875&view=auto
==============================================================================
--- incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/StorageException.java (added)
+++ incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/StorageException.java Thu Jul 8 18:46:13 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.amber.server;
+
+/**
+ * Exception thrown when an error occurs when accessing to the Access Storage.
+ *
+ * @version $Id$
+ */
+public final class StorageException extends Exception {
+
+ /**
+ * The default serial version UID;
+ */
+ private static final long serialVersionUID = 1L;
+
+ public StorageException(String message) {
+ super(message);
+ }
+
+ public StorageException(Throwable cause) {
+ super(cause);
+ }
+
+ public StorageException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/StorageException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/StorageException.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/StorageException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TemporaryCredentialsGenerator.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TemporaryCredentialsGenerator.java?rev=961875&view=auto
==============================================================================
--- incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TemporaryCredentialsGenerator.java (added)
+++ incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TemporaryCredentialsGenerator.java Thu Jul 8 18:46:13 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.amber.server;
+
+/**
+ * Temporary credentials generator.
+ *
+ * @version $Id$
+ */
+public interface TemporaryCredentialsGenerator {
+
+ /**
+ * Generates a new temporary credentials.
+ *
+ * @return a new temporary credentials.
+ */
+ String generate();
+
+}
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TemporaryCredentialsGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TemporaryCredentialsGenerator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TemporaryCredentialsGenerator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TokenCredentialsGenerator.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TokenCredentialsGenerator.java?rev=961875&view=auto
==============================================================================
--- incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TokenCredentialsGenerator.java (added)
+++ incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TokenCredentialsGenerator.java Thu Jul 8 18:46:13 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.amber.server;
+
+/**
+ * Token credentials generator.
+ *
+ * @version $Id$
+ */
+public interface TokenCredentialsGenerator {
+
+ /**
+ * Generates a new token credentials.
+ *
+ * @return a new token credentials.
+ */
+ String generate();
+
+}
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TokenCredentialsGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TokenCredentialsGenerator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/amber/trunk/spec-api/src/main/java/org/apache/amber/server/TokenCredentialsGenerator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain