You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by am...@apache.org on 2013/02/04 18:40:20 UTC

svn commit: r1442196 [1/2] - in /airavata/trunk: ./ modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ modules/credential-store/ modules/credential-store/scripts/ modules/credential-store/src/ modules/credential-store/src/main/ modul...

Author: amilaj
Date: Mon Feb  4 17:40:18 2013
New Revision: 1442196

URL: http://svn.apache.org/viewvc?rev=1442196&view=rev
Log:
Adding credential-store to repository

Added:
    airavata/trunk/modules/credential-store/
    airavata/trunk/modules/credential-store/airavata-credential-store.iml
    airavata/trunk/modules/credential-store/pom.xml
    airavata/trunk/modules/credential-store/scripts/
    airavata/trunk/modules/credential-store/scripts/credential-store-h2.sql
    airavata/trunk/modules/credential-store/scripts/credential-store-mysql.sql
    airavata/trunk/modules/credential-store/src/
    airavata/trunk/modules/credential-store/src/main/
    airavata/trunk/modules/credential-store/src/main/java/
    airavata/trunk/modules/credential-store/src/main/java/org/
    airavata/trunk/modules/credential-store/src/main/java/org/apache/
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/AuditInfo.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CertificateCredential.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CommunityUser.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/Credential.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStore.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStoreException.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialWriter.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CertificateCredentialWriter.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CredentialStoreImpl.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CommunityUserDAO.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CredentialsDAO.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/ParentDAO.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreOA4MPServer.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/util/
    airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java
    airavata/trunk/modules/credential-store/src/test/
    airavata/trunk/modules/credential-store/src/test/java/
    airavata/trunk/modules/credential-store/src/test/java/org/
    airavata/trunk/modules/credential-store/src/test/java/org/apache/
    airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/
    airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/
    airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/
    airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/impl/
    airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/impl/db/
    airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/impl/db/CommunityUserDAOTest.java
    airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/impl/db/CredentialsDAOTest.java
    airavata/trunk/modules/credential-store/src/test/resources/
    airavata/trunk/modules/credential-store/src/test/resources/keystore.jks   (with props)
    airavata/trunk/modules/rest/webapp/src/main/webapp/acs/
    airavata/trunk/modules/rest/webapp/src/main/webapp/credential-store/
