Author: amilaj
Date: Mon May 6 23:34:43 2013
New Revision: 1479724
URL: http://svn.apache.org/r1479724
Log:
Generalized the credential store so that it can store other types of credential than certificates. Refactored tests accordingly
Added:
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java
- copied, changed from r1479557, 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/Credential.java
- copied, changed from r1459823, 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/credential/impl/
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java
- copied, changed from r1459823, 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/credential/impl/certificate/CertificateCredential.java
- copied, changed from r1459823, 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/credential/impl/password/
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
- copied, changed from r1459823, 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/store/CredentialStoreException.java
- copied, changed from r1459823, 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/store/CredentialWriter.java
- copied, changed from r1459823, 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/store/impl/
- copied from r1459823, 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/store/impl/CredentialReaderImpl.java
- copied, changed from r1459823, airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CredentialStoreImpl.java
airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/
airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/
- copied from r1459823, 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/store/impl/db/CredentialsDAOTest.java
- copied, changed from r1459824, airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/impl/db/CredentialsDAOTest.java
Removed:
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/store/impl/CredentialStoreImpl.java
airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/impl/
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/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/store/impl/CertificateCredentialWriter.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java
airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
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=1479724&r1=1479723&r2=1479724&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 May 6 23:34:43 2013
@@ -217,7 +217,7 @@ public class DBUtil {
* @param connection
* The connection to close.
*/
- public void cleanup(PreparedStatement preparedStatement, Connection connection) {
+ public static void cleanup(PreparedStatement preparedStatement, Connection connection) {
if (preparedStatement != null) {
try {
preparedStatement.close();
@@ -235,6 +235,36 @@ public class DBUtil {
}
/**
+ * Utility method to close statements and connections.
+ *
+ * @param preparedStatement
+ * The prepared statement to close.
+ */
+ public static void cleanup(PreparedStatement preparedStatement) {
+ if (preparedStatement != null) {
+ try {
+ preparedStatement.close();
+ } catch (SQLException e) {
+ log.error("Error closing prepared statement.", e);
+ }
+ }
+ }
+
+ /**
+ * Cleanup the connection.
+ * @param connection The connection to close.
+ */
+ public static void cleanup(Connection connection) {
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ log.error("Error closing prepared statement.", e);
+ }
+ }
+ }
+
+ /**
* Mainly useful for tests.
*
* @param tableName
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=1479724&r1=1479723&r2=1479724&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 May 6 23:34:43 2013
@@ -106,9 +106,16 @@ public class DatabaseTestCases {
dbUtil.executeSQL(sql);
}
- protected DBUtil getDbUtil () throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+ public DBUtil getDbUtil () throws Exception {
return new DBUtil(getJDBCUrl(), getUserName(), getPassword(), getDriver());
}
+ public Connection getConnection() throws Exception {
+
+ DBUtil dbUtil = getDbUtil ();
+ return dbUtil.getConnection();
+
+ }
+
}
Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java?rev=1479724&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java Mon May 6 23:34:43 2013
@@ -0,0 +1,58 @@
+package org.apache.airavata.credential.store.credential;
+/*
+ *
+ * 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.
+ *
+ */
+
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 3/22/13
+ * Time: 11:55 AM
+ */
+
+/**
+ * Any audit information related to a credential.
+ */
+public interface AuditInfo extends Serializable {
+
+ /**
+ * Gets the community user associated with the credential.
+ * @return The community user associated with the credential.
+ */
+ public CommunityUser getCommunityUser();
+
+ /**
+ * The portal user associated with the credential.
+ * @return The portal user name.
+ */
+ public String getPortalUserId();
+
+ /**
+ * Get the time which credentials are persisted.
+ * @return Time credentials are persisted.
+ */
+ public Date getTimePersisted();
+
+
+
+}
Copied: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java (from r1479557, 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/credential/CommunityUser.java?p2=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java&p1=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CommunityUser.java&r1=1479557&r2=1479724&rev=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CommunityUser.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java Mon May 6 23:34:43 2013
@@ -19,12 +19,16 @@
*
*/
-package org.apache.airavata.credential.store;
+package org.apache.airavata.credential.store.credential;
+
+import java.io.Serializable;
/**
* Represents the community user.
*/
-public class CommunityUser {
+public class CommunityUser implements Serializable {
+
+ static final long serialVersionUID = 5783370135149452010L;
private String gatewayName;
private String userName;
Copied: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java (from r1459823, 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/Credential.java?p2=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java&p1=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/Credential.java&r1=1459823&r2=1479724&rev=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/Credential.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java Mon May 6 23:34:43 2013
@@ -1,10 +1,42 @@
-package org.apache.airavata.credential.store;
+package org.apache.airavata.credential.store.credential;
import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.Date;
/**
* 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 {
+public abstract class Credential implements Serializable {
+
+ private String portalUserName;
+ private Date persistedTime;
+ private String token;
+
+ public String getToken() {
+ return token;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ public void setPortalUserName(String userName) {
+ portalUserName = userName;
+ }
+
+ public String getPortalUserName() {
+ return portalUserName;
+ }
+
+ public void setCertificateRequestedTime(Date ts) {
+ persistedTime = ts;
+ }
+
+ public Date getCertificateRequestedTime() {
+ return persistedTime;
+ }
+
+
}
Copied: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java (from r1459823, 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/credential/impl/certificate/CertificateAuditInfo.java?p2=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java&p1=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/AuditInfo.java&r1=1459823&r2=1479724&rev=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/AuditInfo.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java Mon May 6 23:34:43 2013
@@ -1,14 +1,16 @@
-package org.apache.airavata.credential.store;
+package org.apache.airavata.credential.store.credential.impl.certificate;
+
+import org.apache.airavata.credential.store.credential.AuditInfo;
+import org.apache.airavata.credential.store.credential.CommunityUser;
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 {
+public class CertificateAuditInfo implements AuditInfo {
private static final long serialVersionUID = 13213123L;
@@ -28,26 +30,14 @@ public class AuditInfo implements Serial
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;
}
@@ -75,4 +65,16 @@ public class AuditInfo implements Serial
public void setCredentialLifeTime(long credentialLifeTime) {
this.credentialLifeTime = credentialLifeTime;
}
+
+ public CommunityUser getCommunityUser() {
+ return new CommunityUser(gatewayName, communityUserName);
+ }
+
+ public String getPortalUserId() {
+ return portalUserName;
+ }
+
+ public Date getTimePersisted() {
+ return credentialsRequestedTime;
+ }
}
Copied: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java (from r1459823, 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/credential/impl/certificate/CertificateCredential.java?p2=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java&p1=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CertificateCredential.java&r1=1459823&r2=1479724&rev=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CertificateCredential.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java Mon May 6 23:34:43 2013
@@ -1,41 +1,34 @@
-package org.apache.airavata.credential.store;
+package org.apache.airavata.credential.store.credential.impl.certificate;
-import java.security.PrivateKey;
+import org.apache.airavata.credential.store.credential.CommunityUser;
+import org.apache.airavata.credential.store.credential.Credential;import java.security.PrivateKey;
import java.security.cert.X509Certificate;
-import java.util.Date;
/**
* Represents the certificate credentials.
*/
-public class CertificateCredential implements Credential {
+public class CertificateCredential extends Credential {
- public CertificateCredential() {
-
- }
+ static final long serialVersionUID = 6603675553790734432L;
/**
* The community user associated with this credentials.
*/
private CommunityUser communityUser;
- private X509Certificate certificate;
-
- public PrivateKey getPrivateKey() {
- return privateKey;
- }
+ private String notAfter;
- public void setPrivateKey(PrivateKey privateKey) {
- this.privateKey = privateKey;
- }
+ private X509Certificate certificate;
private PrivateKey privateKey;
private long lifeTime;
- private String portalUserName;
-
private String notBefore;
+ public CertificateCredential() {
+ }
+
public String getNotBefore() {
return notBefore;
}
@@ -52,18 +45,15 @@ public class CertificateCredential imple
this.notAfter = notAfter;
}
- private String notAfter;
- public Date getCertificateRequestedTime() {
- return certificateRequestedTime;
+ public PrivateKey getPrivateKey() {
+ return privateKey;
}
- public void setCertificateRequestedTime(Date certificateRequestedTime) {
- this.certificateRequestedTime = certificateRequestedTime;
+ public void setPrivateKey(PrivateKey privateKey) {
+ this.privateKey = privateKey;
}
- private Date certificateRequestedTime;
-
public X509Certificate getCertificate() {
return certificate;
}
@@ -80,14 +70,6 @@ public class CertificateCredential imple
this.lifeTime = lifeTime;
}
- public String getPortalUserName() {
- return portalUserName;
- }
-
- public void setPortalUserName(String portalUserName) {
- this.portalUserName = portalUserName;
- }
-
public CommunityUser getCommunityUser() {
return communityUser;
}
Added: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java?rev=1479724&view=auto
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java (added)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java Mon May 6 23:34:43 2013
@@ -0,0 +1,59 @@
+/*
+ *
+ * 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.airavata.credential.store.credential.impl.password;
+
+import org.apache.airavata.credential.store.credential.Credential;
+
+import java.util.Date;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 3/22/13
+ * Time: 11:41 AM
+ */
+
+/**
+ * User name password credentials.
+ */
+public class PasswordCredential extends Credential {
+
+ private String userName;
+ private String password;
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+
+}
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java?rev=1479724&r1=1479723&r2=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java Mon May 6 23:34:43 2013
@@ -23,6 +23,8 @@ package org.apache.airavata.credential.s
import edu.uiuc.ncsa.myproxy.oa4mp.client.loader.ClientBootstrapper;
import edu.uiuc.ncsa.security.core.util.ConfigurationLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.ServletContext;
import java.io.File;
@@ -32,12 +34,15 @@ import java.io.File;
*/
public class CredentialBootstrapper extends ClientBootstrapper {
+ protected static Logger log = LoggerFactory.getLogger(CredentialBootstrapper.class);
+
+
public ConfigurationLoader getConfigurationLoader(ServletContext servletContext)
throws Exception {
File currentDirectory = new File(".");
- System.out.println("Current directory is - " + currentDirectory.getAbsolutePath());
+ log.info("Current directory is - " + currentDirectory.getAbsolutePath());
return super.getConfigurationLoader(servletContext);
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java?rev=1479724&r1=1479723&r2=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java Mon May 6 23:34:43 2013
@@ -28,11 +28,10 @@ import edu.uiuc.ncsa.myproxy.oa4mp.clien
import edu.uiuc.ncsa.myproxy.oa4mp.client.servlet.ClientServlet;
import edu.uiuc.ncsa.security.core.exceptions.GeneralException;
import edu.uiuc.ncsa.security.servlet.JSPUtil;
-import edu.uiuc.ncsa.security.util.pkcs.CertUtil;
import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.credential.store.CertificateCredential;
-import org.apache.airavata.credential.store.CommunityUser;
-import org.apache.airavata.credential.store.impl.CertificateCredentialWriter;
+import org.apache.airavata.credential.store.credential.CommunityUser;
+import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
+import org.apache.airavata.credential.store.store.impl.CertificateCredentialWriter;
import org.apache.airavata.credential.store.util.Utility;
import javax.servlet.ServletException;
@@ -58,6 +57,7 @@ public class CredentialStoreCallbackServ
private static final String GATEWAY_NAME_QUERY_PARAMETER = "gatewayName";
private static final String PORTAL_USER_QUERY_PARAMETER = "portalUserName";
private static final String PORTAL_USER_EMAIL_QUERY_PARAMETER = "email";
+ private static final String PORTAL_TOKEN_ID_ASSIGNED = "tokenId";
private static final String DURATION_QUERY_PARAMETER = "duration";
private OA4MPService oa4mpService;
@@ -98,6 +98,7 @@ public class CredentialStoreCallbackServ
String portalUserName = request.getParameter(PORTAL_USER_QUERY_PARAMETER);
String durationParameter = request.getParameter(DURATION_QUERY_PARAMETER);
String contactEmail = request.getParameter(PORTAL_USER_EMAIL_QUERY_PARAMETER);
+ String portalTokenId = request.getParameter(PORTAL_TOKEN_ID_ASSIGNED);
//TODO remove hard coded values, once passing query parameters is
//fixed in OA4MP client api
@@ -107,9 +108,18 @@ public class CredentialStoreCallbackServ
duration = Long.parseLong(durationParameter);
}
+ if (portalTokenId == null) {
+ error("Token given by portal is invalid.");
+ GeneralException ge = new GeneralException("Error: The token presented by portal is null.");
+ request.setAttribute("exception", ge);
+ JSPUtil.fwd(request, response, ERROR_PAGE);
+ return;
+ }
+
info("Gateway name " + gatewayName);
info("Portal user name " + portalUserName);
info("Community user contact email " + contactEmail);
+ info("Token id presented " + portalTokenId);
info("2.a. Getting token and verifier.");
String token = request.getParameter(TOKEN_KEY);
@@ -157,6 +167,7 @@ public class CredentialStoreCallbackServ
contactEmail));
certificateCredential.setPortalUserName(portalUserName);
certificateCredential.setLifeTime(duration);
+ certificateCredential.setToken(portalTokenId);
certificateCredentialWriter.writeCredentials(certificateCredential);
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreOA4MPServer.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreOA4MPServer.java?rev=1479724&r1=1479723&r2=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreOA4MPServer.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreOA4MPServer.java Mon May 6 23:34:43 2013
@@ -48,15 +48,17 @@ public class CredentialStoreOA4MPServer
}
public OA4MPResponse requestCert(Map additionalParameters) {
+
if (additionalParameters == null) {
additionalParameters = new HashMap();
}
+
try {
KeyPair keyPair = generateKeyPair();
PKCS10CertificationRequest certReq = createCertRequest(keyPair);
OA4MPResponse mpdsResponse = new OA4MPResponse();
mpdsResponse.setPrivateKey(keyPair.getPrivate());
- additionalParameters.put(ClientEnvironment.CERT_REQUEST_KEY, Base64.encodeBase64String(certReq.getDEREncoded()));
+ additionalParameters.put(ClientEnvironment.CERT_REQUEST_KEY, Base64.encodeBase64(certReq.getDEREncoded()));
if (additionalParameters.get(getEnvironment().getConstants().get(CALLBACK_URI_KEY)) == null) {
additionalParameters.put(getEnvironment().getConstants().get(CALLBACK_URI_KEY), getEnvironment().
Copied: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java (from r1459823, 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/store/CredentialReader.java?p2=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java&p1=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStore.java&r1=1459823&r2=1479724&rev=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStore.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java Mon May 6 23:34:43 2013
@@ -1,28 +1,30 @@
-package org.apache.airavata.credential.store;
+package org.apache.airavata.credential.store.store;
+
+import org.apache.airavata.credential.store.credential.AuditInfo;
/**
* This interface provides an API for Credential Store.
* Provides methods to manipulate credential store data.
*/
-public interface CredentialStore {
+public interface CredentialReader {
/**
* 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.
+ * @param tokenId The issued token id.
* @return The portal user name who requested given community user credentials.
*/
- String getPortalUser(String gatewayName, String communityUser) throws CredentialStoreException;
+ String getPortalUser(String gatewayName, String tokenId) 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.
+ * @param tokenId The community user name.
+ * @return CertificateAuditInfo object.
*/
- AuditInfo getAuditInfo(String gatewayName, String communityUser) throws CredentialStoreException;
+ AuditInfo getAuditInfo(String gatewayName, String tokenId) throws CredentialStoreException;
/**
* Updates the community user contact email address.
@@ -35,10 +37,10 @@ public interface CredentialStore {
/**
* Will remove credentials for the given gateway id and community user.
* @param gatewayName The gateway Id
- * @param communityUser The community user name.
+ * @param tokenId The issued token id.
* @throws CredentialStoreException If an error occurred while retrieving data.
*/
- void removeCredentials(String gatewayName, String communityUser) throws CredentialStoreException;
+ void removeCredentials(String gatewayName, String tokenId) throws CredentialStoreException;
}
Copied: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java (from r1459823, 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/store/CredentialStoreException.java?p2=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java&p1=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStoreException.java&r1=1459823&r2=1479724&rev=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialStoreException.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java Mon May 6 23:34:43 2013
@@ -1,4 +1,4 @@
-package org.apache.airavata.credential.store;
+package org.apache.airavata.credential.store.store;
/**
* An exception class for credential store.
Copied: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java (from r1459823, 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/store/CredentialWriter.java?p2=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java&p1=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialWriter.java&r1=1459823&r2=1479724&rev=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/CredentialWriter.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java Mon May 6 23:34:43 2013
@@ -1,4 +1,6 @@
-package org.apache.airavata.credential.store;
+package org.apache.airavata.credential.store.store;
+
+import org.apache.airavata.credential.store.credential.Credential;
/**
* The entity who's writing credentials to DB will use this interface.
@@ -11,10 +13,5 @@ public interface CredentialWriter {
*/
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;
+
}
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java?rev=1479724&r1=1459823&r2=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java Mon May 6 23:34:43 2013
@@ -1,9 +1,16 @@
-package org.apache.airavata.credential.store.impl;
+package org.apache.airavata.credential.store.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 org.apache.airavata.credential.store.credential.CommunityUser;
+import org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
+import org.apache.airavata.credential.store.store.impl.db.CommunityUserDAO;
+import org.apache.airavata.credential.store.store.impl.db.CredentialsDAO;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.apache.airavata.credential.store.store.CredentialWriter;
+
+import java.sql.Connection;
+import java.sql.SQLException;
/**
* Writes certificate credentials to database.
@@ -13,36 +20,63 @@ public class CertificateCredentialWriter
private CredentialsDAO credentialsDAO;
private CommunityUserDAO communityUserDAO;
+ private DBUtil dbUtil;
+
public CertificateCredentialWriter(DBUtil dbUtil) {
- credentialsDAO = new CredentialsDAO(dbUtil);
- communityUserDAO = new CommunityUserDAO(dbUtil);
+
+ this.dbUtil = dbUtil;
+
+ credentialsDAO = new CredentialsDAO();
+ communityUserDAO = new CommunityUserDAO();
}
- @Override
public void writeCredentials(Credential credential) throws CredentialStoreException {
CertificateCredential certificateCredential = (CertificateCredential)credential;
- // Write community user
- writeCommunityUser(certificateCredential.getCommunityUser());
+ Connection connection = null;
+
+ try {
+
+ connection = dbUtil.getConnection();
+ // Write community user
+ writeCommunityUser(certificateCredential.getCommunityUser(), credential.getToken(), connection);
+ // First delete existing credentials
+ credentialsDAO.deleteCredentials(certificateCredential.getCommunityUser().getGatewayName(),
+ certificateCredential.getToken(), connection);
+ // Add the new certificate
+ credentialsDAO.addCredentials(certificateCredential.getCommunityUser().getGatewayName(), credential, connection);
+
+ } catch (SQLException e) {
+ throw new CredentialStoreException("Unable to retrieve database connection.", e);
+ } finally {
+ DBUtil.cleanup(connection);
+ }
- // 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 {
+ public void writeCommunityUser(CommunityUser communityUser, String token, Connection connection) throws CredentialStoreException {
// First delete existing community user
- communityUserDAO.deleteCommunityUser(communityUser);
+ communityUserDAO.deleteCommunityUserByToken(communityUser, token, connection);
// Persist new community user
- communityUserDAO.addCommunityUser(communityUser);
+ communityUserDAO.addCommunityUser(communityUser, token, connection);
}
+
+ /* TODO Remove later - If we dont need to expose this in the interface
+ public void writeCommunityUser(CommunityUser communityUser, String token) throws CredentialStoreException {
+
+ Connection connection = null;
+ try {
+ connection = dbUtil.getConnection();
+ writeCommunityUser(communityUser, token, connection);
+
+ } catch (SQLException e) {
+ throw new CredentialStoreException("Unable to retrieve database connection.", e);
+ } finally {
+ DBUtil.cleanup(connection);
+ }
+ }*/
}
Copied: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java (from r1459823, 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/store/impl/CredentialReaderImpl.java?p2=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java&p1=airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CredentialStoreImpl.java&r1=1459823&r2=1479724&rev=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/impl/CredentialStoreImpl.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java Mon May 6 23:34:43 2013
@@ -1,64 +1,105 @@
-package org.apache.airavata.credential.store.impl;
+package org.apache.airavata.credential.store.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 org.apache.airavata.credential.store.credential.CommunityUser;
+import org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.credential.impl.certificate.CertificateAuditInfo;
+import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
+import org.apache.airavata.credential.store.store.CredentialReader;
+import org.apache.airavata.credential.store.store.impl.db.CredentialsDAO;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.SQLException;
/**
* Credential store API implementation.
*/
-public class CredentialStoreImpl implements CredentialStore, Serializable {
+public class CredentialReaderImpl implements CredentialReader, Serializable {
- private CommunityUserDAO communityUserDAO;
private CredentialsDAO credentialsDAO;
- public CredentialStoreImpl(DBUtil dbUtil) {
+ private DBUtil dbUtil;
- this.communityUserDAO = new CommunityUserDAO(dbUtil);
- this.credentialsDAO = new CredentialsDAO(dbUtil);
+ public CredentialReaderImpl(DBUtil dbUtil) {
+
+ this.credentialsDAO = new CredentialsDAO();
+
+ this.dbUtil = dbUtil;
}
- @Override
- public String getPortalUser(String gatewayName, String communityUser) throws CredentialStoreException {
- CertificateCredential certificateCredential
- = this.credentialsDAO.getCredential(gatewayName, communityUser);
- return certificateCredential.getPortalUserName();
+ private Connection getConnection() throws CredentialStoreException {
+ try {
+ return this.dbUtil.getConnection();
+ } catch (SQLException e) {
+ throw new CredentialStoreException("Unable to retrieve database connection.", e);
+ }
+ }
+
+ public String getPortalUser(String gatewayName, String tokenId) throws CredentialStoreException {
+
+ Connection connection = getConnection();
+
+ Credential credential;
+
+ try {
+ credential
+ = this.credentialsDAO.getCredential(gatewayName, tokenId, connection);
+
+ } finally {
+ DBUtil.cleanup(connection);
+ }
+
+ return credential.getPortalUserName();
}
- @Override
- public AuditInfo getAuditInfo(String gatewayName, String communityUser)
+ public CertificateAuditInfo getAuditInfo(String gatewayName, String tokenId)
throws CredentialStoreException {
- CertificateCredential certificateCredential
- = this.credentialsDAO.getCredential(gatewayName, communityUser);
+ Connection connection = getConnection();
- AuditInfo auditInfo = new AuditInfo();
+ CertificateAuditInfo certificateAuditInfo;
- 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());
+ try {
- return auditInfo; //To change body of implemented methods use File | Settings | File Templates.
+ CertificateCredential certificateCredential
+ = (CertificateCredential)this.credentialsDAO.getCredential(gatewayName, tokenId, connection);
+
+ certificateAuditInfo = new CertificateAuditInfo();
+
+ CommunityUser retrievedUser = certificateCredential.getCommunityUser();
+ certificateAuditInfo.setCommunityUserName(retrievedUser.getUserName());
+ certificateAuditInfo.setCredentialLifeTime(certificateCredential.getLifeTime());
+ certificateAuditInfo.setCredentialsRequestedTime(certificateCredential.getCertificateRequestedTime());
+ certificateAuditInfo.setGatewayName(gatewayName);
+ certificateAuditInfo.setNotAfter(certificateCredential.getNotAfter());
+ certificateAuditInfo.setNotBefore(certificateCredential.getNotBefore());
+ certificateAuditInfo.setPortalUserName(certificateCredential.getPortalUserName());
+
+ } finally {
+ DBUtil.cleanup(connection);
+ }
+
+ return certificateAuditInfo;
}
- @Override
- public void updateCommunityUserEmail(String gatewayName, String communityUser, String email) throws CredentialStoreException {
- this.communityUserDAO.updateCommunityUser(
- new CommunityUser(gatewayName, communityUser, email));
+ public void updateCommunityUserEmail(String gatewayName, String communityUser, String email)
+ throws CredentialStoreException {
+ //TODO
}
- @Override
- public void removeCredentials(String gatewayName, String communityUser) throws CredentialStoreException {
- credentialsDAO.deleteCredentials(gatewayName, communityUser);
+ public void removeCredentials(String gatewayName, String tokenId) throws CredentialStoreException {
+
+ Connection connection = getConnection();
+
+ try {
+ credentialsDAO.deleteCredentials(gatewayName, tokenId, connection);
+ } finally {
+ DBUtil.cleanup(connection);
+ }
+
}
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java?rev=1479724&r1=1459823&r2=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java Mon May 6 23:34:43 2013
@@ -1,8 +1,8 @@
-package org.apache.airavata.credential.store.impl.db;
+package org.apache.airavata.credential.store.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.credential.CommunityUser;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -16,24 +16,23 @@ import java.util.List;
*/
public class CommunityUserDAO extends ParentDAO {
- public CommunityUserDAO(DBUtil dbUtil) {
- super(dbUtil);
+ public CommunityUserDAO() {
+ super();
}
- public void addCommunityUser(CommunityUser user) throws CredentialStoreException {
+ public void addCommunityUser(CommunityUser user, String token, Connection connection) throws CredentialStoreException {
- String sql = "insert into community_user values (?, ?, ?)";
+ 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.setString(3, token);
+ preparedStatement.setString(4, user.getUserEmail());
preparedStatement.executeUpdate();
@@ -44,26 +43,25 @@ public class CommunityUserDAO extends Pa
stringBuilder.append("gateway - ").append(user.getGatewayName());
stringBuilder.append("community user name - ").append(user.getUserName());
stringBuilder.append("community user email - ").append(user.getUserEmail());
+ stringBuilder.append("token id - ").append(token);
log.error(stringBuilder.toString(), e);
throw new CredentialStoreException(stringBuilder.toString(), e);
} finally {
- dbUtil.cleanup(preparedStatement, connection);
+ DBUtil.cleanup(preparedStatement);
}
}
- public void deleteCommunityUser(CommunityUser user) throws CredentialStoreException {
+ public void deleteCommunityUser(CommunityUser user, Connection connection) 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());
@@ -82,7 +80,37 @@ public class CommunityUserDAO extends Pa
throw new CredentialStoreException(stringBuilder.toString(), e);
} finally {
- dbUtil.cleanup(preparedStatement, connection);
+ DBUtil.cleanup(preparedStatement);
+ }
+ }
+
+ public void deleteCommunityUserByToken(CommunityUser user, String token, Connection connection) throws CredentialStoreException {
+
+ String sql = "delete from community_user where gateway_name=? and community_user_name=? and token_id=?";
+
+ PreparedStatement preparedStatement = null;
+
+ try {
+ preparedStatement = connection.prepareStatement(sql);
+
+ preparedStatement.setString(1, user.getGatewayName());
+ preparedStatement.setString(2, user.getUserName());
+ preparedStatement.setString(3, token);
+
+ 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);
}
}
@@ -91,15 +119,14 @@ public class CommunityUserDAO extends Pa
//TODO
}
- public CommunityUser getCommunityUser(String gatewayName, String communityUserName) throws CredentialStoreException{
+ public CommunityUser getCommunityUser(String gatewayName, String communityUserName, Connection connection)
+ 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);
@@ -123,24 +150,61 @@ public class CommunityUserDAO extends Pa
throw new CredentialStoreException(stringBuilder.toString(), e);
} finally {
- dbUtil.cleanup(preparedStatement, connection);
+ DBUtil.cleanup(preparedStatement);
+ }
+
+ return null;
+ }
+
+ public CommunityUser getCommunityUserByToken(String gatewayName, String tokenId, Connection connection)
+ throws CredentialStoreException{
+
+ String sql = "select * from community_user where gateway_name=? and token_id=?";
+
+ PreparedStatement preparedStatement = null;
+
+ try {
+ preparedStatement = connection.prepareStatement(sql);
+
+ preparedStatement.setString(1, gatewayName);
+ preparedStatement.setString(2, tokenId);
+
+ ResultSet resultSet = preparedStatement.executeQuery();
+
+ if (resultSet.next()) {
+ String communityUserName = resultSet.getString("community_user_name");
+ 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("token- ").append(tokenId);
+
+ log.error(stringBuilder.toString(), e);
+
+ throw new CredentialStoreException(stringBuilder.toString(), e);
+ } finally {
+ DBUtil.cleanup(preparedStatement);
}
return null;
}
- public List<CommunityUser> getCommunityUsers(String gatewayName)
+
+ public List<CommunityUser> getCommunityUsers(String gatewayName, Connection connection)
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);
@@ -163,7 +227,7 @@ public class CommunityUserDAO extends Pa
throw new CredentialStoreException(stringBuilder.toString(), e);
} finally {
- dbUtil.cleanup(preparedStatement, connection);
+ DBUtil.cleanup(preparedStatement);
}
return userList;
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java?rev=1479724&r1=1459823&r2=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java Mon May 6 23:34:43 2013
@@ -1,13 +1,10 @@
-package org.apache.airavata.credential.store.impl.db;
+package org.apache.airavata.credential.store.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 org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
import java.io.*;
-import java.security.PrivateKey;
-import java.security.cert.X509Certificate;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
@@ -17,59 +14,60 @@ import java.util.List;
*/
public class CredentialsDAO extends ParentDAO {
- public CredentialsDAO(DBUtil dbUtil) {
- super(dbUtil);
+ public CredentialsDAO() {
+ super();
}
- public void addCredentials(CertificateCredential certificateCredential) throws CredentialStoreException {
+ /**
+ * String createTable = "CREATE TABLE CREDENTIALS\n" +
+ "(\n" +
+ " GATEWAY_ID VARCHAR(256) NOT NULL,\n" +
+ " TOKEN_ID VARCHAR(256) NOT NULL,\n" + // Actual token used to identify the credential
+ " CREDENTIAL BLOB NOT NULL,\n" +
+ " PORTAL_USER_ID VARCHAR(256) NOT NULL,\n" +
+ " TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n" +
+ " PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" +
+ ")";
+ */
- String sql = "insert into credentials values (?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ public void addCredentials(String gatewayId, Credential credential,
+ Connection connection) 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());
+ preparedStatement.setString(1, gatewayId);
+ preparedStatement.setString(2, credential.getToken());
InputStream isCert = new ByteArrayInputStream(
- convertObjectToByteArray(certificateCredential.getCertificate()));
+ convertObjectToByteArray(credential));
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.setString(4, credential.getPortalUserName());
+ java.util.Date date= new java.util.Date();
+ Timestamp timestamp = new Timestamp(date.getTime());
- preparedStatement.executeUpdate();
+ preparedStatement.setTimestamp(5, timestamp);
- connection.commit();
+ preparedStatement.executeUpdate();
} 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());
+ stringBuilder.append(" gateway - ").append(gatewayId);
+ stringBuilder.append(" token id - ").append(credential.getToken());
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());
+ stringBuilder.append(" gateway - ").append(gatewayId);
+ stringBuilder.append(" token id - ").append(credential.getToken());
log.error(stringBuilder.toString(), e);
@@ -77,158 +75,149 @@ public class CredentialsDAO extends Pare
} 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());
+ stringBuilder.append(" gateway - ").append(gatewayId);
+ stringBuilder.append(" community user name - ").append(credential.getToken());
log.error(stringBuilder.toString(), e);
throw new CredentialStoreException(stringBuilder.toString(), e);
} finally {
- dbUtil.cleanup(preparedStatement, connection);
+ DBUtil.cleanup(preparedStatement);
}
}
- public void deleteCredentials(String gatewayName, String communityUserName) throws CredentialStoreException {
+ public void deleteCredentials(String gatewayName, String tokenId, Connection connection)
+ throws CredentialStoreException {
- String sql = "delete from credentials where gateway_name=? and community_user_name=?";
+ String sql = "delete from credentials where GATEWAY_ID=? and TOKEN_ID=?";
- Connection connection = null;
PreparedStatement preparedStatement = null;
try {
- connection = dbUtil.getConnection();
preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, gatewayName);
- preparedStatement.setString(2, communityUserName);
+ preparedStatement.setString(2, tokenId);
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);
+ stringBuilder.append("token id - ").append(tokenId);
log.error(stringBuilder.toString(), e);
throw new CredentialStoreException(stringBuilder.toString(), e);
} finally {
- dbUtil.cleanup(preparedStatement, connection);
+ DBUtil.cleanup(preparedStatement);
}
}
- public void updateCredentials(CertificateCredential certificateCredential) throws CredentialStoreException {
+ /**
+ * String createTable = "CREATE TABLE CREDENTIALS\n" +
+ "(\n" +
+ " GATEWAY_ID VARCHAR(256) NOT NULL,\n" +
+ " TOKEN_ID VARCHAR(256) NOT NULL,\n" + // Actual token used to identify the credential
+ " CREDENTIAL BLOB NOT NULL,\n" +
+ " PORTAL_USER_ID VARCHAR(256) NOT NULL,\n" +
+ " TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n" +
+ " PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" +
+ ")";
+ */
+ public void updateCredentials(String gatewayId, Credential credential,
+ Connection connection) 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 = ?";
+ String sql = "update CREDENTIALS set CREDENTIAL = ?, PORTAL_USER_ID = ?, TIME_PERSISTED = ? where GATEWAY_ID = ? and TOKEN_ID = ?";
- Connection connection = null;
PreparedStatement preparedStatement = null;
try {
- connection = dbUtil.getConnection();
preparedStatement = connection.prepareStatement(sql);
InputStream isCert = new ByteArrayInputStream(
- convertObjectToByteArray(certificateCredential.getCertificate()));
+ convertObjectToByteArray(credential));
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.setString(2, credential.getPortalUserName());
+ preparedStatement.setTimestamp(3, new Timestamp(new java.util.Date().getTime()));
+ preparedStatement.setString(4, gatewayId);
+ preparedStatement.setString(5, credential.getToken());
- preparedStatement.executeUpdate();
- connection.commit();
+ preparedStatement.executeUpdate();
} 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());
+ stringBuilder.append(" gateway - ").append(gatewayId);
+ stringBuilder.append(" token id - ").append(credential.getToken());
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());
+ stringBuilder.append(" gateway - ").append(gatewayId);
+ stringBuilder.append(" token id - ").append(credential.getToken());
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());
+ stringBuilder.append(" gateway - ").append(gatewayId);
+ stringBuilder.append(" token - ").append(credential.getToken());
log.error(stringBuilder.toString(), e);
throw new CredentialStoreException(stringBuilder.toString(), e);
} finally {
- dbUtil.cleanup(preparedStatement, connection);
+ DBUtil.cleanup(preparedStatement);
}
}
- public CertificateCredential getCredential(String gatewayName, String communityUserName)
+ /**
+ * String createTable = "CREATE TABLE CREDENTIALS\n" +
+ "(\n" +
+ " GATEWAY_ID VARCHAR(256) NOT NULL,\n" +
+ " TOKEN_ID VARCHAR(256) NOT NULL,\n" + // Actual token used to identify the credential
+ " CREDENTIAL BLOB NOT NULL,\n" +
+ " PORTAL_USER_ID VARCHAR(256) NOT NULL,\n" +
+ " TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n" +
+ " PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" +
+ ")";
+ */
+ public Credential getCredential(String gatewayName, String tokenId, Connection connection)
throws CredentialStoreException {
- String sql = "select * from credentials where gateway_name=? and community_user_name=?";
+ String sql = "select * from credentials where GATEWAY_ID=? and TOKEN_ID=?";
- Connection connection = null;
PreparedStatement preparedStatement = null;
try {
- connection = dbUtil.getConnection();
preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, gatewayName);
- preparedStatement.setString(2, communityUserName);
+ preparedStatement.setString(2, tokenId);
ResultSet resultSet = preparedStatement.executeQuery();
if (resultSet.next()) {
- CertificateCredential certificateCredential = new CertificateCredential();
+ //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));
+ Credential certificateCredential = (Credential) convertByteArrayToObject(certificate);
- 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"));
+ certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
+ certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
return certificateCredential;
}
@@ -236,7 +225,7 @@ public class CredentialsDAO extends Pare
} 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);
+ stringBuilder.append("token id - ").append(tokenId);
log.error(stringBuilder.toString(), e);
@@ -245,7 +234,7 @@ public class CredentialsDAO extends Pare
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);
+ stringBuilder.append("token id - ").append(tokenId);
log.error(stringBuilder.toString(), e);
@@ -254,58 +243,57 @@ public class CredentialsDAO extends Pare
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);
+ stringBuilder.append("tokenId - ").append(tokenId);
log.error(stringBuilder.toString(), e);
throw new CredentialStoreException(stringBuilder.toString(), e);
} finally {
- dbUtil.cleanup(preparedStatement, connection);
+ DBUtil.cleanup(preparedStatement);
}
return null;
}
- public List<CertificateCredential> getCredentials(String gatewayName)
+
+ /**
+ * String createTable = "CREATE TABLE CREDENTIALS\n" +
+ "(\n" +
+ " GATEWAY_ID VARCHAR(256) NOT NULL,\n" +
+ " TOKEN_ID VARCHAR(256) NOT NULL,\n" + // Actual token used to identify the credential
+ " CREDENTIAL BLOB NOT NULL,\n" +
+ " PORTAL_USER_ID VARCHAR(256) NOT NULL,\n" +
+ " TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n" +
+ " PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" +
+ ")";
+ */
+ public List<Credential> getCredentials(String gatewayName, Connection connection)
throws CredentialStoreException {
- List<CertificateCredential> credentialList = new ArrayList<CertificateCredential>();
+ List<Credential> credentialList = new ArrayList<Credential>();
- String sql = "select * from credentials where gateway_name=?";
+ String sql = "select * from credentials where GATEWAY_ID=?";
- Connection connection = null;
PreparedStatement preparedStatement = null;
try {
- connection = dbUtil.getConnection();
preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, gatewayName);
ResultSet resultSet = preparedStatement.executeQuery();
- CertificateCredential certificateCredential;
+ Credential 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 = (Credential) convertByteArrayToObject(certificate);
- 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"));
+ certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
+ certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
credentialList.add(certificateCredential);
}
@@ -332,7 +320,7 @@ public class CredentialsDAO extends Pare
throw new CredentialStoreException(stringBuilder.toString(), e);
} finally {
- dbUtil.cleanup(preparedStatement, connection);
+ DBUtil.cleanup(preparedStatement);
}
return credentialList;
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java?rev=1479724&r1=1459823&r2=1479724&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java Mon May 6 23:34:43 2013
@@ -1,4 +1,4 @@
-package org.apache.airavata.credential.store.impl.db;
+package org.apache.airavata.credential.store.store.impl.db;
import org.apache.airavata.common.utils.DBUtil;
import org.slf4j.Logger;
@@ -8,12 +8,9 @@ import org.slf4j.LoggerFactory;
* Super class to abstract out Data access classes.
*/
public class ParentDAO {
- protected static Logger log = LoggerFactory.getLogger(CommunityUserDAO.class);
+ protected static Logger log = LoggerFactory.getLogger(ParentDAO.class);
- protected DBUtil dbUtil;
-
- public ParentDAO(DBUtil dbUtil) {
- this.dbUtil = dbUtil;
+ public ParentDAO() {
}
}
|