You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ja...@apache.org on 2011/07/06 16:52:55 UTC

svn commit: r1143446 - in /incubator/rave/trunk/rave-shindig: ./ src/main/java/org/apache/shindig/gadgets/ src/main/java/org/apache/shindig/gadgets/oauth/ src/main/java/org/apache/shindig/gadgets/oauth/jpa/ src/main/resources/META-INF/

Author: jasha
Date: Wed Jul  6 14:52:54 2011
New Revision: 1143446

URL: http://svn.apache.org/viewvc?rev=1143446&view=rev
Log:
RAVE-84 create tables for oauth keys & secrets (in progress)

Added:
    incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/
    incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/
    incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/
    incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerIndexDb.java
    incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerKeyAndSecretDb.java
Modified:
    incubator/rave/trunk/rave-shindig/pom.xml
    incubator/rave/trunk/rave-shindig/src/main/resources/META-INF/orm.xml

Modified: incubator/rave/trunk/rave-shindig/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/pom.xml?rev=1143446&r1=1143445&r2=1143446&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/pom.xml (original)
+++ incubator/rave/trunk/rave-shindig/pom.xml Wed Jul  6 14:52:54 2011
@@ -69,6 +69,12 @@
 
     <dependency>
       <groupId>org.apache.shindig</groupId>
+      <artifactId>shindig-gadgets</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.shindig</groupId>
       <artifactId>shindig-social-api</artifactId>
       <type>test-jar</type>
     </dependency>

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerIndexDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerIndexDb.java?rev=1143446&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerIndexDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerIndexDb.java Wed Jul  6 14:52:54 2011
@@ -0,0 +1,83 @@
+/*
+ * 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.shindig.gadgets.oauth.jpa;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+/**
+ * Db persistent store for OAuth Consumer info based on
+ * {@link org.apache.shindig.gadgets.oauth.BasicOAuthStoreConsumerIndex}
+ * <p/>
+ * TODO: set key on combination of gadgetUri & service name
+ */
+@Entity
+@Table(name = "oauth_store_consumer_index")
+public class OAuthStoreConsumerIndexDb implements DbObject {
+
+    @Id
+    @GeneratedValue(strategy = IDENTITY)
+    @Column(name = "oid")
+    private long objectId;
+
+    /**
+     * URI where the gadget is hosted, e.g. http://www.example.com/mygadget.xml
+     */
+    @Column(name = "gadget_uri", length = 512)
+    private String gadgetUri;
+
+    /**
+     * Name of the oAuth service, matches /Module/ModulePrefs/OAuth/Service/@name
+     * in a gadget definition
+     */
+    @Column(name = "service_name")
+    private String serviceName;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public long getObjectId() {
+        return objectId;
+    }
+
+    public String getGadgetUri() {
+        return gadgetUri;
+    }
+
+    public void setGadgetUri(String gadgetUri) {
+        this.gadgetUri = gadgetUri;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerKeyAndSecretDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerKeyAndSecretDb.java?rev=1143446&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerKeyAndSecretDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/gadgets/oauth/jpa/OAuthStoreConsumerKeyAndSecretDb.java Wed Jul  6 14:52:54 2011
@@ -0,0 +1,130 @@
+/*
+ * 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.shindig.gadgets.oauth.jpa;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+/**
+ * Data structure representing and OAuth consumer key and secret
+ * Based on {@link org.apache.shindig.gadgets.oauth.BasicOAuthStoreConsumerKeyAndSecret}
+ */
+@Entity
+@Table(name = "oauth_store_consumer_key_secret")
+public class OAuthStoreConsumerKeyAndSecretDb implements DbObject {
+
+    @Id
+    @GeneratedValue(strategy = IDENTITY)
+    @Column(name = "oid")
+    private long objectId;
+
+    /**
+     * Value for oauth_consumer_key
+     */
+    @Column(name = "consumer_key")
+    private String consumerKey;
+
+    /**
+     * HMAC secret, or RSA private key, depending on KeyType
+     */
+    @Column(name = "consumer_secret")
+    private String consumerSecret;
+
+    /**
+     * Type of key
+     */
+    @Enumerated(value = EnumType.STRING)
+    @Column(name = "key_type")
+    private KeyType keyType;
+
+    /**
+     * Name of public key to use with xoauth_public_key parameter.
+     * May be {@literal null}.
+     */
+    @Column(name = "key_name")
+    private String keyName;
+
+    /**
+     * Callback URL associated with this consumer key
+     * May be {@literal null}.
+     */
+    @Column(name = "callback_url")
+    private String callbackUrl;
+
+
+    public String getConsumerKey() {
+        return consumerKey;
+    }
+
+    public void setConsumerKey(String consumerKey) {
+        this.consumerKey = consumerKey;
+    }
+
+    public String getConsumerSecret() {
+        return consumerSecret;
+    }
+
+    public void setConsumerSecret(String consumerSecret) {
+        this.consumerSecret = consumerSecret;
+    }
+
+    public KeyType getKeyType() {
+        return keyType;
+    }
+
+    public void setKeyType(KeyType keyType) {
+        this.keyType = keyType;
+    }
+
+    public String getKeyName() {
+        return keyName;
+    }
+
+    public void setKeyName(String keyName) {
+        this.keyName = keyName;
+    }
+
+    public String getCallbackUrl() {
+        return callbackUrl;
+    }
+
+    public void setCallbackUrl(String callbackUrl) {
+        this.callbackUrl = callbackUrl;
+    }
+
+    public static enum KeyType {HMAC_SYMMETRIC, RSA_PRIVATE}
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public long getObjectId() {
+        return objectId;
+    }
+}

Modified: incubator/rave/trunk/rave-shindig/src/main/resources/META-INF/orm.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/resources/META-INF/orm.xml?rev=1143446&r1=1143445&r2=1143446&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/META-INF/orm.xml (original)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/META-INF/orm.xml Wed Jul  6 14:52:54 2011
@@ -84,4 +84,6 @@
   </entity>
   <entity class="org.apache.shindig.social.opensocial.jpa.ApplicationDataMapValueDb">
   </entity>
+  <entity class="org.apache.shindig.gadgets.oauth.jpa.OAuthStoreConsumerIndexDb"/>
+  <entity class="org.apache.shindig.gadgets.oauth.jpa.OAuthStoreConsumerKeyAndSecretDb"/>
 </entity-mappings>