Modified:
    airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java
    airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java
    airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
    airavata/trunk/modules/distribution/airavata-server/src/main/resources/bin/data.sql
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
    airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/local/LocalUserStore.java
    airavata/trunk/modules/rest/service/src/test/java/org/apache/airavata/services/registry/rest/security/local/LocalUserStoreTest.java
    airavata/trunk/modules/rest/webapp/pom.xml
    airavata/trunk/modules/rest/webapp/src/main/webapp/WEB-INF/web.xml
    airavata/trunk/modules/security/src/main/java/org/apache/airavata/security/userstore/JDBCUserStore.java
    airavata/trunk/modules/security/src/main/java/org/apache/airavata/security/userstore/SessionDBUserStore.java
    airavata/trunk/modules/security/src/test/java/org/apache/airavata/security/configurations/AuthenticatorConfigurationReaderTest.java
    airavata/trunk/modules/security/src/test/resources/authenticators.xml
    airavata/trunk/modules/security/src/test/resources/disabled-authenticator.xml
    airavata/trunk/pom.xml

Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java?rev=1442196&r1=1442195&r2=1442196&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java (original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java Mon Feb  4 17:40:18 2013
@@ -25,7 +25,6 @@ import org.apache.commons.dbcp.BasicData
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.servlet.ServletContext;
 import javax.sql.DataSource;
 import java.sql.*;
 import java.util.Properties;
@@ -44,12 +43,15 @@ public class DBUtil {
 
     private Properties properties;
 
-    public DBUtil(String jdbcUrl, String userName, String password, String driver) {
+    public DBUtil(String jdbcUrl, String userName, String password, String driver) throws InstantiationException,
+            IllegalAccessException, ClassNotFoundException {
 
         this.jdbcUrl = jdbcUrl;
         this.databaseUserName = userName;
         this.databasePassword = password;
         this.driverName = driver;
+
+        init();
     }
 
     /**
@@ -62,7 +64,7 @@ public class DBUtil {
      * @throws IllegalAccessException
      *             If security does not allow users to instantiate driver object.
      */
-    public void init() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+    private void init() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
         properties = new Properties();
 
         properties.put("user", databaseUserName);
@@ -253,19 +255,17 @@ public class DBUtil {
 
     /**
      * Creates a DBUtil object based on servlet context configurations.
-     * 
-     * @param servletContext
-     *            The servlet context.
+     *
      * @return DBUtil object.
      * @throws Exception
      *             If an error occurred while reading configurations or while creating database object.
      */
-    public static DBUtil getDBUtil(ServletContext servletContext) throws Exception {
+    public static DBUtil getDBUtil() throws Exception{
 
-        String jdbcUrl = servletContext.getInitParameter("credential-store-jdbc-url");
-        String userName = servletContext.getInitParameter("credential-store-db-user");
-        String password = servletContext.getInitParameter("credential-store-db-password");
-        String driverName = servletContext.getInitParameter("credential-store-db-driver");
+        String jdbcUrl = ServerSettings.getCredentialStoreDBURL();
+        String userName = ServerSettings.getCredentialStoreDBUser();
+        String password = ServerSettings.getCredentialStoreDBPassword();
+        String driverName = ServerSettings.getCredentialStoreDBDriver();
 
         StringBuilder stringBuilder = new StringBuilder("Starting credential store, connecting to database - ");
         stringBuilder.append(jdbcUrl).append(" DB user - ").append(userName).append(" driver name - ")

Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java?rev=1442196&r1=1442195&r2=1442196&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java (original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java Mon Feb  4 17:40:18 2013
@@ -67,12 +67,20 @@ public class DatabaseTestCases {
     }
 
     public static void waitTillServerStarts() {
-        DBUtil dbUtil = new DBUtil(getJDBCUrl(), getUserName(), getPassword(), getDriver());
+        DBUtil dbUtil = null;
+
+        try {
+            dbUtil = new DBUtil(getJDBCUrl(), getUserName(), getPassword(), getDriver());
+        } catch (Exception e) {
+           // ignore
+        }
 
         Connection connection = null;
         try {
-            connection = dbUtil.getConnection();
-        } catch (SQLException e) {
+            if (dbUtil != null) {
+                connection = dbUtil.getConnection();
+            }
+        } catch (Throwable e) {
             // ignore
         }
 
@@ -80,7 +88,9 @@ public class DatabaseTestCases {
             try {
                 Thread.sleep(1000);
                 try {
-                    connection = dbUtil.getConnection();
+                    if (dbUtil != null) {
+                        connection = dbUtil.getConnection();
+                    }
                 } catch (SQLException e) {
                     // ignore
                 }
@@ -96,4 +106,9 @@ public class DatabaseTestCases {
         dbUtil.executeSQL(sql);
     }
 
+    protected DBUtil getDbUtil () throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+        return new DBUtil(getJDBCUrl(), getUserName(), getPassword(), getDriver());
+
+    }
+
 }

Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java?rev=1442196&r1=1442195&r2=1442196&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java (original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java Mon Feb  4 17:40:18 2013
@@ -45,8 +45,18 @@ public class ServerSettings extends Appl
     private static final String TOMCAT_PORT = "port";
     private static final String SERVER_CONTEXT_ROOT="server.context-root";
     private static String tomcatPort=null;
-    
-	public static String getDefaultGatewayId()throws ApplicationSettingsException{
+
+    private static final String CREDENTIAL_STORE_DB_URL ="credential.store.jdbc.url";
+    private static final String CREDENTIAL_STORE_DB_USER ="credential.store.jdbc.user";
+    private static final String CREDENTIAL_STORE_DB_PASSWORD ="credential.store.jdbc.password";
+    private static final String CREDENTIAL_STORE_DB_DRIVER ="credential.store.jdbc.driver";
+
+    private static final String REGISTRY_DB_URL ="registry.jdbc.url";
+    private static final String REGISTRY_DB_USER ="registry.jdbc.user";
+    private static final String REGISTRY_DB_PASSWORD ="registry.jdbc.password";
+    private static final String REGISTRY_DB_DRIVER ="registry.jdbc.driver";
+
+    public static String getDefaultGatewayId()throws ApplicationSettingsException{
     	return getSetting(DEFAULT_GATEWAY_ID);
     }
     
@@ -65,6 +75,39 @@ public class ServerSettings extends Appl
     public static String getServerContextRoot(){
     	return getSetting(SERVER_CONTEXT_ROOT,"axis2");
     }
+
+    public static String getCredentialStoreDBUser() throws ApplicationSettingsException {
+        try {
+            return getSetting(CREDENTIAL_STORE_DB_USER);
+        } catch (ApplicationSettingsException e) {
+            return getSetting(REGISTRY_DB_USER);
+        }
+    }
+
+    public static String getCredentialStoreDBPassword() throws ApplicationSettingsException {
+        try {
+            return getSetting(CREDENTIAL_STORE_DB_PASSWORD);
+        } catch (ApplicationSettingsException e) {
+            return getSetting(REGISTRY_DB_PASSWORD);
+        }
+    }
+
+    public static String getCredentialStoreDBDriver() throws ApplicationSettingsException {
+        try {
+            return getSetting(CREDENTIAL_STORE_DB_DRIVER);
+        } catch (ApplicationSettingsException e) {
+            return getSetting(REGISTRY_DB_DRIVER);
+        }
+    }
+
+    public static String getCredentialStoreDBURL() throws ApplicationSettingsException {
+        try {
+            return getSetting(CREDENTIAL_STORE_DB_URL);
+        } catch (ApplicationSettingsException e) {
+            return getSetting(REGISTRY_DB_URL);
+        }
+
+    }
     
     public static String getTomcatPort() throws ApplicationSettingsException {
     	if (tomcatPort==null) {

Added: airavata/trunk/modules/credential-store/airavata-credential-store.iml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/airavata-credential-store.iml?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/airavata-credential-store.iml (added)
+++ airavata/trunk/modules/credential-store/airavata-credential-store.iml Mon Feb  4 17:40:18 2013
@@ -0,0 +1,682 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="false" type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/target/maven-shared-archive-resources" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/target/maven-shared-archive-resources" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/target/classes" />
+      <excludeFolder url="file://$MODULE_DIR$/target/generated-sources" />
+      <excludeFolder url="file://$MODULE_DIR$/target/maven-archiver" />
+      <excludeFolder url="file://$MODULE_DIR$/target/surefire" />
+      <excludeFolder url="file://$MODULE_DIR$/target/surefire-reports" />
+      <excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="airavata-common-utils" />
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/xmlbeans/xmlbeans/2.5.0/xmlbeans-2.5.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/stax/stax-api/1.0.1/stax-api-1.0.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/xpp3/xpp3/1.1.3_7/xpp3-1.1.3_7.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/xpp5/xpp5/1.2.6/xpp5-1.2.6.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/xsul/xsul/2.10.5_b/xsul-2.10.5_b.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/xsul5-ogce/xsul5-2007-02-27/1/xsul5-2007-02-27-1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/axis2/axis2-kernel/1.5.1/axis2-kernel-1.5.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/ws/commons/axiom/axiom-api/1.2.8/axiom-api-1.2.8.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/geronimo/specs/geronimo-activation_1.1_spec/1.0.1/geronimo-activation_1.1_spec-1.0.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.2/geronimo-javamail_1.4_spec-1.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/jaxen/jaxen/1.1.1/jaxen-1.1.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/geronimo/specs/geronimo-stax-api_1.0_spec/1.0.1/geronimo-stax-api_1.0_spec-1.0.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/ws/commons/axiom/axiom-impl/1.2.8/axiom-impl-1.2.8.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/codehaus/woodstox/wstx-asl/3.2.4/wstx-asl-3.2.4.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/ws/commons/axiom/axiom-dom/1.2.8/axiom-dom-1.2.8.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/geronimo/specs/geronimo-ws-metadata_2.0_spec/1.1.2/geronimo-ws-metadata_2.0_spec-1.1.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1/geronimo-jta_1.1_spec-1.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.2/commons-codec-1.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/ws/commons/schema/XmlSchema/1.4.3/XmlSchema-1.4.3.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/neethi/neethi/2.0.4/neethi-2.0.4.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/woden/woden-api/1.0M8/woden-api-1.0M8.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/ant/ant/1.7.0/ant-1.7.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/xerces/xmlParserAPIs/2.6.0/xmlParserAPIs-2.6.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/woden/woden-impl-dom/1.0M8/woden-impl-dom-1.0M8.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/javax/mail/mail/1.4/mail-1.4.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/javax/activation/activation/1.1/activation-1.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/xalan/xalan/2.7.0/xalan-2.7.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/1.4/commons-io-1.4.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.2/slf4j-api-1.7.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/derby/derby/10.9.1.0/derby-10.9.1.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/derby/derbyclient/10.9.1.0/derbyclient-10.9.1.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/derby/derbynet/10.9.1.0/derbynet-10.9.1.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/derby/derbytools/10.9.1.0/derbytools-10.9.1.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/embed/tomcat-embed-core/7.0.22/tomcat-embed-core-7.0.22.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/myproxy/oa4mp-client-api/1.0.6-SNAPSHOT/oa4mp-client-api-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/security/delegation/ncsa-security-delegation-client/1.0.6-SNAPSHOT/ncsa-security-delegation-client-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/security/ncsa-security-util/1.0.6-SNAPSHOT/ncsa-security-util-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/security/ncsa-security-core/1.0.6-SNAPSHOT/ncsa-security-core-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-configuration/commons-configuration/1.7/commons-configuration-1.7.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/javax/inject/javax.inject/1/javax.inject-1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.16/log4j-1.2.16.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/commons-cli/commons-cli/1.2/commons-cli-1.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/bouncycastle/bcprov-jdk16/1.46/bcprov-jdk16-1.46.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.1/httpclient-4.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/security/delegation/ncsa-security-delegation-common/1.0.6-SNAPSHOT/ncsa-security-delegation-common-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/security/ncsa-security-storage/1.0.6-SNAPSHOT/ncsa-security-storage-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/security/ncsa-security-servlet/1.0.6-SNAPSHOT/ncsa-security-servlet-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.7/junit-4.7.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/myproxy/oa4mp-client-oauth1/1.0.6-SNAPSHOT/oa4mp-client-oauth1-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/myproxy/myproxy-logon/1.4.6-SNAPSHOT/myproxy-logon-1.4.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.17/mysql-connector-java-5.1.17.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/postgresql/postgresql/8.4-702.jdbc3/postgresql-8.4-702.jdbc3.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/security/delegation/ncsa-security-oauth-1.0a/1.0.6-SNAPSHOT/ncsa-security-oauth-1.0a-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/edu/uiuc/ncsa/security/delegation/ncsa-security-delegation-server/1.0.6-SNAPSHOT/ncsa-security-delegation-server-1.0.6-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/net/oauth/core/oauth-httpclient4/20090617/oauth-httpclient4-20090617.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/net/oauth/core/oauth-consumer/20100527/oauth-consumer-20100527.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/net/oauth/core/oauth/20100527/oauth-20100527.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/net/oauth/core/oauth-provider/20100527/oauth-provider-20100527.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+  </component>
+</module>
+

Added: airavata/trunk/modules/credential-store/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/pom.xml?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/pom.xml (added)
+++ airavata/trunk/modules/credential-store/pom.xml Mon Feb  4 17:40:18 2013
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--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. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>airavata</artifactId>
+        <version>0.7-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>airavata-credential-store</artifactId>
+    <name>Airavata Credential Store</name>
+    <description>Module to manage credentials</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>edu.uiuc.ncsa.myproxy</groupId>
+            <artifactId>oa4mp-client-api</artifactId>
+            <version>${oa4mp.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>edu.uiuc.ncsa.myproxy</groupId>
+            <artifactId>oa4mp-client-oauth1</artifactId>
+            <version>${oa4mp.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.7</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>${derby.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbyclient</artifactId>
+            <version>${derby.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbynet</artifactId>
+            <version>${derby.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbytools</artifactId>
+            <version>${derby.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-dbcp</groupId>
+            <artifactId>commons-dbcp</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-common-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>${surefire.version}</version>
+                <configuration>
+                    <systemPropertyVariables>
+                        <credential.module.directory>${basedir}</credential.module.directory>
+                    </systemPropertyVariables>
+                    <excludes>
+                        <exclude>**/DAOBaseTestCase.java</exclude>
+                        <exclude>**/MappingDAOTest.java</exclude>
+                    </excludes>
+                    <testSourceDirectory>${basedir}\src\test\java\</testSourceDirectory>
+                </configuration>
+            </plugin>
+
+        </plugins>
+        <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
+        <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
+        <testResources>
+            <testResource>
+                <directory>${project.basedir}/src/test/resources</directory>
+            </testResource>
+        </testResources>
+    </build>
+
+    <properties>
+        <oa4mp.version>1.0.6-SNAPSHOT</oa4mp.version>
+    </properties>
+
+</project>

Added: airavata/trunk/modules/credential-store/scripts/credential-store-h2.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/scripts/credential-store-h2.sql?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/scripts/credential-store-h2.sql (added)
+++ airavata/trunk/modules/credential-store/scripts/credential-store-h2.sql Mon Feb  4 17:40:18 2013
@@ -0,0 +1,22 @@
+CREATE TABLE COMMUNITY_USER
+(
+	GATEWAY_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);
+
+
+CREATE TABLE CREDENTIALS
+(
+	GATEWAY_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+	CREDENTIAL CLOB NOT NULL,
+	PRIVATE_KEY CLOB NOT NULL,
+	NOT_BEFORE VARCHAR(256) NOT NULL,
+	NOT_AFTER VARCHAR(256) NOT NULL,
+	LIFETIME MEDIUMINT NOT NULL,
+	REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,
+	REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);
\ No newline at end of file

Added: airavata/trunk/modules/credential-store/scripts/credential-store-mysql.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/scripts/credential-store-mysql.sql?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/scripts/credential-store-mysql.sql (added)
+++ airavata/trunk/modules/credential-store/scripts/credential-store-mysql.sql Mon Feb  4 17:40:18 2013
@@ -0,0 +1,22 @@
+CREATE TABLE COMMUNITY_USER
+(
+	GATEWAY_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);
+
+
+CREATE TABLE CREDENTIALS
+(
+	GATEWAY_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+	CREDENTIAL TEXT NOT NULL,
+	PRIVATE_KEY TEXT NOT NULL,
+	NOT_BEFORE VARCHAR(256) NOT NULL,
+	NOT_AFTER VARCHAR(256) NOT NULL,
+	LIFETIME MEDIUMINT NOT NULL,
+	REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,
+	REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/AuditInfo.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/AuditInfo.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/AuditInfo.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/AuditInfo.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,78 @@
+package org.apache.airavata.credential.store;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Audit information related to community credential.
+ */
+@XmlRootElement
+public class AuditInfo implements Serializable {
+
+    private static final long serialVersionUID = 13213123L;
+
+    private String gatewayName;
+    private String communityUserName;
+    private String portalUserName;
+    private Date credentialsRequestedTime;
+    private String notBefore;
+    private String notAfter;
+    private long credentialLifeTime;
+
+    public String getGatewayName() {
+        return gatewayName;
+    }
+
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
+    }
+
+    public String getCommunityUserName() {
+        return communityUserName;
+    }
+
+    public void setCommunityUserName(String communityUserName) {
+        this.communityUserName = communityUserName;
+    }
+
+    public String getPortalUserName() {
+        return portalUserName;
+    }
+
+    public void setPortalUserName(String portalUserName) {
+        this.portalUserName = portalUserName;
+    }
+
+    public Date getCredentialsRequestedTime() {
+        return credentialsRequestedTime;
+    }
+
+    public void setCredentialsRequestedTime(Date credentialsRequestedTime) {
+        this.credentialsRequestedTime = credentialsRequestedTime;
+    }
+
+    public String getNotBefore() {
+        return notBefore;
+    }
+
+    public void setNotBefore(String notBefore) {
+        this.notBefore = notBefore;
+    }
+
+    public String getNotAfter() {
+        return notAfter;
+    }
+
+    public void setNotAfter(String notAfter) {
+        this.notAfter = notAfter;
+    }
+
+    public long getCredentialLifeTime() {
+        return credentialLifeTime;
+    }
+
+    public void setCredentialLifeTime(long credentialLifeTime) {
+        this.credentialLifeTime = credentialLifeTime;
+    }
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CertificateCredential.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CertificateCredential.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CertificateCredential.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CertificateCredential.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,99 @@
+package org.apache.airavata.credential.store;
+
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+import java.util.Date;
+
+/**
+ * Represents the certificate credentials.
+ */
+public class CertificateCredential implements Credential {
+
+    public CertificateCredential() {
+
+    }
+
+    /**
+     * The community user associated with this credentials.
+     */
+    private CommunityUser communityUser;
+
+    private X509Certificate certificate;
+
+    public PrivateKey getPrivateKey() {
+        return privateKey;
+    }
+
+    public void setPrivateKey(PrivateKey privateKey) {
+        this.privateKey = privateKey;
+    }
+
+    private PrivateKey privateKey;
+
+    private long lifeTime;
+
+    private String portalUserName;
+
+    private String notBefore;
+
+    public String getNotBefore() {
+        return notBefore;
+    }
+
+    public void setNotBefore(String notBefore) {
+        this.notBefore = notBefore;
+    }
+
+    public String getNotAfter() {
+        return notAfter;
+    }
+
+    public void setNotAfter(String notAfter) {
+        this.notAfter = notAfter;
+    }
+
+    private String notAfter;
+
+    public Date getCertificateRequestedTime() {
+        return certificateRequestedTime;
+    }
+
+    public void setCertificateRequestedTime(Date certificateRequestedTime) {
+        this.certificateRequestedTime = certificateRequestedTime;
+    }
+
+    private Date certificateRequestedTime;
+
+    public X509Certificate getCertificate() {
+        return certificate;
+    }
+
+    public void setCertificate(X509Certificate certificate) {
+        this.certificate = certificate;
+    }
+
+    public long getLifeTime() {
+        return lifeTime;
+    }
+
+    public void setLifeTime(long lifeTime) {
+        this.lifeTime = lifeTime;
+    }
+
+    public String getPortalUserName() {
+        return portalUserName;
+    }
+
+    public void setPortalUserName(String portalUserName) {
+        this.portalUserName = portalUserName;
+    }
+
+    public CommunityUser getCommunityUser() {
+        return communityUser;
+    }
+
+    public void setCommunityUser(CommunityUser communityUser) {
+        this.communityUser = communityUser;
+    }
+
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CommunityUser.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CommunityUser.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CommunityUser.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CommunityUser.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,46 @@
+package org.apache.airavata.credential.store;
+
+/**
+ * Represents the community user.
+ */
+public class CommunityUser {
+
+    private String gatewayName;
+    private String userName;
+    private String userEmail;
+
+    public String getGatewayName() {
+        return gatewayName;
+    }
+
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
+    }
+
+    public String getUserEmail() {
+        return userEmail;
+    }
+
+    public void setUserEmail(String userEmail) {
+        this.userEmail = userEmail;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public CommunityUser(String gatewayName, String userName, String userEmail) {
+        this.gatewayName = gatewayName;
+        this.userName = userName;
+        this.userEmail = userEmail;
+    }
+
+    public CommunityUser(String gatewayName, String userName) {
+        this.gatewayName = gatewayName;
+        this.userName = userName;
+    }
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/Credential.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/Credential.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/Credential.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/Credential.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,10 @@
+package org.apache.airavata.credential.store;
+
+import java.io.Serializable;
+
+/**
+ * This class represents the actual credential. The credential can be a certificate, user name password
+ * or a SSH key. As per now we only have certificate implementation.
+ */
+public interface Credential {
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStore.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStore.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStore.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStore.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,44 @@
+package org.apache.airavata.credential.store;
+
+/**
+ * This interface provides an API for Credential Store.
+ * Provides methods to manipulate credential store data.
+ */
+public interface CredentialStore {
+
+    /**
+     * Gets the admin portal user name who  retrieved given community user for
+     * given portal user name.
+     * @param gatewayName The gateway name
+     * @param communityUser The community user name.
+     * @return The portal user name who requested given community user credentials.
+     */
+    String getPortalUser(String gatewayName, String communityUser) throws CredentialStoreException;
+
+    /**
+     * Gets audit information related to given gateway name and community
+     * user name.
+     * @param gatewayName The gateway name.
+     * @param communityUser The community user name.
+     * @return AuditInfo object.
+     */
+    AuditInfo getAuditInfo(String gatewayName, String communityUser) throws CredentialStoreException;
+
+    /**
+     * Updates the community user contact email address.
+     * @param gatewayName The gateway name.
+     * @param communityUser The community user name.
+     * @param email The new email address.
+     */
+    void updateCommunityUserEmail(String gatewayName, String communityUser, String email) throws CredentialStoreException;
+
+    /**
+     * Will remove credentials for the given gateway id and community user.
+     * @param gatewayName The gateway Id
+     * @param communityUser The community user name.
+     * @throws CredentialStoreException If an error occurred while retrieving data.
+     */
+    void removeCredentials(String gatewayName, String communityUser) throws CredentialStoreException;
+
+
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStoreException.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStoreException.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStoreException.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStoreException.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,19 @@
+package org.apache.airavata.credential.store;
+
+/**
+ * An exception class for credential store.
+ */
+public class CredentialStoreException extends Exception {
+
+    public CredentialStoreException() {
+        super();
+    }
+
+    public CredentialStoreException(String s) {
+        super(s);
+    }
+
+    public CredentialStoreException(String s, Throwable throwable) {
+        super(s, throwable);
+    }
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialWriter.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialWriter.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialWriter.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialWriter.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,20 @@
+package org.apache.airavata.credential.store;
+
+/**
+ * The entity who's writing credentials to DB will use this interface.
+ */
+public interface CredentialWriter {
+
+    /**
+     * Writes given credentials to a persistent storage.
+     * @param credential The credentials implementation.
+     */
+    void writeCredentials(Credential credential) throws CredentialStoreException;
+
+    /**
+     * Writes community user information.
+     * @param communityUser Writes community user information to a persistent storage.
+     * @throws CredentialStoreException If an error occurred while writing community user.
+     */
+    void writeCommunityUser(CommunityUser communityUser) throws CredentialStoreException;
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CertificateCredentialWriter.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CertificateCredentialWriter.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CertificateCredentialWriter.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CertificateCredentialWriter.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,48 @@
+package org.apache.airavata.credential.store.impl;
+
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.credential.store.*;
+import org.apache.airavata.credential.store.impl.db.CommunityUserDAO;
+import org.apache.airavata.credential.store.impl.db.CredentialsDAO;
+
+/**
+ * Writes certificate credentials to database.
+ */
+public class CertificateCredentialWriter implements CredentialWriter {
+
+    private CredentialsDAO credentialsDAO;
+    private CommunityUserDAO communityUserDAO;
+
+    public CertificateCredentialWriter(DBUtil dbUtil) {
+        credentialsDAO = new CredentialsDAO(dbUtil);
+        communityUserDAO = new CommunityUserDAO(dbUtil);
+    }
+
+    @Override
+    public void writeCredentials(Credential credential) throws CredentialStoreException {
+
+        CertificateCredential certificateCredential = (CertificateCredential)credential;
+
+        // Write community user
+        writeCommunityUser(certificateCredential.getCommunityUser());
+
+        // First delete existing credentials
+        credentialsDAO.deleteCredentials(certificateCredential.getCommunityUser().getGatewayName(),
+                certificateCredential.getCommunityUser().getUserName());
+
+        // Add the new certificate
+        CertificateCredential certificateCredentials = (CertificateCredential)credential;
+        credentialsDAO.addCredentials(certificateCredentials);
+    }
+
+    @Override
+    public void writeCommunityUser(CommunityUser communityUser) throws CredentialStoreException {
+
+        // First delete existing community user
+        communityUserDAO.deleteCommunityUser(communityUser);
+
+        // Persist new community user
+        communityUserDAO.addCommunityUser(communityUser);
+
+    }
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CredentialStoreImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CredentialStoreImpl.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CredentialStoreImpl.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CredentialStoreImpl.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,66 @@
+package org.apache.airavata.credential.store.impl;
+
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.credential.store.*;
+import org.apache.airavata.credential.store.impl.db.CommunityUserDAO;
+import org.apache.airavata.credential.store.impl.db.CredentialsDAO;
+
+import java.io.Serializable;
+
+
+/**
+ * Credential store API implementation.
+ */
+public class CredentialStoreImpl implements CredentialStore, Serializable {
+
+    private CommunityUserDAO communityUserDAO;
+    private CredentialsDAO credentialsDAO;
+
+    public CredentialStoreImpl(DBUtil dbUtil) {
+
+        this.communityUserDAO = new CommunityUserDAO(dbUtil);
+        this.credentialsDAO = new CredentialsDAO(dbUtil);
+    }
+
+    @Override
+    public String getPortalUser(String gatewayName, String communityUser) throws CredentialStoreException {
+        CertificateCredential certificateCredential
+                = this.credentialsDAO.getCredential(gatewayName, communityUser);
+        return certificateCredential.getPortalUserName();
+    }
+
+    @Override
+    public AuditInfo getAuditInfo(String gatewayName, String communityUser)
+            throws CredentialStoreException {
+
+        CertificateCredential certificateCredential
+                = this.credentialsDAO.getCredential(gatewayName, communityUser);
+
+        AuditInfo auditInfo = new AuditInfo();
+
+        CommunityUser retrievedUser = certificateCredential.getCommunityUser();
+        auditInfo.setCommunityUserName(retrievedUser.getUserName());
+        auditInfo.setCredentialLifeTime(certificateCredential.getLifeTime());
+        auditInfo.setCredentialsRequestedTime(certificateCredential.getCertificateRequestedTime());
+        auditInfo.setGatewayName(gatewayName);
+        auditInfo.setNotAfter(certificateCredential.getNotAfter());
+        auditInfo.setNotBefore(certificateCredential.getNotBefore());
+        auditInfo.setPortalUserName(certificateCredential.getPortalUserName());
+
+        return auditInfo;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void updateCommunityUserEmail(String gatewayName, String communityUser, String email) throws CredentialStoreException {
+        this.communityUserDAO.updateCommunityUser(
+                new CommunityUser(gatewayName, communityUser, email));
+    }
+
+    @Override
+    public void removeCredentials(String gatewayName, String communityUser) throws CredentialStoreException {
+        credentialsDAO.deleteCredentials(gatewayName, communityUser);
+    }
+
+
+
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CommunityUserDAO.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CommunityUserDAO.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CommunityUserDAO.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CommunityUserDAO.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,173 @@
+package org.apache.airavata.credential.store.impl.db;
+
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.credential.store.CommunityUser;
+import org.apache.airavata.credential.store.CredentialStoreException;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Data access class for community_user table.
+ */
+public class CommunityUserDAO extends ParentDAO {
+
+    public CommunityUserDAO(DBUtil dbUtil) {
+        super(dbUtil);
+    }
+
+    public void addCommunityUser(CommunityUser user) throws CredentialStoreException {
+
+        String sql = "insert into community_user values (?, ?, ?)";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, user.getGatewayName());
+            preparedStatement.setString(2, user.getUserName());
+            preparedStatement.setString(3, user.getUserEmail());
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error persisting community user.");
+            stringBuilder.append("gateway - ").append(user.getGatewayName());
+            stringBuilder.append("community user name - ").append(user.getUserName());
+            stringBuilder.append("community user email - ").append(user.getUserEmail());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+    }
+
+
+    public void deleteCommunityUser(CommunityUser user) throws CredentialStoreException {
+
+        String sql = "delete from community_user where gateway_name=? and community_user_name=?";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, user.getGatewayName());
+            preparedStatement.setString(2, user.getUserName());
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error deleting community user.");
+            stringBuilder.append("gateway - ").append(user.getGatewayName());
+            stringBuilder.append("community user name - ").append(user.getUserName());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+    }
+
+    public void updateCommunityUser(CommunityUser user) throws CredentialStoreException {
+
+        //TODO
+    }
+
+    public CommunityUser getCommunityUser(String gatewayName, String communityUserName) throws CredentialStoreException{
+
+        String sql = "select * from community_user where gateway_name=? and community_user_name=?";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+            preparedStatement.setString(2, communityUserName);
+
+            ResultSet resultSet = preparedStatement.executeQuery();
+
+            if (resultSet.next()) {
+                String email = resultSet.getString("COMMUNITY_USER_EMAIL");  //TODO fix typo
+
+                return new CommunityUser(gatewayName, communityUserName, email);
+
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving community user.");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("community user name - ").append(communityUserName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+
+        return null;
+    }
+
+    public List<CommunityUser> getCommunityUsers(String gatewayName)
+            throws CredentialStoreException{
+
+        List<CommunityUser> userList = new ArrayList<CommunityUser>();
+
+        String sql = "select * from community_user where gateway_name=?";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+
+            ResultSet resultSet = preparedStatement.executeQuery();
+
+            while (resultSet.next()) {
+                String userName = resultSet.getString("COMMUNITY_USER_NAME");
+                String email = resultSet.getString("COMMUNITY_USER_EMAIL");  //TODO fix typo
+
+                userList.add(new CommunityUser(gatewayName, userName, email));
+
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving community users for ");
+            stringBuilder.append("gateway - ").append(gatewayName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+
+        return userList;
+    }
+
+
+}

Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CredentialsDAO.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CredentialsDAO.java?rev=1442196&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CredentialsDAO.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/db/CredentialsDAO.java Mon Feb  4 17:40:18 2013
@@ -0,0 +1,371 @@
+package org.apache.airavata.credential.store.impl.db;
+
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.credential.store.CommunityUser;
+import org.apache.airavata.credential.store.CredentialStoreException;
+import org.apache.airavata.credential.store.CertificateCredential;
+
+import java.io.*;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Data access class for credential store.
+ */
+public class CredentialsDAO extends ParentDAO {
+
+    public CredentialsDAO(DBUtil dbUtil) {
+        super(dbUtil);
+    }
+
+    public void addCredentials(CertificateCredential certificateCredential) throws CredentialStoreException {
+
+        String sql = "insert into credentials values (?, ?, ?, ?, ?, ?, ?, ?, ?)";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, certificateCredential.getCommunityUser().getGatewayName());
+            preparedStatement.setString(2, certificateCredential.getCommunityUser().getUserName());
+
+            InputStream isCert = new ByteArrayInputStream(
+                    convertObjectToByteArray(certificateCredential.getCertificate()));
+            preparedStatement.setBinaryStream(3, isCert);
+
+            InputStream isPk = new ByteArrayInputStream(
+                    convertObjectToByteArray(certificateCredential.getPrivateKey()));
+            preparedStatement.setBinaryStream(4, isPk);
+
+            preparedStatement.setString(5, certificateCredential.getNotBefore());
+            preparedStatement.setString(6, certificateCredential.getNotAfter());
+            preparedStatement.setLong(7, certificateCredential.getLifeTime());
+            preparedStatement.setString(8, certificateCredential.getPortalUserName());
+            preparedStatement.setTimestamp(9, new Timestamp(new java.util.Date().getTime()));
+
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error persisting community credentials.");
+            stringBuilder.append(" gateway - ").append(certificateCredential.getCommunityUser().getGatewayName());
+            stringBuilder.append(" community user name - ").append(certificateCredential.
+                    getCommunityUser().getUserName());
+            stringBuilder.append(" life time - ").append(certificateCredential.getLifeTime());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } catch (UnsupportedEncodingException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error persisting community credentials. Unsupported encoding.");
+            stringBuilder.append(" gateway - ").append(certificateCredential.getCommunityUser().getGatewayName());
+            stringBuilder.append(" community user name - ").append(certificateCredential.
+                    getCommunityUser().getUserName());
+            stringBuilder.append(" life time - ").append(certificateCredential.getLifeTime());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } catch (IOException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error persisting community credentials. Error serializing " +
+                    "credentials.");
+            stringBuilder.append(" gateway - ").append(certificateCredential.getCommunityUser().getGatewayName());
+            stringBuilder.append(" community user name - ").append(certificateCredential.
+                    getCommunityUser().getUserName());
+            stringBuilder.append(" life time - ").append(certificateCredential.getLifeTime());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+    }
+
+
+    public void deleteCredentials(String gatewayName, String communityUserName) throws CredentialStoreException {
+
+        String sql = "delete from credentials where gateway_name=? and community_user_name=?";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+            preparedStatement.setString(2, communityUserName);
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error deleting credentials for .");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("community user name - ").append(communityUserName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+    }
+
+    public void updateCredentials(CertificateCredential certificateCredential) throws CredentialStoreException {
+
+        String sql = "update credentials set credential = ?, private_key = ?, lifetime = ?, " +
+                "requesting_portal_user_name = ?, " + "not_before = ?," + "not_after = ?," +
+                "requested_time =  ? where gateway_name = ? and community_user_name = ?";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            InputStream isCert = new ByteArrayInputStream(
+                    convertObjectToByteArray(certificateCredential.getCertificate()));
+            preparedStatement.setBinaryStream(1, isCert);
+
+            InputStream isPk = new ByteArrayInputStream(
+                    convertObjectToByteArray(certificateCredential.getPrivateKey()));
+            preparedStatement.setBinaryStream(2, isPk);
+
+            preparedStatement.setLong(3, certificateCredential.getLifeTime());
+            preparedStatement.setString(4, certificateCredential.getPortalUserName());
+            preparedStatement.setString(5, certificateCredential.getNotBefore());
+            preparedStatement.setString(6, certificateCredential.getNotAfter());
+
+            preparedStatement.setTimestamp(7, new Timestamp(new java.util.Date().getTime()));
+            preparedStatement.setString(8, certificateCredential.getCommunityUser().getGatewayName());
+            preparedStatement.setString(9, certificateCredential.getCommunityUser().getUserName());
+
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error updating credentials.");
+            stringBuilder.append(" gateway - ").append(certificateCredential.getCommunityUser().getGatewayName());
+            stringBuilder.append(" community user name - ").append(certificateCredential.
+                    getCommunityUser().getUserName());
+            stringBuilder.append(" life time - ").append(certificateCredential.getLifeTime());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } catch (UnsupportedEncodingException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error updating credentials. Invalid encoding for keys.");
+            stringBuilder.append(" gateway - ").append(certificateCredential.getCommunityUser().getGatewayName());
+            stringBuilder.append(" community user name - ").append(certificateCredential.
+                    getCommunityUser().getUserName());
+            stringBuilder.append(" life time - ").append(certificateCredential.getLifeTime());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } catch (IOException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error updating credentials. Error serializing objects.");
+            stringBuilder.append(" gateway - ").append(certificateCredential.getCommunityUser().getGatewayName());
+            stringBuilder.append(" community user name - ").append(certificateCredential.
+                    getCommunityUser().getUserName());
+            stringBuilder.append(" life time - ").append(certificateCredential.getLifeTime());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+
+    }
+
+    public CertificateCredential getCredential(String gatewayName, String communityUserName)
+            throws CredentialStoreException {
+
+        String sql = "select * from credentials where gateway_name=? and community_user_name=?";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+            preparedStatement.setString(2, communityUserName);
+
+            ResultSet resultSet = preparedStatement.executeQuery();
+
+
+            if (resultSet.next()) {
+                CertificateCredential certificateCredential = new CertificateCredential();
+
+                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
+                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());
+
+                Blob blobPK = resultSet.getBlob("PRIVATE_KEY");
+                byte[] pk = blobPK.getBytes(1, (int) blobPK.length());
+
+                certificateCredential.setCertificate((X509Certificate) convertByteArrayToObject(certificate));
+                certificateCredential.setPrivateKey((PrivateKey) convertByteArrayToObject(pk));
+
+                certificateCredential.setLifeTime(resultSet.getLong("LIFETIME"));
+                certificateCredential.setCommunityUser(new CommunityUser(gatewayName, communityUserName, null));
+                certificateCredential.setPortalUserName(resultSet.getString("REQUESTING_PORTAL_USER_NAME"));
+                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("REQUESTED_TIME"));
+
+                return certificateCredential;
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for community user.");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("community user name - ").append(communityUserName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } catch (ClassNotFoundException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for community user. Error " +
+                    "de-serializing credential objects.");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("community user name - ").append(communityUserName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } catch (IOException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for community user. Error " +
+                    "de-serializing credential objects. An IO Error.");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("community user name - ").append(communityUserName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+
+        return null;
+    }
+
+    public List<CertificateCredential> getCredentials(String gatewayName)
+            throws CredentialStoreException {
+
+        List<CertificateCredential> credentialList = new ArrayList<CertificateCredential>();
+
+        String sql = "select * from credentials where gateway_name=?";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+
+            ResultSet resultSet = preparedStatement.executeQuery();
+
+            CertificateCredential certificateCredential;
+
+            while (resultSet.next()) {
+                certificateCredential = new CertificateCredential();
+
+                certificateCredential.setCommunityUser(new CommunityUser(gatewayName,
+                        resultSet.getString("COMMUNITY_USER_NAME"), null));
+
+                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
+                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());
+
+                Blob blobPK = resultSet.getBlob("PRIVATE_KEY");
+                byte[] pk = blobPK.getBytes(1, (int) blobPK.length());
+
+                certificateCredential.setCertificate((X509Certificate) convertByteArrayToObject(certificate));
+                certificateCredential.setPrivateKey((PrivateKey) convertByteArrayToObject(pk));
+
+                certificateCredential.setNotBefore(resultSet.getString("NOT_BEFORE"));
+                certificateCredential.setNotBefore(resultSet.getString("NOT_AFTER"));
+                certificateCredential.setLifeTime(resultSet.getLong("LIFETIME"));
+                certificateCredential.setPortalUserName(resultSet.getString("REQUESTING_PORTAL_USER_NAME"));
+                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("REQUESTED_TIME"));
+
+                credentialList.add(certificateCredential);
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credential list for ");
+            stringBuilder.append("gateway - ").append(gatewayName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } catch (ClassNotFoundException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credential list for ");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("Error de-serializing objects.");
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } catch (IOException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credential list for ");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("Error de-serializing objects.");
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+
+        return credentialList;
+    }
+
+    public static Object convertByteArrayToObject(byte[] data) throws IOException,
+            ClassNotFoundException {
+        ObjectInputStream objectInputStream = new ObjectInputStream(
+                new ByteArrayInputStream(data));
+        Object o = null;
+        try {
+            o = objectInputStream.readObject();
+        } finally {
+            objectInputStream.close();
+        }
+        return o;
+    }
+
+    public static byte[] convertObjectToByteArray(Serializable o) throws IOException {
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+
+        ObjectOutputStream objectOutputStream = null;
+        try {
+            objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
+            objectOutputStream.writeObject(o);
+            objectOutputStream.flush();
+        } finally {
+            if (objectOutputStream != null) {
+                objectOutputStream.close();
+            }
+        }
+
+        return byteArrayOutputStream.toByteArray();
+    }
+
+}