You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2013/06/29 21:51:08 UTC
svn commit: r1497993 [1/2] - in /airavata/trunk: ./
modules/airavata-client/src/main/java/org/apache/airavata/client/impl/
modules/commons/gfac-schema/src/main/resources/schemas/
modules/credential-store/src/main/java/org/apache/airavata/credential/sto...
Author: smarru
Date: Sat Jun 29 18:20:44 2013
New Revision: 1497993
URL: http://svn.apache.org/r1497993
Log:
Adding the missing license headers
Modified:
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/CredentialStoreSecuritySettingsImpl.java
airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl-hpcpa.xsd
airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl-posix.xsd
airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl-spmd.xsd
airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl.xsd
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/Credential.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java
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/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/store/CredentialReader.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java
airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.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/CredentialReaderImpl.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
airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExecutionErrorResource.java
airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java
airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExperimentErrorsList.java
airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacErrorsList.java
airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/NodeErrorsList.java
airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/WorkflowErrorsList.java
airavata/trunk/modules/rest/webapp/src/main/resources/credential-store/client.xml
airavata/trunk/pom.xml
Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/CredentialStoreSecuritySettingsImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/CredentialStoreSecuritySettingsImpl.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/CredentialStoreSecuritySettingsImpl.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/CredentialStoreSecuritySettingsImpl.java Sat Jun 29 18:20:44 2013
@@ -24,12 +24,6 @@ package org.apache.airavata.client.impl;
import org.apache.airavata.client.api.CredentialStoreSecuritySettings;
/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 5/7/13
- * Time: 2:44 PM
- */
-
-/**
* Implementation of credential store security settings class.
*/
public class CredentialStoreSecuritySettingsImpl implements CredentialStoreSecuritySettings {
@@ -47,7 +41,6 @@ public class CredentialStoreSecuritySett
this.tokenId = tokenId;
}
-
public String getTokenId() {
return tokenId;
}
Modified: airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl-hpcpa.xsd
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl-hpcpa.xsd?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
Binary files - no diff available.
Modified: airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl-posix.xsd
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl-posix.xsd?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
Binary files - no diff available.
Modified: airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl-spmd.xsd
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl-spmd.xsd?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
Binary files - no diff available.
Modified: airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl.xsd
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/gfac-schema/src/main/resources/schemas/jsdl.xsd?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
Binary files - no diff available.
Modified: 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=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java Sat Jun 29 18:20:44 2013
@@ -1,4 +1,3 @@
-package org.apache.airavata.credential.store.credential;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,39 +19,35 @@ package org.apache.airavata.credential.s
*
*/
+package org.apache.airavata.credential.store.credential;
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();
-
-
}
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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;
import java.io.Serializable;
@@ -5,8 +26,8 @@ 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.
+ * 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 abstract class Credential implements Serializable {
@@ -38,5 +59,4 @@ public abstract class Credential impleme
return persistedTime;
}
-
}
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.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?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.certificate;
import org.apache.airavata.credential.store.credential.AuditInfo;
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/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?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java Sat Jun 29 18:20:44 2013
@@ -1,7 +1,29 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
package org.apache.airavata.credential.store.credential.impl.certificate;
import org.apache.airavata.credential.store.credential.CommunityUser;
-import org.apache.airavata.credential.store.credential.Credential;import java.security.PrivateKey;
+import org.apache.airavata.credential.store.credential.Credential;
+import java.security.PrivateKey;
import java.security.cert.X509Certificate;
/**
@@ -45,7 +67,6 @@ public class CertificateCredential exten
this.notAfter = notAfter;
}
-
public PrivateKey getPrivateKey() {
return privateKey;
}
Modified: 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=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java Sat Jun 29 18:20:44 2013
@@ -26,12 +26,6 @@ import org.apache.airavata.credential.st
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 {
@@ -55,5 +49,4 @@ public class PasswordCredential extends
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=1497993&r1=1497992&r2=1497993&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 Sat Jun 29 18:20:44 2013
@@ -36,9 +36,7 @@ public class CredentialBootstrapper exte
protected static Logger log = LoggerFactory.getLogger(CredentialBootstrapper.class);
-
- public ConfigurationLoader getConfigurationLoader(ServletContext servletContext)
- throws Exception {
+ public ConfigurationLoader getConfigurationLoader(ServletContext servletContext) throws Exception {
File currentDirectory = new File(".");
@@ -46,8 +44,6 @@ public class CredentialBootstrapper exte
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=1497993&r1=1497992&r2=1497993&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 Sat Jun 29 18:20:44 2013
@@ -45,9 +45,8 @@ import java.util.Map;
import static edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment.CALLBACK_URI_KEY;
/**
- * Callback from the portal will come here. In this class we will store incomming
- * certificate to the database.
- * Partly taken from OA4MP code base.
+ * Callback from the portal will come here. In this class we will store incomming certificate to the database. Partly
+ * taken from OA4MP code base.
*/
public class CredentialStoreCallbackServlet extends ClientServlet {
@@ -100,8 +99,8 @@ public class CredentialStoreCallbackServ
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
+ // TODO remove hard coded values, once passing query parameters is
+ // fixed in OA4MP client api
long duration = 800;
if (durationParameter != null) {
@@ -125,8 +124,10 @@ public class CredentialStoreCallbackServ
String token = request.getParameter(TOKEN_KEY);
String verifier = request.getParameter(VERIFIER_KEY);
if (token == null || verifier == null) {
- warn("2.a. The token is " + (token == null ? "null" : token) + " and the verifier is " + (verifier == null ? "null" : verifier));
- GeneralException ge = new GeneralException("Error: This servlet requires parameters for the token and verifier. It cannot be called directly.");
+ warn("2.a. The token is " + (token == null ? "null" : token) + " and the verifier is "
+ + (verifier == null ? "null" : verifier));
+ GeneralException ge = new GeneralException(
+ "Error: This servlet requires parameters for the token and verifier. It cannot be called directly.");
request.setAttribute("exception", ge);
JSPUtil.fwd(request, response, ERROR_PAGE);
return;
@@ -136,13 +137,12 @@ public class CredentialStoreCallbackServ
AssetResponse assetResponse = null;
OA4MPResponse oa4MPResponse = null;
- Map<String, String> parameters = createQueryParameters(gatewayName, portalUserName,
- contactEmail, portalTokenId);
+ Map<String, String> parameters = createQueryParameters(gatewayName, portalUserName, contactEmail, portalTokenId);
try {
info("Requesting private key ...");
oa4MPResponse = getOA4MPService().requestCert(parameters);
- //oa4MPResponse = getOA4MPService().requestCert();
+ // oa4MPResponse = getOA4MPService().requestCert();
info("2.a. Getting the cert(s) from the service");
assetResponse = getOA4MPService().getCert(token, verifier);
@@ -164,8 +164,8 @@ public class CredentialStoreCallbackServ
certificateCredential.setNotAfter(Utility.convertDateToString(cert.getNotAfter()));
certificateCredential.setCertificate(cert);
certificateCredential.setPrivateKey(oa4MPResponse.getPrivateKey());
- certificateCredential.setCommunityUser(new CommunityUser(gatewayName, assetResponse.getUsername(),
- contactEmail));
+ certificateCredential
+ .setCommunityUser(new CommunityUser(gatewayName, assetResponse.getUsername(), contactEmail));
certificateCredential.setPortalUserName(portalUserName);
certificateCredential.setLifeTime(duration);
certificateCredential.setToken(portalTokenId);
@@ -188,10 +188,8 @@ public class CredentialStoreCallbackServ
}
- private Map<String, String> createQueryParameters (String gatewayName,
- String portalUserName,
- String portalEmail,
- String tokenId) {
+ private Map<String, String> createQueryParameters(String gatewayName, String portalUserName, String portalEmail,
+ String tokenId) {
String callbackUriKey = getEnvironment().getConstants().get(CALLBACK_URI_KEY);
ClientEnvironment clientEnvironment = (ClientEnvironment) getEnvironment();
@@ -200,11 +198,9 @@ public class CredentialStoreCallbackServ
StringBuilder stringBuilder = new StringBuilder(callbackUri);
- stringBuilder.append("?").append(GATEWAY_NAME_QUERY_PARAMETER).append("=").append(gatewayName)
- .append("&").append(PORTAL_USER_QUERY_PARAMETER).append("=").append(portalUserName)
- .append("&")
- .append(PORTAL_USER_EMAIL_QUERY_PARAMETER).append("=").append(portalEmail)
- .append("&")
+ stringBuilder.append("?").append(GATEWAY_NAME_QUERY_PARAMETER).append("=").append(gatewayName).append("&")
+ .append(PORTAL_USER_QUERY_PARAMETER).append("=").append(portalUserName).append("&")
+ .append(PORTAL_USER_EMAIL_QUERY_PARAMETER).append("=").append(portalEmail).append("&")
.append(PORTAL_TOKEN_ID_ASSIGNED).append("=").append(tokenId);
info("Callback URI is set to - " + stringBuilder.toString());
@@ -216,4 +212,3 @@ public class CredentialStoreCallbackServ
}
}
-
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=1497993&r1=1497992&r2=1497993&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 Sat Jun 29 18:20:44 2013
@@ -39,8 +39,7 @@ import static edu.uiuc.ncsa.security.uti
import static edu.uiuc.ncsa.security.util.pkcs.KeyUtil.generateKeyPair;
/**
- * Credential store specific OA4MPService.
- * Only change is add support to include get parameters.
+ * Credential store specific OA4MPService. Only change is add support to include get parameters.
*/
public class CredentialStoreOA4MPServer extends OA4MPService {
public CredentialStoreOA4MPServer(ClientEnvironment environment) {
@@ -58,11 +57,12 @@ public class CredentialStoreOA4MPServer
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.encodeBase64String(certReq.getDEREncoded()));
if (additionalParameters.get(getEnvironment().getConstants().get(CALLBACK_URI_KEY)) == null) {
- additionalParameters.put(getEnvironment().getConstants().get(CALLBACK_URI_KEY), getEnvironment().
- getCallback().toString());
+ additionalParameters.put(getEnvironment().getConstants().get(CALLBACK_URI_KEY), getEnvironment()
+ .getCallback().toString());
}
DelegationRequest daReq = new DelegationRequest();
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java Sat Jun 29 18:20:44 2013
@@ -76,8 +76,7 @@ public class CredentialStoreStartServlet
}
@Override
- protected void doIt(HttpServletRequest request, HttpServletResponse response)
- throws Throwable {
+ protected void doIt(HttpServletRequest request, HttpServletResponse response) throws Throwable {
String gatewayName = request.getParameter("gatewayName");
String portalUserName = request.getParameter("portalUserName");
@@ -85,21 +84,20 @@ public class CredentialStoreStartServlet
String associatedToken = request.getParameter("associatedToken");
if (gatewayName == null) {
- JSPUtil.handleException(new RuntimeException("Please specify a gateway name."), request,
- response, "/credential-store/error.jsp");
+ JSPUtil.handleException(new RuntimeException("Please specify a gateway name."), request, response,
+ "/credential-store/error.jsp");
return;
}
if (portalUserName == null) {
- JSPUtil.handleException(new RuntimeException("Please specify a portal user name."), request,
- response, "/credential-store/error.jsp");
+ JSPUtil.handleException(new RuntimeException("Please specify a portal user name."), request, response,
+ "/credential-store/error.jsp");
return;
}
if (contactEmail == null) {
- JSPUtil.handleException(new RuntimeException("Please specify a contact email address for community" +
- " user account."), request,
- response, "/credential-store/error.jsp");
+ JSPUtil.handleException(new RuntimeException("Please specify a contact email address for community"
+ + " user account."), request, response, "/credential-store/error.jsp");
return;
}
@@ -120,7 +118,6 @@ public class CredentialStoreStartServlet
additionalParameters.put(getEnvironment().getConstants().get(CALLBACK_URI_KEY), modifiedCallbackUri);
-
// Drumroll please: here is the work for this call.
try {
gtwResp = getOA4MPService().requestCert(additionalParameters);
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java Sat Jun 29 18:20:44 2013
@@ -1,57 +1,92 @@
+/*
+ *
+ * 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.store;
import org.apache.airavata.credential.store.credential.AuditInfo;
import org.apache.airavata.credential.store.credential.Credential;
/**
- * This interface provides an API for Credential Store.
- * Provides methods to manipulate credential store data.
+ * This interface provides an API for Credential Store. Provides methods to manipulate credential store data.
*/
public interface CredentialReader {
-
/**
* Retrieves the credential from the credential store.
- * @param gatewayId The gateway id
- * @param tokenId The token id associated with the credential
+ *
+ * @param gatewayId
+ * The gateway id
+ * @param tokenId
+ * The token id associated with the credential
* @return The Credential object associated with the token.
- * @throws CredentialStoreException If an error occurred while retrieving a credential.
+ * @throws CredentialStoreException
+ * If an error occurred while retrieving a credential.
*/
Credential getCredential(String gatewayId, String tokenId) throws CredentialStoreException;
/**
- * Gets the admin portal user name who retrieved given community user for
- * given portal user name.
- * @param gatewayName The gateway name
- * @param tokenId The issued token id.
+ * Gets the admin portal user name who retrieved given community user for given portal user name.
+ *
+ * @param gatewayName
+ * The gateway name
+ * @param tokenId
+ * The issued token id.
* @return The portal user name who requested given community user credentials.
*/
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 tokenId The community user name.
+ * Gets audit information related to given gateway name and community user name.
+ *
+ * @param gatewayName
+ * The gateway name.
+ * @param tokenId
+ * The community user name.
* @return CertificateAuditInfo object.
*/
AuditInfo getAuditInfo(String gatewayName, String tokenId) 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.
+ *
+ * @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;
+ 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 tokenId The issued token id.
- * @throws CredentialStoreException If an error occurred while retrieving data.
+ *
+ * @param gatewayName
+ * The gateway Id
+ * @param tokenId
+ * The issued token id.
+ * @throws CredentialStoreException
+ * If an error occurred while retrieving data.
*/
void removeCredentials(String gatewayName, String tokenId) throws CredentialStoreException;
-
}
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java Sat Jun 29 18:20:44 2013
@@ -21,12 +21,6 @@
package org.apache.airavata.credential.store.store;
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 5/8/13
- * Time: 3:44 PM
- */
-
import org.apache.airavata.common.utils.DBUtil;
import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/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?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.store;
/**
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/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?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.store;
import org.apache.airavata.credential.store.credential.Credential;
@@ -9,9 +30,10 @@ public interface CredentialWriter {
/**
* Writes given credentials to a persistent storage.
- * @param credential The credentials implementation.
+ *
+ * @param credential
+ * The credentials implementation.
*/
void writeCredentials(Credential credential) 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=1497993&r1=1497992&r2=1497993&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 Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.store.impl;
import org.apache.airavata.common.utils.DBUtil;
@@ -32,7 +53,7 @@ public class CertificateCredentialWriter
public void writeCredentials(Credential credential) throws CredentialStoreException {
- CertificateCredential certificateCredential = (CertificateCredential)credential;
+ CertificateCredential certificateCredential = (CertificateCredential) credential;
Connection connection = null;
@@ -45,7 +66,8 @@ public class CertificateCredentialWriter
credentialsDAO.deleteCredentials(certificateCredential.getCommunityUser().getGatewayName(),
certificateCredential.getToken(), connection);
// Add the new certificate
- credentialsDAO.addCredentials(certificateCredential.getCommunityUser().getGatewayName(), credential, connection);
+ credentialsDAO.addCredentials(certificateCredential.getCommunityUser().getGatewayName(), credential,
+ connection);
} catch (SQLException e) {
throw new CredentialStoreException("Unable to retrieve database connection.", e);
@@ -55,7 +77,8 @@ public class CertificateCredentialWriter
}
- public void writeCommunityUser(CommunityUser communityUser, String token, Connection connection) throws CredentialStoreException {
+ public void writeCommunityUser(CommunityUser communityUser, String token, Connection connection)
+ throws CredentialStoreException {
// First delete existing community user
communityUserDAO.deleteCommunityUserByToken(communityUser, token, connection);
@@ -65,18 +88,14 @@ public class CertificateCredentialWriter
}
- /* 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);
- }
- }*/
+ /*
+ * 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); } }
+ */
}
Modified: airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java (original)
+++ airavata/trunk/modules/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.store.impl;
import org.apache.airavata.common.utils.DBUtil;
@@ -13,7 +34,6 @@ import java.io.Serializable;
import java.sql.Connection;
import java.sql.SQLException;
-
/**
* Credential store API implementation.
*/
@@ -38,7 +58,6 @@ public class CredentialReaderImpl implem
}
}
-
@Override
public Credential getCredential(String gatewayId, String tokenId) throws CredentialStoreException {
@@ -58,8 +77,7 @@ public class CredentialReaderImpl implem
Credential credential;
try {
- credential
- = this.credentialsDAO.getCredential(gatewayName, tokenId, connection);
+ credential = this.credentialsDAO.getCredential(gatewayName, tokenId, connection);
} finally {
DBUtil.cleanup(connection);
@@ -68,8 +86,7 @@ public class CredentialReaderImpl implem
return credential.getPortalUserName();
}
- public CertificateAuditInfo getAuditInfo(String gatewayName, String tokenId)
- throws CredentialStoreException {
+ public CertificateAuditInfo getAuditInfo(String gatewayName, String tokenId) throws CredentialStoreException {
Connection connection = getConnection();
@@ -77,8 +94,8 @@ public class CredentialReaderImpl implem
try {
- CertificateCredential certificateCredential
- = (CertificateCredential)this.credentialsDAO.getCredential(gatewayName, tokenId, connection);
+ CertificateCredential certificateCredential = (CertificateCredential) this.credentialsDAO.getCredential(
+ gatewayName, tokenId, connection);
certificateAuditInfo = new CertificateAuditInfo();
@@ -100,7 +117,7 @@ public class CredentialReaderImpl implem
public void updateCommunityUserEmail(String gatewayName, String communityUser, String email)
throws CredentialStoreException {
- //TODO
+ // TODO
}
public void removeCredentials(String gatewayName, String tokenId) throws CredentialStoreException {
@@ -115,6 +132,4 @@ public class CredentialReaderImpl implem
}
-
-
}
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=1497993&r1=1497992&r2=1497993&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 Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.store.impl.db;
import org.apache.airavata.common.utils.DBUtil;
@@ -20,7 +41,8 @@ public class CommunityUserDAO extends Pa
super();
}
- public void addCommunityUser(CommunityUser user, String token, Connection connection) throws CredentialStoreException {
+ public void addCommunityUser(CommunityUser user, String token, Connection connection)
+ throws CredentialStoreException {
String sql = "insert into community_user values (?, ?, ?, ?)";
@@ -54,7 +76,6 @@ public class CommunityUserDAO extends Pa
}
}
-
public void deleteCommunityUser(CommunityUser user, Connection connection) throws CredentialStoreException {
String sql = "delete from community_user where gateway_name=? and community_user_name=?";
@@ -84,7 +105,8 @@ public class CommunityUserDAO extends Pa
}
}
- public void deleteCommunityUserByToken(CommunityUser user, String token, Connection connection) throws CredentialStoreException {
+ 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=?";
@@ -116,11 +138,11 @@ public class CommunityUserDAO extends Pa
public void updateCommunityUser(CommunityUser user) throws CredentialStoreException {
- //TODO
+ // TODO
}
public CommunityUser getCommunityUser(String gatewayName, String communityUserName, Connection connection)
- throws CredentialStoreException{
+ throws CredentialStoreException {
String sql = "select * from community_user where gateway_name=? and community_user_name=?";
@@ -135,7 +157,7 @@ public class CommunityUserDAO extends Pa
ResultSet resultSet = preparedStatement.executeQuery();
if (resultSet.next()) {
- String email = resultSet.getString("COMMUNITY_USER_EMAIL"); //TODO fix typo
+ String email = resultSet.getString("COMMUNITY_USER_EMAIL"); // TODO fix typo
return new CommunityUser(gatewayName, communityUserName, email);
@@ -157,7 +179,7 @@ public class CommunityUserDAO extends Pa
}
public CommunityUser getCommunityUserByToken(String gatewayName, String tokenId, Connection connection)
- throws CredentialStoreException{
+ throws CredentialStoreException {
String sql = "select * from community_user where gateway_name=? and token_id=?";
@@ -173,7 +195,7 @@ public class CommunityUserDAO extends Pa
if (resultSet.next()) {
String communityUserName = resultSet.getString("community_user_name");
- String email = resultSet.getString("COMMUNITY_USER_EMAIL"); //TODO fix typo
+ String email = resultSet.getString("COMMUNITY_USER_EMAIL"); // TODO fix typo
return new CommunityUser(gatewayName, communityUserName, email);
@@ -194,9 +216,8 @@ public class CommunityUserDAO extends Pa
return null;
}
-
public List<CommunityUser> getCommunityUsers(String gatewayName, Connection connection)
- throws CredentialStoreException{
+ throws CredentialStoreException {
List<CommunityUser> userList = new ArrayList<CommunityUser>();
@@ -213,7 +234,7 @@ public class CommunityUserDAO extends Pa
while (resultSet.next()) {
String userName = resultSet.getString("COMMUNITY_USER_NAME");
- String email = resultSet.getString("COMMUNITY_USER_EMAIL"); //TODO fix typo
+ String email = resultSet.getString("COMMUNITY_USER_EMAIL"); // TODO fix typo
userList.add(new CommunityUser(gatewayName, userName, email));
@@ -233,5 +254,4 @@ public class CommunityUserDAO extends Pa
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=1497993&r1=1497992&r2=1497993&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 Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.store.impl.db;
import org.apache.airavata.common.utils.DBUtil;
@@ -19,19 +40,15 @@ public class CredentialsDAO extends Pare
}
/**
- * 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 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 addCredentials(String gatewayId, Credential credential,
- Connection connection) throws CredentialStoreException {
+ public void addCredentials(String gatewayId, Credential credential, Connection connection)
+ throws CredentialStoreException {
String sql = "insert into credentials values (?, ?, ?, ?, ?)";
@@ -43,13 +60,12 @@ public class CredentialsDAO extends Pare
preparedStatement.setString(1, gatewayId);
preparedStatement.setString(2, credential.getToken());
- InputStream isCert = new ByteArrayInputStream(
- convertObjectToByteArray(credential));
+ InputStream isCert = new ByteArrayInputStream(convertObjectToByteArray(credential));
preparedStatement.setBinaryStream(3, isCert);
preparedStatement.setString(4, credential.getPortalUserName());
- java.util.Date date= new java.util.Date();
+ java.util.Date date = new java.util.Date();
Timestamp timestamp = new Timestamp(date.getTime());
preparedStatement.setTimestamp(5, timestamp);
@@ -65,7 +81,8 @@ public class CredentialsDAO extends Pare
throw new CredentialStoreException(stringBuilder.toString(), e);
} catch (UnsupportedEncodingException e) {
- StringBuilder stringBuilder = new StringBuilder("Error persisting community credentials. Unsupported encoding.");
+ StringBuilder stringBuilder = new StringBuilder(
+ "Error persisting community credentials. Unsupported encoding.");
stringBuilder.append(" gateway - ").append(gatewayId);
stringBuilder.append(" token id - ").append(credential.getToken());
@@ -73,8 +90,8 @@ public class CredentialsDAO extends Pare
throw new CredentialStoreException(stringBuilder.toString(), e);
} catch (IOException e) {
- StringBuilder stringBuilder = new StringBuilder("Error persisting community credentials. Error serializing " +
- "credentials.");
+ StringBuilder stringBuilder = new StringBuilder(
+ "Error persisting community credentials. Error serializing " + "credentials.");
stringBuilder.append(" gateway - ").append(gatewayId);
stringBuilder.append(" community user name - ").append(credential.getToken());
@@ -87,7 +104,6 @@ public class CredentialsDAO extends Pare
}
}
-
public void deleteCredentials(String gatewayName, String tokenId, Connection connection)
throws CredentialStoreException {
@@ -117,18 +133,14 @@ public class CredentialsDAO extends Pare
}
/**
- * 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 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 {
+ public void updateCredentials(String gatewayId, Credential credential, Connection connection)
+ throws CredentialStoreException {
String sql = "update CREDENTIALS set CREDENTIAL = ?, PORTAL_USER_ID = ?, TIME_PERSISTED = ? where GATEWAY_ID = ? and TOKEN_ID = ?";
@@ -137,8 +149,7 @@ public class CredentialsDAO extends Pare
try {
preparedStatement = connection.prepareStatement(sql);
- InputStream isCert = new ByteArrayInputStream(
- convertObjectToByteArray(credential));
+ InputStream isCert = new ByteArrayInputStream(convertObjectToByteArray(credential));
preparedStatement.setBinaryStream(1, isCert);
preparedStatement.setString(2, credential.getPortalUserName());
@@ -147,7 +158,6 @@ public class CredentialsDAO extends Pare
preparedStatement.setString(4, gatewayId);
preparedStatement.setString(5, credential.getToken());
-
preparedStatement.executeUpdate();
} catch (SQLException e) {
@@ -182,15 +192,11 @@ public class CredentialsDAO extends Pare
}
/**
- * 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 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 {
@@ -207,9 +213,8 @@ public class CredentialsDAO extends Pare
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());
@@ -231,8 +236,8 @@ public class CredentialsDAO extends Pare
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 stringBuilder = new StringBuilder("Error retrieving credentials for community user. Error "
+ + "de-serializing credential objects.");
stringBuilder.append("gateway - ").append(gatewayName);
stringBuilder.append("token id - ").append(tokenId);
@@ -240,8 +245,8 @@ public class CredentialsDAO extends Pare
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 stringBuilder = new StringBuilder("Error retrieving credentials for community user. Error "
+ + "de-serializing credential objects. An IO Error.");
stringBuilder.append("gateway - ").append(gatewayName);
stringBuilder.append("tokenId - ").append(tokenId);
@@ -255,20 +260,14 @@ public class CredentialsDAO extends Pare
return null;
}
-
/**
- * 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 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 {
+ public List<Credential> getCredentials(String gatewayName, Connection connection) throws CredentialStoreException {
List<Credential> credentialList = new ArrayList<Credential>();
@@ -326,10 +325,8 @@ public class CredentialsDAO extends Pare
return credentialList;
}
- public static Object convertByteArrayToObject(byte[] data) throws IOException,
- ClassNotFoundException {
- ObjectInputStream objectInputStream = new ObjectInputStream(
- new ByteArrayInputStream(data));
+ public static Object convertByteArrayToObject(byte[] data) throws IOException, ClassNotFoundException {
+ ObjectInputStream objectInputStream = new ObjectInputStream(new ByteArrayInputStream(data));
Object o = null;
try {
o = objectInputStream.readObject();
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=1497993&r1=1497992&r2=1497993&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 Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.store.impl.db;
import org.apache.airavata.common.utils.DBUtil;
Modified: airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java (original)
+++ airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.store.impl.db;
import org.apache.airavata.common.utils.DBUtil;
@@ -17,27 +38,26 @@ public class CommunityUserDAOTest extend
private CommunityUserDAO communityUserDAO;
@BeforeClass
- public static void setUpDatabase() throws Exception{
+ public static void setUpDatabase() throws Exception {
DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
waitTillServerStarts();
- String createTable = "CREATE TABLE COMMUNITY_USER\n" +
- " (\n" +
- " GATEWAY_NAME VARCHAR(256) NOT NULL,\n" +
- " COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n" +
- " TOKEN_ID VARCHAR(256) NOT NULL,\n" +
- " COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,\n" +
- " PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)\n" +
- " )";
-
+ String createTable = "CREATE TABLE COMMUNITY_USER\n" + " (\n"
+ + " GATEWAY_NAME VARCHAR(256) NOT NULL,\n"
+ + " COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n"
+ + " TOKEN_ID VARCHAR(256) NOT NULL,\n"
+ + " COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,\n"
+ + " PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)\n"
+ + " )";
String dropTable = "drop table COMMUNITY_USER";
try {
executeSQL(dropTable);
- } catch (Exception e){}
+ } catch (Exception e) {
+ }
executeSQL(createTable);
@@ -70,10 +90,10 @@ public class CommunityUserDAOTest extend
try {
- CommunityUser communityUser = new CommunityUser("gw1", "ogce","ogce@sciencegateway.org");
+ CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
- communityUser = new CommunityUser("gw1", "ogce2","ogce@sciencegateway.org");
+ communityUser = new CommunityUser("gw1", "ogce2", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token2", connection);
CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
@@ -106,13 +126,13 @@ public class CommunityUserDAOTest extend
Connection connection = getConnection();
try {
- CommunityUser communityUser = new CommunityUser("gw1", "ogce","ogce@sciencegateway.org");
+ CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
Assert.assertNotNull(user);
- communityUser = new CommunityUser("gw1", "ogce","ogce@sciencegateway.org");
+ communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.deleteCommunityUser(communityUser, connection);
user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
@@ -129,13 +149,13 @@ public class CommunityUserDAOTest extend
Connection connection = getConnection();
try {
- CommunityUser communityUser = new CommunityUser("gw1", "ogce","ogce@sciencegateway.org");
+ CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
Assert.assertNotNull(user);
- communityUser = new CommunityUser("gw1", "ogce","ogce@sciencegateway.org");
+ communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.deleteCommunityUserByToken(communityUser, "Token1", connection);
user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
@@ -145,7 +165,6 @@ public class CommunityUserDAOTest extend
connection.close();
}
-
}
@Test
@@ -154,7 +173,7 @@ public class CommunityUserDAOTest extend
Connection connection = getConnection();
try {
- CommunityUser communityUser = new CommunityUser("gw1", "ogce","ogce@sciencegateway.org");
+ CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
@@ -165,7 +184,6 @@ public class CommunityUserDAOTest extend
connection.close();
}
-
}
@Test
@@ -173,10 +191,10 @@ public class CommunityUserDAOTest extend
Connection connection = getConnection();
- CommunityUser communityUser = new CommunityUser("gw1", "ogce","ogce@sciencegateway.org");
+ CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
- communityUser = new CommunityUser("gw1", "ogce2","ogce@sciencegateway.org");
+ communityUser = new CommunityUser("gw1", "ogce2", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token2", connection);
List<CommunityUser> users = communityUserDAO.getCommunityUsers("gw1", connection);
Modified: airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java (original)
+++ airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.store.impl.db;
import junit.framework.Assert;
@@ -40,36 +61,30 @@ public class CredentialsDAOTest extends
waitTillServerStarts();
- /*String createTable = "CREATE TABLE CREDENTIALS\n" +
- "(\n" +
- " GATEWAY_NAME VARCHAR(256) NOT NULL,\n" +
- " COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n" +
- " CREDENTIAL BLOB NOT NULL,\n" +
- " PRIVATE_KEY BLOB NOT NULL,\n" +
- " NOT_BEFORE VARCHAR(256) NOT NULL,\n" +
- " NOT_AFTER VARCHAR(256) NOT NULL,\n" +
- " LIFETIME INTEGER NOT NULL,\n" +
- " REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,\n" +
- " REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',\n" +
- " PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)\n" +
- ")"; */
-
- 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 createTable = "CREATE TABLE CREDENTIALS\n" + "(\n" + " GATEWAY_NAME VARCHAR(256) NOT NULL,\n" +
+ * " COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n" + " CREDENTIAL BLOB NOT NULL,\n" +
+ * " PRIVATE_KEY BLOB NOT NULL,\n" + " NOT_BEFORE VARCHAR(256) NOT NULL,\n" +
+ * " NOT_AFTER VARCHAR(256) NOT NULL,\n" + " LIFETIME INTEGER NOT NULL,\n" +
+ * " REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,\n" +
+ * " REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',\n" +
+ * " PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)\n" + ")";
+ */
+
+ 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 dropTable = "drop table CREDENTIALS";
try {
executeSQL(dropTable);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
executeSQL(createTable);
@@ -97,7 +112,6 @@ public class CredentialsDAOTest extends
initializeKeys();
}
-
private void initializeKeys() throws Exception {
KeyStore ks = KeyStore.getInstance("JKS");
char[] password = "password".toCharArray();
@@ -137,7 +151,6 @@ public class CredentialsDAOTest extends
}
-
@Test
public void testKeyReading() throws Exception {
initializeKeys();
@@ -188,13 +201,18 @@ public class CredentialsDAOTest extends
CertificateCredential certificateCredential = getTestCredentialObject();
byte[] array = CredentialsDAO.convertObjectToByteArray(certificateCredential);
- CertificateCredential readCertificateCredential = (CertificateCredential) CredentialsDAO.convertByteArrayToObject(array);
+ CertificateCredential readCertificateCredential = (CertificateCredential) CredentialsDAO
+ .convertByteArrayToObject(array);
Assert.assertEquals(certificateCredential.getCertificate(), readCertificateCredential.getCertificate());
- Assert.assertEquals(certificateCredential.getCertificateRequestedTime(), readCertificateCredential.getCertificateRequestedTime());
- Assert.assertEquals(certificateCredential.getCommunityUser().getGatewayName(), readCertificateCredential.getCommunityUser().getGatewayName());
- Assert.assertEquals(certificateCredential.getCommunityUser().getUserEmail(), readCertificateCredential.getCommunityUser().getUserEmail());
- Assert.assertEquals(certificateCredential.getCommunityUser().getUserName(), readCertificateCredential.getCommunityUser().getUserName());
+ Assert.assertEquals(certificateCredential.getCertificateRequestedTime(),
+ readCertificateCredential.getCertificateRequestedTime());
+ Assert.assertEquals(certificateCredential.getCommunityUser().getGatewayName(), readCertificateCredential
+ .getCommunityUser().getGatewayName());
+ Assert.assertEquals(certificateCredential.getCommunityUser().getUserEmail(), readCertificateCredential
+ .getCommunityUser().getUserEmail());
+ Assert.assertEquals(certificateCredential.getCommunityUser().getUserName(), readCertificateCredential
+ .getCommunityUser().getUserName());
Assert.assertEquals(certificateCredential.getLifeTime(), readCertificateCredential.getLifeTime());
Assert.assertEquals(certificateCredential.getNotAfter(), readCertificateCredential.getNotAfter());
Assert.assertEquals(certificateCredential.getNotBefore(), readCertificateCredential.getNotBefore());
@@ -218,8 +236,8 @@ public class CredentialsDAOTest extends
Connection connection = getConnection();
try {
- CertificateCredential certificateCredential
- = (CertificateCredential)credentialsDAO.getCredential("gw1", "tom", connection);
+ CertificateCredential certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1",
+ "tom", connection);
Assert.assertNotNull(certificateCredential);
Assert.assertEquals("jerry", certificateCredential.getPortalUserName());
Assert.assertEquals(x509Certificate, certificateCredential.getCertificate());
@@ -237,13 +255,13 @@ public class CredentialsDAOTest extends
Connection connection = getConnection();
try {
- CertificateCredential certificateCredential
- = (CertificateCredential)credentialsDAO.getCredential("gw1", "tom", connection);
+ CertificateCredential certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1",
+ "tom", connection);
Assert.assertNotNull(certificateCredential);
credentialsDAO.deleteCredentials("gw1", "tom", connection);
- certificateCredential = (CertificateCredential)credentialsDAO.getCredential("gw1", "tom", connection);
+ certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
Assert.assertNull(certificateCredential);
} finally {
@@ -264,7 +282,7 @@ public class CredentialsDAOTest extends
certificateCredential.setToken("tom");
certificateCredential.setCommunityUser(communityUser);
certificateCredential.setCertificate(x509Certificate);
- //certificateCredential.setPrivateKey(privateKey);
+ // certificateCredential.setPrivateKey(privateKey);
certificateCredential.setPortalUserName("test2");
certificateCredential.setLifeTime(50);
certificateCredential.setNotBefore("15 OCT 2012 5:34:23");
@@ -272,11 +290,11 @@ public class CredentialsDAOTest extends
credentialsDAO.updateCredentials(communityUser.getGatewayName(), certificateCredential, connection);
- certificateCredential = (CertificateCredential)credentialsDAO.getCredential("gw1", "tom", connection);
+ certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
Assert.assertEquals("CN=Airavata Project, OU=IU, O=Indiana University, L=Bloomington, ST=IN, C=US",
certificateCredential.getCertificate().getIssuerDN().toString());
- //Assert.assertNotNull(certificateCredential.getPrivateKey());
+ // Assert.assertNotNull(certificateCredential.getPrivateKey());
Assert.assertEquals("test2", certificateCredential.getPortalUserName());
} finally {
@@ -294,10 +312,11 @@ public class CredentialsDAOTest extends
try {
- CertificateCredential certificateCredential = (CertificateCredential)credentialsDAO.getCredential("gw1", "tom", connection);
+ CertificateCredential certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1",
+ "tom", connection);
Assert.assertEquals("CN=Airavata Project, OU=IU, O=Indiana University, L=Bloomington, ST=IN, C=US",
certificateCredential.getCertificate().getIssuerDN().toString());
- // Assert.assertNotNull(certificateCredential.getPrivateKey());
+ // Assert.assertNotNull(certificateCredential.getPrivateKey());
} finally {
connection.close();
Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExecutionErrorResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExecutionErrorResource.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExecutionErrorResource.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExecutionErrorResource.java Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.persistance.registry.jpa.resources;
import java.sql.Timestamp;
@@ -76,13 +97,12 @@ public class ExecutionErrorResource exte
execution_error.setGfacJobID(gfacJobID);
em.persist(execution_error);
errorID = execution_error.getError_id();
-// System.out.println("Error ID : " + errorID);
+ // System.out.println("Error ID : " + errorID);
em.getTransaction().commit();
em.close();
}
-
public ExperimentDataResource getExperimentDataResource() {
return experimentDataResource;
}
Modified: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java?rev=1497993&r1=1497992&r2=1497993&view=diff
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java (original)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java Sat Jun 29 18:20:44 2013
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.rest.mappings.resourcemappings;
import org.apache.airavata.registry.api.workflow.ExecutionError;