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 2015/03/05 20:36:23 UTC

[01/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Repository: airavata
Updated Branches:
  refs/heads/master 66de3728e -> 58c58cf20


http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/ServletRequestHelper.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/ServletRequestHelper.java b/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/ServletRequestHelper.java
new file mode 100644
index 0000000..c4a2c47
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/ServletRequestHelper.java
@@ -0,0 +1,129 @@
+/*
+ *
+ * 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.credentialstore.session;
+
+import org.apache.airavata.common.context.RequestContext;
+import org.apache.airavata.common.context.WorkflowContext;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.security.AuthenticationException;
+import org.apache.commons.codec.binary.Base64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Helper class to extract request information.
+ */
+public class ServletRequestHelper {
+
+    /**
+     * Header names
+     */
+    public static final String AUTHORISATION_HEADER_NAME = "Authorization";
+    private final static Logger logger = LoggerFactory.getLogger(ServletRequestHelper.class);
+    protected void addIdentityInformationToSession(HttpServletRequest servletRequest) throws AuthenticationException {
+
+        addUserToSession(null, servletRequest);
+    }
+
+    public void addUserToSession(String userName, HttpServletRequest servletRequest) throws AuthenticationException {
+
+        if (userName == null) {
+            userName = getUserName(servletRequest);
+        }
+
+        String gatewayId = getGatewayId(servletRequest);
+
+        if (servletRequest.getSession() != null) {
+			try {
+				servletRequest.getSession().setAttribute(Constants.USER_IN_SESSION, userName);
+				servletRequest.getSession().setAttribute(ServerSettings.getDefaultUserGateway(), gatewayId);
+			} catch (ApplicationSettingsException e) {
+                logger.error(e.getMessage(), e);
+			}
+        }
+
+        addToContext(userName, gatewayId);
+    }
+
+    String getUserName(HttpServletRequest httpServletRequest) throws AuthenticationException {
+
+        String basicHeader = httpServletRequest.getHeader(AUTHORISATION_HEADER_NAME);
+
+        if (basicHeader == null) {
+            throw new AuthenticationException("Authorization Required");
+        }
+
+        String[] userNamePasswordArray = basicHeader.split(" ");
+
+        if (userNamePasswordArray == null || userNamePasswordArray.length != 2) {
+            throw new AuthenticationException("Authorization Required");
+        }
+
+        String decodedString = decode(userNamePasswordArray[1]);
+
+        String[] array = decodedString.split(":");
+
+        if (array == null || array.length != 1) {
+            throw new AuthenticationException("Authorization Required");
+        }
+
+        return array[0];
+
+    }
+
+    public String decode(String encoded) {
+        return new String(Base64.decodeBase64(encoded.getBytes()));
+    }
+
+    String getGatewayId(HttpServletRequest request) throws AuthenticationException {
+        String gatewayId = null;
+		try {
+			gatewayId = request.getHeader(ServerSettings.getDefaultUserGateway());
+		} catch (ApplicationSettingsException e1) {
+            logger.error(e1.getMessage(), e1);
+		}
+
+        if (gatewayId == null) {
+            try {
+                gatewayId = ServerSettings.getDefaultUserGateway();
+            } catch (ApplicationSettingsException e) {
+                throw new AuthenticationException("Unable to retrieve default gateway", e);
+            }
+        }
+
+        return gatewayId;
+    }
+
+    public void addToContext(String userName, String gatewayId) {
+
+        RequestContext requestContext = new RequestContext();
+        requestContext.setUserIdentity(userName);
+        requestContext.setGatewayId(gatewayId);
+
+        WorkflowContext.set(requestContext);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/resources/airavata-server.properties b/modules/credential-store/credential-store-webapp/src/main/resources/airavata-server.properties
new file mode 100644
index 0000000..fb02901
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/resources/airavata-server.properties
@@ -0,0 +1,234 @@
+#
+#
+# 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.
+#
+
+###########################################################################
+#
+#  This properties file provides configuration for all Airavata Services:
+#  API Server, Registry, Workflow Interpreter, GFac, Orchestrator
+#
+###########################################################################
+
+###########################################################################
+#  API Server Registry Configuration
+###########################################################################
+
+#for derby [AiravataJPARegistry]
+registry.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+registry.jdbc.url=jdbc:derby://localhost:1527/persistent_data;create=true;user=airavata;password=airavata
+# MySql database configuration
+#registry.jdbc.driver=com.mysql.jdbc.Driver
+#registry.jdbc.url=jdbc:mysql://localhost:3306/persistent_data
+registry.jdbc.user=airavata
+registry.jdbc.password=airavata
+start.derby.server.mode=true
+validationQuery=SELECT 1 from CONFIGURATION
+jpa.cache.size=5000
+#jpa.connection.properties=MaxActive=10,MaxIdle=5,MinIdle=2,MaxWait=60000,testWhileIdle=true,testOnBorrow=true
+
+# Properties for default user mode
+default.registry.user=admin
+default.registry.password=admin
+default.registry.password.hash.method=SHA
+default.registry.gateway=default
+
+#ip=127.0.0.1
+
+###########################################################################
+#  Application Catalog DB Configuration
+###########################################################################
+#for derby [AiravataJPARegistry]
+appcatalog.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+appcatalog.jdbc.url=jdbc:derby://localhost:1527/app_catalog;create=true;user=airavata;password=airavata
+# MySql database configuration
+#appcatalog.jdbc.driver=com.mysql.jdbc.Driver
+#appcatalog.jdbc.url=jdbc:mysql://localhost:3306/app_catalog
+appcatalog.jdbc.user=airavata
+appcatalog.jdbc.password=airavata
+appcatalog.validationQuery=SELECT 1 from CONFIGURATION
+
+###########################################################################
+#  Server module Configuration
+###########################################################################
+
+servers=apiserver,orchestrator,gfac,workflowserver
+#shutdown.trategy=NONE
+shutdown.trategy=SELF_TERMINATE
+
+
+apiserver.server.host=localhost
+apiserver.server.port=8930
+apiserver.server.min.threads=50
+workflow.server.host=localhost
+workflow.server.port=8931
+orchestrator.server.host=localhost
+orchestrator.server.port=8940
+gfac.server.host=localhost
+gfac.server.port=8950
+orchestrator.server.min.threads=50
+
+###########################################################################
+# Credential Store module Configuration
+###########################################################################
+credential.store.keystore.url=/Users/lahirugunathilake/Downloads/airavata_sym.jks
+credential.store.keystore.alias=airavata
+credential.store.keystore.password=airavata
+credential.store.jdbc.url=jdbc:derby://localhost:1527/persistent_data;create=true;user=airavata;password=airavata
+credential.store.jdbc.user=airavata
+credential.store.jdbc.password=airavata
+credential.store.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+
+notifier.enabled=false
+#period in milliseconds
+notifier.duration=5000
+
+email.server=smtp.googlemail.com
+email.server.port=465
+email.user=airavata
+email.password=xxx
+email.ssl=true
+email.from=airavata@apache.org
+
+###########################################################################
+# Airavata GFac MyProxy GSI credentials to access Grid Resources.
+###########################################################################
+#
+# Security Configuration used by Airavata Generic Factory Service
+#  to interact with Computational Resources.
+#
+gfac=org.apache.airavata.gfac.server.GfacServer
+myproxy.server=myproxy.teragrid.org
+myproxy.username=ogce
+myproxy.password=
+myproxy.life=3600
+# XSEDE Trusted certificates can be downloaded from https://software.xsede.org/security/xsede-certs.tar.gz
+trusted.cert.location=/Users/lahirugunathilake/Downloads/certificates
+# SSH PKI key pair or ssh password can be used SSH based authentication is used.
+# if user specify both password authentication gets the higher preference
+
+################# ---------- For ssh key pair authentication ------------------- ################
+#public.ssh.key=/path to public key for ssh
+#ssh.username=username for ssh connection
+#private.ssh.key=/path to private key file for ssh
+#ssh.keypass=passphrase for the private key
+
+
+################# ---------- For ssh key pair authentication ------------------- ################
+#ssh.username=username for ssh connection
+#ssh.password=Password for ssh connection
+
+
+
+###########################################################################
+# Airavata Workflow Interpreter Configurations
+###########################################################################
+
+#runInThread=true
+#provenance=true
+#provenanceWriterThreadPoolSize=20
+#gfac.embedded=true
+#workflowserver=org.apache.airavata.api.server.WorkflowServer
+
+
+###########################################################################
+# API Server module Configuration
+###########################################################################
+apiserver=org.apache.airavata.api.server.AiravataAPIServer
+
+###########################################################################
+# Workflow Server module Configuration
+###########################################################################
+
+workflowserver=org.apache.airavata.api.server.WorkflowServer
+
+###########################################################################
+# Advance configuration to change service implementations
+###########################################################################
+# If false, disables two phase commit when submitting jobs
+TwoPhase=true
+#
+# Class which implemented HostScheduler interface. It will determine the which host to submit the request
+#
+host.scheduler=org.apache.airavata.gfac.core.scheduler.impl.SimpleHostScheduler
+
+###########################################################################
+# Monitoring module Configuration
+###########################################################################
+
+#This will be the primary monitoring tool which runs in airavata, in future there will be multiple monitoring
+#mechanisms and one would be able to start a monitor
+monitors=org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor,org.apache.airavata.gfac.monitor.impl.LocalJobMonitor
+
+
+###########################################################################
+# AMQP Notification Configuration
+###########################################################################
+
+
+amqp.notification.enable=1
+
+amqp.broker.host=localhost
+amqp.broker.port=5672
+amqp.broker.username=guest
+amqp.broker.password=guest
+
+amqp.sender=org.apache.airavata.wsmg.client.amqp.rabbitmq.AMQPSenderImpl
+amqp.topic.sender=org.apache.airavata.wsmg.client.amqp.rabbitmq.AMQPTopicSenderImpl
+amqp.broadcast.sender=org.apache.airavata.wsmg.client.amqp.rabbitmq.AMQPBroadcastSenderImpl
+
+#,org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor
+#This is the amqp related configuration and this lists down the Rabbitmq host, this is an xsede specific configuration
+amqp.hosts=info1.dyn.teragrid.org,info2.dyn.teragrid.org
+proxy.file.path=/Users/lahirugunathilake/Downloads/x509up_u503876
+connection.name=xsede
+#publisher
+activity.listeners=org.apache.airavata.gfac.core.monitor.AiravataJobStatusUpdator,org.apache.airavata.gfac.core.monitor.AiravataTaskStatusUpdator,org.apache.airavata.gfac.core.monitor.AiravataWorkflowNodeStatusUpdator,org.apache.airavata.api.server.listener.AiravataExperimentStatusUpdator,org.apache.airavata.gfac.core.monitor.GfacInternalStatusUpdator,org.apache.airavata.workflow.engine.util.ProxyMonitorPublisher
+publish.rabbitmq=false
+activity.publisher=org.apache.airavata.messaging.core.impl.RabbitMQPublisher
+rabbitmq.broker.url=amqp://localhost:5672
+rabbitmq.exchange.name=airavata_rabbitmq_exchange
+
+###########################################################################
+# Orchestrator module Configuration
+###########################################################################
+
+#job.submitter=org.apache.airavata.orchestrator.core.impl.GFACEmbeddedJobSubmitter
+job.submitter=org.apache.airavata.orchestrator.core.impl.GFACServiceJobSubmitter
+job.validators=org.apache.airavata.orchestrator.core.validator.impl.SimpleAppDataValidator,org.apache.airavata.orchestrator.core.validator.impl.ExperimentStatusValidator
+submitter.interval=10000
+threadpool.size=10
+start.submitter=true
+embedded.mode=true
+enable.validation=true
+orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer
+
+###########################################################################
+# Zookeeper Server Configuration
+###########################################################################
+
+embedded.zk=true
+zookeeper.server.host=localhost
+zookeeper.server.port=2181
+airavata-server=/api-server
+orchestrator-server=/orchestrator-server
+gfac-server=/gfac-server
+gfac-experiments=/gfac-experiments
+gfac-server-name=gfac-node0
+orchestrator-server-name=orch-node0
+airavata-server-name=api-node0

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/client.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/client.xml b/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/client.xml
new file mode 100644
index 0000000..bc721ed
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/client.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Licensed to the Apache Software
+	Foundation (ASF) under one or more contributor license agreements. See the
+	NOTICE file distributed with this work for additional information regarding
+	copyright ownership. The ASF licenses this file to you under the Apache License,
+	Version 2.0 (theƏ "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+	Unless required by applicable law or agreed to in writing, software distributed
+	under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
+	OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the License. -->
+
+<config>
+    <client name="acs">
+        <logging
+                logFileName="../logs/oa4mp.log"
+                logName="oa4mp"
+                logSize="1000000"
+                logFileCount="2"
+                debug="true"/>
+        <id>myproxy:oa4mp,2012:/client/5a323fc6fcffcff7a95401046a303520</id>
+        <serviceUri>https://oa4mp.xsede.org/oauth</serviceUri>
+        <callbackUri>https://localhost:8443/credential-store/callback</callbackUri>
+        <!--callbackUri>http://149.165.228.118/PHP-Reference-Gateway/xsede_login.php</callbackUri-->
+        <lifetime>864000</lifetime>
+        <publicKeyFile>/Users/chathuri/dev/airavata/credential-store/oa4mp/oauth-pubkey.pem</publicKeyFile>
+        <privateKeyFile>/Users/chathuri/dev/airavata/credential-store/oa4mp/oauth-privkey.pk8</privateKeyFile>
+    </client>
+
+    <credential-store>
+        <successUri>http://gw120.iu.xsede.org/PHP-Reference-Gateway/</successUri>
+        <errorUri>/credential-store/error.jsp</errorUri>
+        <redirectUri>/credential-store/show-redirect.jsp</redirectUri>
+    </credential-store>
+
+</config>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/oauth-privkey.pk8
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/oauth-privkey.pk8 b/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/oauth-privkey.pk8
new file mode 100644
index 0000000..60f5b03
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/oauth-privkey.pk8
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCx/4hqCePa3scs
+oyGuwjnNdQCGfoPBlaCfl02Xq4L623EygIVo0faCX1ZZ/gA9ldw0TqZ6weCHfGck
+22TLeFQnJ4plAqJMMUbYwqmhnSsC9zTuc+c/yzcvdw2aCLPkMXnofFUasQEGhPI3
+/avTHOeUYBeu4ZU3u7G2Dp0jMDg1yh95v0FnGAjSPSBWQm1q4sxT90YB8jZyGvZ8
+kRs4S9Ik8Vz1VKNHJ16LZOuThfsRV4Af7vM8jXztjKUsrxQf1ZpKauAvXbJcDS2O
+pTjHWSvASk2pQxnDZDNcENE40MtG7V7qiDblMCuYumO8xnsJIGLreMKnSOQZKnDL
+uoBPNLB9AgMBAAECggEBAIJtcfHxaUr5rwygRJAftec88rOahMUW9Om8Hpkijglv
+PtT4o8kZAP6rCUVL/7Ug2IhjkU2mPvZIS/QP5x3JADDoolo9wdr+yKEQkuffmKLF
+rb2EpFB0ge1/2TGjat2s+11Frb6vMMcsJ6ircnpxVae9ed0lYwfBuwhiUPZ14NpY
+Figcq4mbM1fOmKIc035sR/fRVeuSEYPguw0sZkkx9LPGluvNXypwhfho60WCpxaB
+tgAadJRQgTEqz4kjHDD7xqY0w/KUJyqCOaJHnv2RmrdwrzDWFls6ETcc93PmINJU
+Mt2uLZZdd2nlZki91EhHA5XpPC1LoM2qXKaShfUMDWkCgYEA2oSVtz0ftT1njuX2
+OjsJi3ENOjmSuHaw81h72ZcIskCVrxZVeq0LGJdBQt361Q5ZhtnIgPA1bJXWtQ9s
+miFGkkPiPJb5GI45aLqpv+dJ/F/tXa0Q9LN++hfW8fKN8LejlM6tTiiYs3EqYEXO
+qqcLPoptxak8ZwDkOfj8yvJib6cCgYEA0IesCrCy8fpjVeDQdiAlIZqsecPJ2+Fz
+jLMik2hvAk6Yiyd8DmK8HMtSPfYMN4BhiphW49TXSyIoFEeCRQE8KMdSu3W4Z1wP
+AURZzQL78GRHc1n7EgCi2gzu38rSQDekmaQYr/hw+IlTpURjT68pDGKYXOybbjxu
+zUb67PHaAzsCgYADgs/ZAt1ojxUD4cQECYDMwcNBpT0rQ5TyRACxbVDRdGIzTvuO
+ngsomP2OcnyeQb3EgelL0RA6r2mkvRu0mkZFAVw4NwDHmTlo6l7h23h/2pa4w5gb
+Jmsq34kvmAMZ1AmH0Y5NTC+v6miQ5W49pbNzjMvYujBjQ0tndw2wwRY9zwKBgQDG
+FksgcI/b+z1Hg+Kig5CiJlr25DypibWJD1Wl74ucBmszrNNUmwgU1jOOtl8Ojf6a
+eHH5xOKq9YxbDz65LB4oood9masNTE7YpkQj0lTfG3MgKXatuDr6pVR49CLba8AJ
+Tu9AoeE2xsTVdmxccoiswi/3/a78fZ3HlEiism+lpwKBgCx7aX3MESqgxbf1kHgI
+Tu0nnvu06UwzAhBU6IpGKCqwu8zwfGN/PTTTz95hySUc1S4fSLuHVrdTAQTT3Zwr
+hwX85AxYdiyGhbeXFLue+eDWQ7PxAKXfRAwsKpdC72ixkXVqnVRh2yhRMPqKqnEu
+A5i3nuKHICZgD2fwQf+A8OL6
+-----END PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/oauth-pubkey.pem
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/oauth-pubkey.pem b/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/oauth-pubkey.pem
new file mode 100644
index 0000000..f094a6d
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/resources/credential-store/oauth-pubkey.pem
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsf+Iagnj2t7HLKMhrsI5
+zXUAhn6DwZWgn5dNl6uC+ttxMoCFaNH2gl9WWf4APZXcNE6mesHgh3xnJNtky3hU
+JyeKZQKiTDFG2MKpoZ0rAvc07nPnP8s3L3cNmgiz5DF56HxVGrEBBoTyN/2r0xzn
+lGAXruGVN7uxtg6dIzA4Ncofeb9BZxgI0j0gVkJtauLMU/dGAfI2chr2fJEbOEvS
+JPFc9VSjRydei2Trk4X7EVeAH+7zPI187YylLK8UH9WaSmrgL12yXA0tjqU4x1kr
+wEpNqUMZw2QzXBDRONDLRu1e6og25TArmLpjvMZ7CSBi63jCp0jkGSpwy7qATzSw
+fQIDAQAB
+-----END PUBLIC KEY-----

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/WEB-INF/web.xml b/modules/credential-store/credential-store-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..252f889
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more
+    contributor license agreements. See the NOTICE file ~ distributed with this
+    work for additional information ~ regarding copyright ownership. The ASF
+    licenses this file ~ to you under the Apache License, Version 2.0 (the ~
+    "License"); you may not use this file except in compliance ~ with the License.
+    You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0
+    ~ ~ Unless required by applicable law or agreed to in writing, ~ software
+    distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT
+    WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
+    License for the ~ specific language governing permissions and limitations
+    ~ under the License. -->
+
+<!-- This web.xml file is not required when using Servlet 3.0 container,
+     see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e194 -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://java.sun.com/xml/ns/javaee"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         id="WebApp_ID" version="2.5">
+
+    <listener>
+        <listener-class>org.apache.airavata.credential.store.servlet.CredentialBootstrapper</listener-class>
+    </listener>
+
+    <context-param>
+        <param-name>oa4mp:client.config.file</param-name>
+        <param-value>${catalina.home}/webapps/credential-store/WEB-INF/classes/credential-store/client.xml</param-value>
+    </context-param>
+
+    <!-- Credential store parameters -->
+    <context-param>
+        <param-name>credential-store-jdbc-url</param-name>
+        <param-value>jdbc:mysql://localhost/airavata</param-value>
+    </context-param>
+
+    <context-param>
+        <param-name>credential-store-db-user</param-name>
+        <param-value>root</param-value>
+    </context-param>
+
+    <context-param>
+        <param-name>credential-store-db-password</param-name>
+        <param-value>root123</param-value>
+    </context-param>
+
+    <context-param>
+        <param-name>credential-store-db-driver</param-name>
+        <param-value>com.mysql.jdbc.Driver</param-value>
+    </context-param>
+
+    <!-- ========================= Security Related Configurations go here ================================== -->
+
+    <filter>
+        <filter-name>CORS Filter</filter-name>
+        <filter-class>org.ebaysf.web.cors.CORSFilter</filter-class>
+        <init-param>
+            <description>A comma separated list of allowed origins. Note: An '*' cannot be used for an allowed origin when using credentials.</description>
+            <param-name>cors.allowed.origins</param-name>
+            <param-value>*</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.allowed.methods</param-name>
+            <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.allowed.headers</param-name>
+            <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.exposed.headers</param-name>
+            <param-value></param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.support.credentials</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.logging.enabled</param-name>
+            <param-value>false</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.preflight.maxage</param-name>
+            <param-value>1800</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.request.decorate</param-name>
+            <param-value>true</param-value>
+        </init-param>
+    </filter>
+
+    <filter-mapping>
+        <filter-name>CORS Filter</filter-name>
+        <url-pattern>/user-store/*</url-pattern>
+    </filter-mapping>
+
+    <!-- ================================ End Security Related Configurations =============================== -->
+
+    <!-- Credential Store Configurations -->
+    <servlet>
+        <servlet-name>credential-store-start</servlet-name>
+        <!--internal name of the servlet-->
+        <servlet-class>org.apache.airavata.credential.store.servlet.CredentialStoreStartServlet</servlet-class>
+
+        <load-on-startup>1</load-on-startup>
+        <!--load as soon as tomcat starts?-->
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>credential-store-start</servlet-name>
+        <!--the servlet-name above-->
+        <url-pattern>/acs-start-servlet</url-pattern>
+        <!--what needs to be in the url, so http://foo.org/client/simple-->
+    </servlet-mapping>
+
+    <servlet>
+        <servlet-name>callback</servlet-name>
+        <!--internal name of the servlet-->
+        <servlet-class>org.apache.airavata.credential.store.servlet.CredentialStoreCallbackServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+        <!--load as soon as tomcat starts?-->
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>callback</servlet-name>
+        <!--the servlet-name above-->
+        <url-pattern>/callback</url-pattern>
+        <!--what needs to be in the url, so http://foo.org/client/simple-->
+    </servlet-mapping>
+</web-app>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/acs/index.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/acs/index.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/acs/index.jsp
new file mode 100644
index 0000000..e7626fa
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/acs/index.jsp
@@ -0,0 +1,44 @@
+<%--
+  ~ 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.
+  --%>
+  
+<html>
+<body>
+<h2>Sample Portal</h2>
+<p>This demonstrates how portal can use Credential Store to obtain community credentials ...</p>
+<form name="input" action="../acs-start-servlet" method="post">
+
+    <table border="0">
+        <tr>
+            <td>Gateway Name</td>
+            <td><input type="text" name="gatewayName"></td>
+        </tr>
+        <tr>
+            <td>Portal Username</td>
+            <td><input type="text" name="portalUserName"></td>
+        </tr>
+        <tr>
+            <td>Contact Email</td>
+            <td><input type="text" name="email"></td>
+        </tr>
+    </table>
+
+    <input type="submit" value="Submit">
+</form>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/error.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/error.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/error.jsp
new file mode 100644
index 0000000..adc430d
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/error.jsp
@@ -0,0 +1,53 @@
+<%@ page import="org.apache.airavata.credential.store.util.CredentialStoreConstants" %>
+<%--
+  ~ 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.
+  --%>
+  
+
+<%
+    String gatewayName = request.getParameter(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER);
+    String portalUserName = request.getParameter(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER);
+    Throwable exception = (Throwable) request.getAttribute("exception");
+
+%>
+
+<html>
+<body>
+<h1>Credential Store</h1>
+<p>An error occurred while processing</p>
+<p>
+    Gateway Name - <%=gatewayName%>. Portal user name - <%=portalUserName%>.
+    Exception -
+
+</p>
+
+<p>
+    <%
+
+        out.println("Exception - " + exception.getMessage());
+        out.println();
+        StackTraceElement[] elements = exception.getStackTrace();
+        for (StackTraceElement element : elements) {
+            out.print("         ");
+            out.println(element.toString());
+        }
+
+    %>
+</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/password-credentials.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/password-credentials.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/password-credentials.jsp
new file mode 100644
index 0000000..59a1e04
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/password-credentials.jsp
@@ -0,0 +1,33 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+
+<html>
+<body>
+<h2>Store Passwords</h2>
+<p>This demonstrates how portal can use Credential Store to obtain community credentials ...</p>
+<form name="input" action="../airavata-registry-rest-services/credential-store" method="post">
+
+    Gateway Name   : <input type="text" name="gatewayName"><br>
+    Portal Username: <input type="text" name="portalUserName"><br>
+    Contact Email: <input type="text" name="email">
+
+    <input type="submit" value="Submit">
+</form>
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/show-redirect.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/show-redirect.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/show-redirect.jsp
new file mode 100644
index 0000000..84b54cf
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/show-redirect.jsp
@@ -0,0 +1,44 @@
+<%--
+  ~ 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.
+  --%>
+  
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+<%
+    String redirectUrlInRequest = (String) request.getAttribute("redirectUrl");
+%>
+
+<html>
+<head>
+    <script type="text/javascript">
+        <!--
+        function redirect(){
+            window.location = "<%=redirectUrlInRequest%>"
+        }
+        //-->
+    </script>
+</head>
+<body onLoad="setTimeout('redirect()', 1000)">
+<h2>You will be now redirect to MyProxy portal !</h2>
+<p>
+    If your browser didn't redirect to MyProxy Portal within 1 minute click following link,
+    <br><br> <a href="<%=redirectUrlInRequest%>"><%=redirectUrlInRequest%></a>
+</p>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/success.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/success.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/success.jsp
new file mode 100644
index 0000000..f2964d0
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/credential-store/success.jsp
@@ -0,0 +1,25 @@
+<%--
+  ~ 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.
+  --%>
+  
+<html>
+<body>
+<h1>Credential Store</h1>
+<p>Certificate Successfully Stored !</p>
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/acs.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/acs.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/acs.jsp
new file mode 100644
index 0000000..94bc6d9
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/acs.jsp
@@ -0,0 +1,62 @@
+<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %>
+<%--
+  Created by IntelliJ IDEA.
+  User: thejaka
+  Date: 8/5/13
+  Time: 4:48 PM
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%--
+  ~ 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.
+  --%>
+
+
+<html>
+<body>
+
+<table width="100%" border="0">
+    <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr>
+</table>
+
+<h2>Sample Gateway</h2>
+
+
+
+<p>This demonstrates how portal can use Credential Store to obtain community credentials ...</p>
+<form name="input" action="https://localhost:8443/airavata/acs-start-servlet" method="post">
+
+    <table border="0">
+        <tr>
+            <td>Gateway Name</td>
+            <td><input type="text" name="gatewayName" value="default" readonly="readonly"></td>
+        </tr>
+        <tr>
+            <td>Portal Username</td>
+            <td><input type="text" name="portalUserName"></td>
+        </tr>
+        <tr>
+            <td>Contact Email</td>
+            <td><input type="text" name="email"></td>
+        </tr>
+    </table>
+
+    <input type="submit" value="Submit">
+</form>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/callback.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/callback.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/callback.jsp
new file mode 100644
index 0000000..560f64f
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/callback.jsp
@@ -0,0 +1,78 @@
+<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %>
+<%--
+  Created by IntelliJ IDEA.
+  User: thejaka
+  Date: 8/5/13
+  Time: 4:48 PM
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%--
+  ~ 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.
+  --%>
+
+<%
+    SampleGateway sampleGateway = (SampleGateway)session.getAttribute(SampleGateway.GATEWAY_SESSION);
+
+    boolean success = false;
+
+    String tokenId = request.getParameter("tokenId");
+
+    if (tokenId != null) {
+        sampleGateway.updateTokenId(tokenId);
+        success = true;
+    }
+%>
+
+<html>
+<body>
+
+<table width="100%" border="0">
+    <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr>
+</table>
+
+<h2>Sample Gateway</h2>
+<%
+    out.println("The received token id - ");
+    out.println(tokenId);
+
+    if (success) {
+%>
+<p>Token id successfully updated.</p>
+
+<p>
+    View users who obtained token id.
+<ol>
+    <li><a href="list_users.jsp">List Users</a></li>
+</ol>
+</p>
+
+<%
+    } else {
+
+%>
+<p> Error updating token id.</p>
+<%
+
+    }
+
+%>
+
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/list_users.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/list_users.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/list_users.jsp
new file mode 100644
index 0000000..36883b7
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/list_users.jsp
@@ -0,0 +1,78 @@
+<%--
+  ~ 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.
+  --%>
+
+<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.apache.airavata.sample.gateway.userstore.User" %>
+<%--
+  Created by IntelliJ IDEA.
+  User: thejaka
+  Date: 8/5/13
+  Time: 12:30 PM
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+    SampleGateway sampleGateway = (SampleGateway)session.getAttribute(SampleGateway.GATEWAY_SESSION);
+%>
+
+<html>
+<head>
+    <title>List Users</title>
+</head>
+<body>
+
+<table width="100%" border="0">
+    <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr>
+</table>
+
+<h1>Sample Gateway</h1>
+
+
+<p> This page lists all users and their attributes. </p>
+
+<table>
+    <tr>
+        <td>UserName</td>
+        <td>E-Mail</td>
+        <td>TokenId</td>
+    </tr>
+<%
+    List<User> userList = sampleGateway.getAllUsers();
+    for (User u : userList) {
+%>
+    <tr>
+        <td>
+            <%=u.getUserName() %>
+        </td>
+        <td>
+            <%=u.getEmail() %>
+        </td>
+        <td>
+            <%=u.getToken() %>
+        </td>
+
+    </tr>
+    <%
+        }
+    %>
+</table>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/logout.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/logout.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/logout.jsp
new file mode 100644
index 0000000..63d90be
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/logout.jsp
@@ -0,0 +1,35 @@
+<%--
+  ~ 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.
+  --%>
+<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %><%
+    session.removeAttribute("userName");
+    session.removeAttribute(SampleGateway.GATEWAY_SESSION);
+    session.invalidate();
+%>
+
+<html>
+<head>
+    <script language=javascript>
+        function redirect(){
+            window.location = "../index.jsp";
+        }
+    </script>
+</head>
+<body onload="redirect()">
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/user.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/user.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/user.jsp
new file mode 100644
index 0000000..1fd1957
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/gateway/user.jsp
@@ -0,0 +1,102 @@
+<%--
+  ~ 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.
+  --%>
+
+<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %>
+<%--
+  Created by IntelliJ IDEA.
+  User: thejaka
+  Date: 7/31/13
+  Time: 5:08 PM
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+    String loginScreen = request.getParameter("loginScreen");
+
+    String user = (String)session.getAttribute("userName");
+    boolean authenticate = false;
+
+    if (loginScreen != null && loginScreen.equals("true")) {
+        SampleGateway sampleGateway = null;
+        sampleGateway = (SampleGateway) session.getAttribute(SampleGateway.GATEWAY_SESSION);
+
+        if (sampleGateway == null) {
+            sampleGateway = new SampleGateway(session.getServletContext());
+        }
+
+        session.setAttribute(SampleGateway.GATEWAY_SESSION, sampleGateway);
+
+        user = request.getParameter("username");
+        String password = request.getParameter("password");
+
+        authenticate = sampleGateway.authenticate(user, password);
+    } else {
+        authenticate = true;
+    }
+
+%>
+<html>
+
+<head>
+    <title>Manage</title>
+</head>
+<body>
+
+<table width="100%" border="0">
+    <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr>
+</table>
+
+<h1>Sample Gateway</h1>
+
+<%
+    if (authenticate) {
+
+        session.setAttribute("userName", user);
+
+        if (SampleGateway.isAdmin(user)) {
+%>
+<h1>Administration</h1>
+<p>
+    This page allows administration functionality.
+<ol>
+    <li><a href="acs.jsp">Retrieve Credentials</a></li>
+    <li><a href="list_users.jsp">List Users</a></li>
+</ol>
+</p>
+
+
+<%
+     } else {
+%>
+
+<p> You are a normal user. Click <a href="job.jsp">here</a> to configure and run "Echo" workflow on a GRID machine.</p>
+
+<%
+     }
+    } else {
+%>
+
+<h1>Authentication failed</h1>
+
+<%
+    }
+%>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png b/modules/credential-store/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png
new file mode 100644
index 0000000..4baf51b
Binary files /dev/null and b/modules/credential-store/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png differ

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/index.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/index.jsp
new file mode 100644
index 0000000..1bf0ed6
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/index.jsp
@@ -0,0 +1,26 @@
+<%--
+  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.
+--%>
+
+<html>
+<body>
+<img src="images/airavata-logo-2.png">
+<h2>Airavata Credential Store</h2>
+<p>Welcome to Airavata Credential Store Web Application</p>
+
+<p><a href="user-store/add.jsp"><b>Manage Local User Store</b></a></p>
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/add.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/add.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/add.jsp
new file mode 100644
index 0000000..f37684d
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/add.jsp
@@ -0,0 +1,142 @@
+<%--
+  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.
+--%>
+<%@ page import="org.apache.airavata.credentialstore.local.LocalUserStore" %>
+
+<html>
+
+<head>
+    <script language="javascript" type="text/javascript">
+        function validatePassword(fld1name, regString) {
+            var stringValue = document.getElementsByName(fld1name)[0].value;
+            var errorMessage = "";
+            if(regString != "null" && !stringValue.match(new RegExp(regString))){
+                errorMessage = "Password does not meet minimum requirements. Password length must be at least 6 " +
+                        "characters.";
+                return errorMessage;
+            }else if(regString != "null" && stringValue == ''){
+                return errorMessage;
+            }
+
+            if (stringValue == '') {
+                errorMessage = "Empty passwords are not allowed. Please enter a valid password";
+                return errorMessage;
+            }
+
+            return errorMessage;
+        }
+
+        function validateUsername(fld1name) {
+            var stringValue = document.getElementsByName(fld1name)[0].value;
+            var errorMessage = "";
+
+            if (stringValue == '') {
+                errorMessage = "Empty user names are not allowed. Please enter a valid user name.";
+                return errorMessage;
+            }
+
+            return errorMessage;
+        }
+
+        function checkPasswordsMatching(fld1name, fld2name) {
+
+            var stringValue1 = document.getElementsByName(fld1name)[0].value;
+            var stringValue2 = document.getElementsByName(fld2name)[0].value;
+            var errorMessage = "";
+
+            if (stringValue1 != stringValue2) {
+                errorMessage = "Confirm password does not match with the password. Please re-enter passwords.";
+                return errorMessage;
+            }
+
+            return errorMessage;
+
+        }
+
+        function validate() {
+            var reason = "";
+
+            reason = validateUsername("username");
+
+            if (reason != "") {
+                alert(reason);
+                return false;
+            }
+
+            reason = validatePassword("newPassword", <%=LocalUserStore.getPasswordRegularExpression()%>);
+
+            if (reason != "") {
+                alert(reason);
+                document.getElementsByName("newPassword")[0].clear();
+                return false;
+            }
+
+            reason = checkPasswordsMatching("newPassword", "confirmPassword");
+
+            if (reason != "") {
+                alert(reason);
+                document.getElementsByName("newPassword")[0].clear();
+                document.getElementsByName("confirmPassword")[0].clear();
+                return false;
+            }
+
+            return true;
+        }
+
+        function doProcess() {
+            if (validate() == true) {
+                document.registration.submit();
+            }
+        }
+
+
+    </script>
+</head>
+
+<body>
+<img src="../images/airavata-logo-2.png">
+<h2>Airavata Credential Store - Local User Store</h2>
+<p><b>Manage Local User Store - Add New User</b></p>
+
+<form action="index.jsp" name="registration" method="POST">
+
+    <input type="hidden" name="operation" value="addUser">
+    <table>
+        <tr>
+            <td>User Name</td>
+            <td><input type="text" name="username" maxlength="150"></td>
+        </tr>
+        <tr>
+            <td>Password</td>
+            <td><input type="password" name="newPassword"/></td>
+        </tr>
+        <tr>
+            <td>Re-Type Password</td>
+            <td><input type="password" name="confirmPassword"/></td>
+        </tr>
+    </table>
+
+    <table>
+        <tr>
+            <td><input type="button" value="Add" onclick= 'doProcess()'></td>
+            <td><a href="index.jsp"><input type="button" value="Cancel" name="Cancel"/> </a> </td>
+        </tr>
+    </table>
+
+</form>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/index.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/index.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/index.jsp
new file mode 100644
index 0000000..732c0c7
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/index.jsp
@@ -0,0 +1,138 @@
+<%--
+  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.
+--%>
+
+<%@ page import = "org.apache.airavata.credentialstore.local.LocalUserStore" %>
+<%@ page import="org.apache.airavata.credentialstore.basic.BasicAccessAuthenticator" %>
+<%@ page import="org.apache.airavata.credentialstore.session.HttpAuthenticatorFilter" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.apache.airavata.common.utils.Constants" %>
+<%
+
+    LocalUserStore localUserStore = (LocalUserStore)session.getAttribute("LocalUserStore");
+
+    if (localUserStore == null) {
+
+        String operatingUser = (String) session.getAttribute(Constants.USER_IN_SESSION);
+
+        if (operatingUser == null || !operatingUser.equals("admin")) {
+            HttpAuthenticatorFilter.sendUnauthorisedError(response, "Insufficient privileges to perform user operations." +
+                    " Only admin user is allowed to perform user operations.");
+
+            return;
+        }
+
+        localUserStore = new LocalUserStore(application);
+
+        session.setAttribute("LocalUserStore", localUserStore);
+    }
+
+    String operation = request.getParameter("operation");
+    if (operation != null) {
+        if (operation.equals("addUser")) {
+            String userName = request.getParameter("username");
+            String password = request.getParameter("newPassword");
+
+            localUserStore.addUser(userName, password);
+        } else if (operation.equals("deleteUser")) {
+            String[] usersToDelete = request.getParameterValues("user-id");
+
+            for (String deleteUser : usersToDelete) {
+                localUserStore.deleteUser(deleteUser);
+            }
+        }
+    }
+
+    List<String> allUsers = localUserStore.getUsers();
+
+%>
+
+<html>
+<head>
+    <script language="javascript" type="text/javascript">
+
+        function validate() {
+            var checkSelected = false;
+            for (var i = 0; i < <%=allUsers.size()%>; i++) {
+                if (document.main["user-id"][i].checked) {
+                    checkSelected = true;
+                }
+            }
+            if (checkSelected) {
+                var answer = confirm("Are you sure you want to delete selected users from the system ?");
+                if (answer) {
+                    return true;
+                }
+            } else {
+                alert("Select at least one user to delete.");
+            }
+            return false;
+        }
+
+        function doProcess() {
+            if (validate() == true) {
+                document.main.submit();
+            }
+        }
+
+    </script>
+</head>
+<body>
+<img src="../images/airavata-logo-2.png">
+<h2>Airavata REST API - Local User Store</h2>
+<p><b>Manage Local User Store</b></p>
+
+
+<form action="index.jsp" name="main" method="POST">
+    <table>
+        <tr>
+            <td>&nbsp;</td>
+            <td>All Users</td>
+        </tr>
+        <%
+            for (String user : allUsers) {
+        %>
+
+        <tr>
+            <td><input type="checkbox" name="user-id" value="<%=user%>"></td>
+            <td><%=user%>
+            </td>
+            <td><a href="password.jsp?username=<%=user%>">Change Password</a></td>
+        </tr>
+
+        <%
+            }
+        %>
+    </table>
+
+    <br>
+
+    <table width="100">
+        <tr>
+            <td>
+                <a href="add.jsp"><input type="button" value="Add" name="Add"/></a>
+            </td>
+            <td>&nbsp;</td>
+            <input type="hidden" name="operation" value="deleteUser">
+            <td><input type="button" value="Delete" onclick="doProcess()"></td>
+        </tr>
+    </table>
+
+</form>
+
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/password.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/password.jsp b/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/password.jsp
new file mode 100644
index 0000000..9a316ee
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/webapp/user-store/password.jsp
@@ -0,0 +1,157 @@
+<%--
+  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.
+--%>
+
+<%@ page import="org.apache.airavata.credentialstore.local.LocalUserStore" %>
+
+<%
+    String userName = request.getParameter("username");
+    if (userName == null) {
+        response.sendRedirect("index.jsp");
+    }
+
+    String password = request.getParameter("newPassword");
+    String confirmPassword = request.getParameter("confirmPassword");
+
+    if (password != null && confirmPassword != null && password.equals(confirmPassword)) {
+        LocalUserStore localUserStore = (LocalUserStore)session.getAttribute("LocalUserStore");
+        localUserStore.changePasswordByAdmin(userName, password);
+
+        response.sendRedirect("password.jsp?message=\"Password successfully change for user "
+                + userName + "\"&username=" + userName);
+    }
+
+%>
+
+<html>
+<head>
+    <script language="javascript" type="text/javascript">
+        function validatePassword(fld1name, regString) {
+            var stringValue = document.getElementsByName(fld1name)[0].value;
+            var errorMessage = "";
+            if(regString != "null" && !stringValue.match(new RegExp(regString))){
+                errorMessage = "Password does not meet minimum requirements. Password length must be at least 6 " +
+                        "characters.";
+                return errorMessage;
+            }else if(regString != "null" && stringValue == ''){
+                return errorMessage;
+            }
+
+            if (stringValue == '') {
+                errorMessage = "Empty passwords are not allowed. Please enter a valid password";
+                return errorMessage;
+            }
+
+            return errorMessage;
+        }
+
+        function validateUsername(fld1name) {
+            var stringValue = document.getElementsByName(fld1name)[0].value;
+            var errorMessage = "";
+
+            if (stringValue == '') {
+                errorMessage = "Empty user names are not allowed. Please enter a valid user name.";
+                return errorMessage;
+            }
+
+            return errorMessage;
+        }
+
+        function checkPasswordsMatching(fld1name, fld2name) {
+
+            var stringValue1 = document.getElementsByName(fld1name)[0].value;
+            var stringValue2 = document.getElementsByName(fld2name)[0].value;
+            var errorMessage = "";
+
+            if (stringValue1 != stringValue2) {
+                errorMessage = "Confirm password does not match with the password. Please re-enter passwords.";
+                return errorMessage;
+            }
+
+            return errorMessage;
+
+        }
+
+        function validate() {
+            var reason = "";
+
+            reason = validatePassword("newPassword", <%=LocalUserStore.getPasswordRegularExpression()%>);
+
+            if (reason != "") {
+                alert(reason);
+                document.getElementsByName("newPassword")[0].clear();
+                return false;
+            }
+
+            reason = checkPasswordsMatching("newPassword", "confirmPassword");
+
+            if (reason != "") {
+                alert(reason);
+                document.getElementsByName("newPassword")[0].clear();
+                document.getElementsByName("confirmPassword")[0].clear();
+                return false;
+            }
+
+            return true;
+        }
+
+        function doProcess() {
+            if (validate() == true) {
+                document.passwordForm.submit();
+            }
+        }
+
+        function displayMessage() {
+            var msg = <%=request.getParameter("message")%>;
+            if (msg != null) {
+                alert(msg);
+            }
+        }
+
+
+    </script>
+</head>
+
+<body onload="displayMessage()">
+<img src="../images/airavata-logo-2.png">
+<h2>Airavata REST API - Local User Store</h2>
+<p><b>Manage Local User Store - Change Password of user - <%=userName%></b></p>
+
+<form action="password.jsp" name="passwordForm" method="POST">
+
+    <input type="hidden" name="username" value="<%=userName%>">
+    <table>
+        <tr>
+            <td>New Password</td>
+            <td><input type="password" name="newPassword"/></td>
+        </tr>
+        <tr>
+            <td>Re-Type Password</td>
+            <td><input type="password" name="confirmPassword"/></td>
+        </tr>
+    </table>
+
+    <table>
+        <tr>
+            <td><input type="button" value="Change" onclick= 'doProcess()'></td>
+            <td><a href="index.jsp"><input type="button" value="Cancel" name="Cancel"/> </a> </td>
+        </tr>
+    </table>
+
+</form>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/cs-thrift-descriptions/credentialStoreCPI.thrift
----------------------------------------------------------------------
diff --git a/modules/credential-store/cs-thrift-descriptions/credentialStoreCPI.thrift b/modules/credential-store/cs-thrift-descriptions/credentialStoreCPI.thrift
new file mode 100644
index 0000000..f35e884
--- /dev/null
+++ b/modules/credential-store/cs-thrift-descriptions/credentialStoreCPI.thrift
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ *
+ */
+
+/*
+ * Component Programming Interface definition for Apache Airavata GFac Service.
+ *
+*/
+
+include "credentialStoreDataModel.thrift"
+include "credentialStoreErrors.thrift"
+
+namespace java org.apache.airavata.credential.store.cpi
+
+const string CS_CPI_VERSION = "0.15.0"
+
+service CredentialStoreService {
+
+  /** Query CS server to fetch the CPI version */
+  string getCSServiceVersion(),
+
+  /**
+  * This method is to add SSHCredential which will return the token Id in success
+  **/
+  string addSSHCredential (1: required credentialStoreDataModel.SSHCredential sshCredential)
+                        throws (1:credentialStoreErrors.CredentialStoreException csException);
+
+  string addCertificateCredential (1: required credentialStoreDataModel.CertificateCredential certificateCredential)
+                        throws (1:credentialStoreErrors.CredentialStoreException csException);
+
+  string addPasswordCredential (1: required credentialStoreDataModel.PasswordCredential passwordCredential)
+                        throws (1:credentialStoreErrors.CredentialStoreException csException);
+
+  credentialStoreDataModel.SSHCredential getSSHCredential (1: required string tokenId, 2: required string gatewayId)
+                        throws (1:credentialStoreErrors.CredentialStoreException csException);
+
+  credentialStoreDataModel.CertificateCredential getCertificateCredential (1: required string tokenId, 2: required string gatewayId)
+                        throws (1:credentialStoreErrors.CredentialStoreException csException);
+
+  credentialStoreDataModel.PasswordCredential getPasswordCredential (1: required string tokenId, 2: required string gatewayId)
+                        throws (1:credentialStoreErrors.CredentialStoreException csException);
+
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/cs-thrift-descriptions/credentialStoreDataModel.thrift
----------------------------------------------------------------------
diff --git a/modules/credential-store/cs-thrift-descriptions/credentialStoreDataModel.thrift b/modules/credential-store/cs-thrift-descriptions/credentialStoreDataModel.thrift
new file mode 100644
index 0000000..ce4dc46
--- /dev/null
+++ b/modules/credential-store/cs-thrift-descriptions/credentialStoreDataModel.thrift
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ *
+ */
+
+
+namespace java org.apache.airavata.credential.store.datamodel
+namespace php Airavata.Model.Credential.Store
+
+
+const string DEFAULT_ID = "DO_NOT_SET_AT_CLIENTS"
+
+
+struct SSHCredential {
+    1: required string gatewayId,
+    2: required string username,
+    3: required string passphrase,
+    4: optional string publicKey,
+    5: optional string privateKey,
+    6: optional i64 persistedTime,
+    7: optional string token
+}
+
+struct CommunityUser {
+    1: required string gatewayName,
+    2: required string username,
+    3: required string userEmail
+}
+
+struct CertificateCredential {
+    1: required CommunityUser communityUser,
+    2: required string x509Cert,
+    3: optional string notAfter,
+    4: optional string privateKey,
+    5: optional i64 lifeTime,
+    6: optional string notBefore
+    7: optional i64 persistedTime,
+    8: optional string token
+}
+
+struct PasswordCredential {
+    1: required string username,
+    2: required string password,
+    3: optional i64 persistedTime,
+    4: optional string token
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/cs-thrift-descriptions/credentialStoreErrors.thrift
----------------------------------------------------------------------
diff --git a/modules/credential-store/cs-thrift-descriptions/credentialStoreErrors.thrift b/modules/credential-store/cs-thrift-descriptions/credentialStoreErrors.thrift
new file mode 100644
index 0000000..148d7f2
--- /dev/null
+++ b/modules/credential-store/cs-thrift-descriptions/credentialStoreErrors.thrift
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ *
+ */
+
+/*
+* This file describes the definitions of the Error Messages that can occur
+*  when invoking Apache Airavata Services through the API. In addition Thrift provides
+*  built in funcationality to raise TApplicationException for all internal server errors.
+*/
+
+namespace java org.apache.airavata.credential.store.exception
+namespace php Airavata.Credential.Store.Error
+
+exception CredentialStoreException {
+  1: required string message
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/cs-thrift-descriptions/generate-cs-stubs.sh
----------------------------------------------------------------------
diff --git a/modules/credential-store/cs-thrift-descriptions/generate-cs-stubs.sh b/modules/credential-store/cs-thrift-descriptions/generate-cs-stubs.sh
new file mode 100755
index 0000000..a1ca01f
--- /dev/null
+++ b/modules/credential-store/cs-thrift-descriptions/generate-cs-stubs.sh
@@ -0,0 +1,134 @@
+#! /usr/bin/env bash
+
+# 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.
+
+# This script will regenerate the thrift code for Airavata Credential Store Server Skeltons and Client Stubs.
+
+
+# Global Constants used across the script
+REQUIRED_THRIFT_VERSION='0.9.1'
+BASE_TARGET_DIR='target'
+CS_SERVICE_DIR='../credential-store-stubs/src/main/java'
+
+# The Function fail prints error messages on failure and quits the script.
+fail() {
+    echo $@
+    exit 1
+}
+
+# The function add_license_header adds the ASF V2 license header to all java files within the specified generated
+#   directory. The function also adds suppress all warnings annotation to all public classes and enums
+#  To Call:
+#   add_license_header $generated_code_directory
+add_license_header() {
+
+    # Fetch the generated code directory passed as the argument
+    GENERATED_CODE_DIR=$1
+
+    # For all generated thrift code, add the suppress all warnings annotation
+    #  NOTE: In order to save the original file as a backup, use sed -i.orig in place of sed -i ''
+    find ${GENERATED_CODE_DIR} -name '*.java' -print0 | xargs -0 sed -i '' -e 's/public class /@SuppressWarnings("all") public class /'
+    find ${GENERATED_CODE_DIR} -name '*.java' -print0 | xargs -0 sed -i '' -e 's/public enum /@SuppressWarnings("all") public enum /'
+
+    # For each java file within the generated directory, add the ASF V2 LICENSE header
+    for f in $(find ${GENERATED_CODE_DIR} -name '*.java'); do
+      cat - ${f} >${f}-with-license <<EOF
+    /*
+     * 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.
+     */
+EOF
+    mv ${f}-with-license ${f}
+    done
+}
+
+# The function compares every generated java file with the one in specified existing source location. If the comparison
+#   shows a difference, then it replaces with the newly generated file (with added license header).
+#  To Call:
+#   copy_changed_files $generated_code_directory $existing_source_directory
+copy_changed_files() {
+
+    # Read all the function arguments
+    GENERATED_CODE_DIR=$1
+    WORKSPACE_SRC_DIR=$2
+
+    echo "Generated sources are in ${GENERATED_CODE_DIR}"
+    echo "Destination workspace is in ${WORKSPACE_SRC_DIR}"
+
+    # Check if the newly generated files exist in the targetted workspace, if not copy. Only changed files will be synced.
+    #  the extra slash to GENERATED_CODE_DIR is needed to ensure the parent directory itself is not copied.
+    rsync -auv ${GENERATED_CODE_DIR}/ ${WORKSPACE_SRC_DIR}
+}
+
+# Generation of thrift files will require installing Apache Thrift. Please add thrift to your path.
+#  Verify is thrift is installed, is in the path is at a specified version.
+VERSION=$(thrift -version 2>/dev/null | grep -F "${REQUIRED_THRIFT_VERSION}" |  wc -l)
+if [ "$VERSION" -ne 1 ] ; then
+    echo "****************************************************"
+    echo "*** thrift is not installed or is not in the path"
+    echo "***   expecting 'thrift -version' to return ${REQUIRED_THRIFT_VERSION}"
+    echo "*** generated code will not be updated"
+    fail "****************************************************"
+fi
+
+# Initialize the thrift arguments.
+#  Since most of the Airavata API and Data Models have includes, use recursive option by default.
+#  Generate all the files in target directory
+THRIFT_ARGS="-r -o ${BASE_TARGET_DIR}"
+# Ensure the required target directories exists, if not create.
+mkdir -p ${BASE_TARGET_DIR}
+
+#######################################################################
+# Generate/Update the Credential Store CPI service stubs
+#  To start with both the servicer and client are in same package, but
+#  needs to be split using a common generated api-boilerplate-code
+#######################################################################
+
+#Java generation directory
+JAVA_GEN_DIR=${BASE_TARGET_DIR}/gen-java
+
+# As a precaution  remove and previously generated files if exists
+rm -rf ${JAVA_GEN_DIR}
+
+# Using thrift Java generator, generate the java classes based on Airavata API. This
+#   The airavataAPI.thrift includes rest of data models.
+thrift ${THRIFT_ARGS} --gen java credentialStoreCPI.thrift || fail unable to generate java thrift classes
+thrift ${THRIFT_ARGS} --gen java credentialStoreDataModel.thrift || fail unable to generate java thrift classes
+
+
+# For the generated java classes add the ASF V2 License header
+add_license_header $JAVA_GEN_DIR
+
+# Compare the newly generated classes with existing java generated skeleton/stub sources and replace the changed ones.
+copy_changed_files ${JAVA_GEN_DIR} ${CS_SERVICE_DIR}
+
+# CleanUp: Delete the base target build directory
+#rm -rf ${BASE_TARGET_DIR}
+
+echo "Successfully generated new sources, compared against exiting code and replaced the changed files"
+exit 0

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store/pom.xml b/modules/credential-store/pom.xml
new file mode 100644
index 0000000..370cc9b
--- /dev/null
+++ b/modules/credential-store/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+    the Apache License, Version 2.0 (theƏ "License"); you may not use this file except in compliance with the License. You may
+    obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+    in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+    ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+    the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>airavata</artifactId>
+        <version>0.15-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>credential-store</artifactId>
+    <packaging>pom</packaging>
+    <name>Airavata Credential Store</name>
+    <url>http://airavata.apache.org/</url>
+
+    <profiles>
+        <profile>
+            <id>default</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <modules>
+                <module>credential-store-service</module>
+                <module>credential-store-stubs</module>
+                <module>credential-store-webapp</module>
+            </modules>
+        </profile>
+    </profiles>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    </properties>
+</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 512f21d..8f48edc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -520,7 +520,7 @@
 				<module>modules/registry</module>
 				<module>modules/app-catalog</module>
 				<module>modules/security</module>
-				<module>modules/credential-store-service</module>
+				<module>modules/credential-store</module>
 				<module>modules/orchestrator</module>
 				<module>tools</module>
 				<module>modules/server</module>
@@ -605,7 +605,7 @@
 				<module>modules/workflow-model</module>
 				<module>modules/registry</module>
 				<module>modules/security</module>
-				<module>modules/credential-store-service</module>
+				<module>modules/credential-store</module>
 				<module>modules/orchestrator</module>
 				<module>tools</module>
 				<module>modules/server</module>


[07/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
new file mode 100644
index 0000000..f6b6837
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
@@ -0,0 +1,698 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class PasswordCredential implements org.apache.thrift.TBase<PasswordCredential, PasswordCredential._Fields>, java.io.Serializable, Cloneable, Comparable<PasswordCredential> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PasswordCredential");
+
+  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)3);
+  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)4);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new PasswordCredentialStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new PasswordCredentialTupleSchemeFactory());
+  }
+
+  public String username; // required
+  public String password; // required
+  public long persistedTime; // optional
+  public String token; // optional
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    USERNAME((short)1, "username"),
+    PASSWORD((short)2, "password"),
+    PERSISTED_TIME((short)3, "persistedTime"),
+    TOKEN((short)4, "token");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // USERNAME
+          return USERNAME;
+        case 2: // PASSWORD
+          return PASSWORD;
+        case 3: // PERSISTED_TIME
+          return PERSISTED_TIME;
+        case 4: // TOKEN
+          return TOKEN;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __PERSISTEDTIME_ISSET_ID = 0;
+  private byte __isset_bitfield = 0;
+  private _Fields optionals[] = {_Fields.PERSISTED_TIME,_Fields.TOKEN};
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PasswordCredential.class, metaDataMap);
+  }
+
+  public PasswordCredential() {
+  }
+
+  public PasswordCredential(
+    String username,
+    String password)
+  {
+    this();
+    this.username = username;
+    this.password = password;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public PasswordCredential(PasswordCredential other) {
+    __isset_bitfield = other.__isset_bitfield;
+    if (other.isSetUsername()) {
+      this.username = other.username;
+    }
+    if (other.isSetPassword()) {
+      this.password = other.password;
+    }
+    this.persistedTime = other.persistedTime;
+    if (other.isSetToken()) {
+      this.token = other.token;
+    }
+  }
+
+  public PasswordCredential deepCopy() {
+    return new PasswordCredential(this);
+  }
+
+  @Override
+  public void clear() {
+    this.username = null;
+    this.password = null;
+    setPersistedTimeIsSet(false);
+    this.persistedTime = 0;
+    this.token = null;
+  }
+
+  public String getUsername() {
+    return this.username;
+  }
+
+  public PasswordCredential setUsername(String username) {
+    this.username = username;
+    return this;
+  }
+
+  public void unsetUsername() {
+    this.username = null;
+  }
+
+  /** Returns true if field username is set (has been assigned a value) and false otherwise */
+  public boolean isSetUsername() {
+    return this.username != null;
+  }
+
+  public void setUsernameIsSet(boolean value) {
+    if (!value) {
+      this.username = null;
+    }
+  }
+
+  public String getPassword() {
+    return this.password;
+  }
+
+  public PasswordCredential setPassword(String password) {
+    this.password = password;
+    return this;
+  }
+
+  public void unsetPassword() {
+    this.password = null;
+  }
+
+  /** Returns true if field password is set (has been assigned a value) and false otherwise */
+  public boolean isSetPassword() {
+    return this.password != null;
+  }
+
+  public void setPasswordIsSet(boolean value) {
+    if (!value) {
+      this.password = null;
+    }
+  }
+
+  public long getPersistedTime() {
+    return this.persistedTime;
+  }
+
+  public PasswordCredential setPersistedTime(long persistedTime) {
+    this.persistedTime = persistedTime;
+    setPersistedTimeIsSet(true);
+    return this;
+  }
+
+  public void unsetPersistedTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */
+  public boolean isSetPersistedTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  public void setPersistedTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value);
+  }
+
+  public String getToken() {
+    return this.token;
+  }
+
+  public PasswordCredential setToken(String token) {
+    this.token = token;
+    return this;
+  }
+
+  public void unsetToken() {
+    this.token = null;
+  }
+
+  /** Returns true if field token is set (has been assigned a value) and false otherwise */
+  public boolean isSetToken() {
+    return this.token != null;
+  }
+
+  public void setTokenIsSet(boolean value) {
+    if (!value) {
+      this.token = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case USERNAME:
+      if (value == null) {
+        unsetUsername();
+      } else {
+        setUsername((String)value);
+      }
+      break;
+
+    case PASSWORD:
+      if (value == null) {
+        unsetPassword();
+      } else {
+        setPassword((String)value);
+      }
+      break;
+
+    case PERSISTED_TIME:
+      if (value == null) {
+        unsetPersistedTime();
+      } else {
+        setPersistedTime((Long)value);
+      }
+      break;
+
+    case TOKEN:
+      if (value == null) {
+        unsetToken();
+      } else {
+        setToken((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case USERNAME:
+      return getUsername();
+
+    case PASSWORD:
+      return getPassword();
+
+    case PERSISTED_TIME:
+      return Long.valueOf(getPersistedTime());
+
+    case TOKEN:
+      return getToken();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case USERNAME:
+      return isSetUsername();
+    case PASSWORD:
+      return isSetPassword();
+    case PERSISTED_TIME:
+      return isSetPersistedTime();
+    case TOKEN:
+      return isSetToken();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof PasswordCredential)
+      return this.equals((PasswordCredential)that);
+    return false;
+  }
+
+  public boolean equals(PasswordCredential that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_username = true && this.isSetUsername();
+    boolean that_present_username = true && that.isSetUsername();
+    if (this_present_username || that_present_username) {
+      if (!(this_present_username && that_present_username))
+        return false;
+      if (!this.username.equals(that.username))
+        return false;
+    }
+
+    boolean this_present_password = true && this.isSetPassword();
+    boolean that_present_password = true && that.isSetPassword();
+    if (this_present_password || that_present_password) {
+      if (!(this_present_password && that_present_password))
+        return false;
+      if (!this.password.equals(that.password))
+        return false;
+    }
+
+    boolean this_present_persistedTime = true && this.isSetPersistedTime();
+    boolean that_present_persistedTime = true && that.isSetPersistedTime();
+    if (this_present_persistedTime || that_present_persistedTime) {
+      if (!(this_present_persistedTime && that_present_persistedTime))
+        return false;
+      if (this.persistedTime != that.persistedTime)
+        return false;
+    }
+
+    boolean this_present_token = true && this.isSetToken();
+    boolean that_present_token = true && that.isSetToken();
+    if (this_present_token || that_present_token) {
+      if (!(this_present_token && that_present_token))
+        return false;
+      if (!this.token.equals(that.token))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(PasswordCredential other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUsername()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPassword()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPersistedTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetToken()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("PasswordCredential(");
+    boolean first = true;
+
+    sb.append("username:");
+    if (this.username == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.username);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("password:");
+    if (this.password == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.password);
+    }
+    first = false;
+    if (isSetPersistedTime()) {
+      if (!first) sb.append(", ");
+      sb.append("persistedTime:");
+      sb.append(this.persistedTime);
+      first = false;
+    }
+    if (isSetToken()) {
+      if (!first) sb.append(", ");
+      sb.append("token:");
+      if (this.token == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.token);
+      }
+      first = false;
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (username == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
+    }
+    if (password == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'password' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class PasswordCredentialStandardSchemeFactory implements SchemeFactory {
+    public PasswordCredentialStandardScheme getScheme() {
+      return new PasswordCredentialStandardScheme();
+    }
+  }
+
+  private static class PasswordCredentialStandardScheme extends StandardScheme<PasswordCredential> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, PasswordCredential struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // USERNAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.username = iprot.readString();
+              struct.setUsernameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // PASSWORD
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.password = iprot.readString();
+              struct.setPasswordIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // PERSISTED_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.persistedTime = iprot.readI64();
+              struct.setPersistedTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // TOKEN
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.token = iprot.readString();
+              struct.setTokenIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, PasswordCredential struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.username != null) {
+        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+        oprot.writeString(struct.username);
+        oprot.writeFieldEnd();
+      }
+      if (struct.password != null) {
+        oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
+        oprot.writeString(struct.password);
+        oprot.writeFieldEnd();
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC);
+        oprot.writeI64(struct.persistedTime);
+        oprot.writeFieldEnd();
+      }
+      if (struct.token != null) {
+        if (struct.isSetToken()) {
+          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
+          oprot.writeString(struct.token);
+          oprot.writeFieldEnd();
+        }
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class PasswordCredentialTupleSchemeFactory implements SchemeFactory {
+    public PasswordCredentialTupleScheme getScheme() {
+      return new PasswordCredentialTupleScheme();
+    }
+  }
+
+  private static class PasswordCredentialTupleScheme extends TupleScheme<PasswordCredential> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, PasswordCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeString(struct.username);
+      oprot.writeString(struct.password);
+      BitSet optionals = new BitSet();
+      if (struct.isSetPersistedTime()) {
+        optionals.set(0);
+      }
+      if (struct.isSetToken()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetPersistedTime()) {
+        oprot.writeI64(struct.persistedTime);
+      }
+      if (struct.isSetToken()) {
+        oprot.writeString(struct.token);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, PasswordCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.username = iprot.readString();
+      struct.setUsernameIsSet(true);
+      struct.password = iprot.readString();
+      struct.setPasswordIsSet(true);
+      BitSet incoming = iprot.readBitSet(2);
+      if (incoming.get(0)) {
+        struct.persistedTime = iprot.readI64();
+        struct.setPersistedTimeIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.token = iprot.readString();
+        struct.setTokenIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
new file mode 100644
index 0000000..9fc373a
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
@@ -0,0 +1,998 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class SSHCredential implements org.apache.thrift.TBase<SSHCredential, SSHCredential._Fields>, java.io.Serializable, Cloneable, Comparable<SSHCredential> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SSHCredential");
+
+  private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField PASSPHRASE_FIELD_DESC = new org.apache.thrift.protocol.TField("passphrase", org.apache.thrift.protocol.TType.STRING, (short)3);
+  private static final org.apache.thrift.protocol.TField PUBLIC_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("publicKey", org.apache.thrift.protocol.TType.STRING, (short)4);
+  private static final org.apache.thrift.protocol.TField PRIVATE_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("privateKey", org.apache.thrift.protocol.TType.STRING, (short)5);
+  private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)6);
+  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)7);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new SSHCredentialStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new SSHCredentialTupleSchemeFactory());
+  }
+
+  public String gatewayId; // required
+  public String username; // required
+  public String passphrase; // required
+  public String publicKey; // optional
+  public String privateKey; // optional
+  public long persistedTime; // optional
+  public String token; // optional
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    GATEWAY_ID((short)1, "gatewayId"),
+    USERNAME((short)2, "username"),
+    PASSPHRASE((short)3, "passphrase"),
+    PUBLIC_KEY((short)4, "publicKey"),
+    PRIVATE_KEY((short)5, "privateKey"),
+    PERSISTED_TIME((short)6, "persistedTime"),
+    TOKEN((short)7, "token");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // GATEWAY_ID
+          return GATEWAY_ID;
+        case 2: // USERNAME
+          return USERNAME;
+        case 3: // PASSPHRASE
+          return PASSPHRASE;
+        case 4: // PUBLIC_KEY
+          return PUBLIC_KEY;
+        case 5: // PRIVATE_KEY
+          return PRIVATE_KEY;
+        case 6: // PERSISTED_TIME
+          return PERSISTED_TIME;
+        case 7: // TOKEN
+          return TOKEN;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __PERSISTEDTIME_ISSET_ID = 0;
+  private byte __isset_bitfield = 0;
+  private _Fields optionals[] = {_Fields.PUBLIC_KEY,_Fields.PRIVATE_KEY,_Fields.PERSISTED_TIME,_Fields.TOKEN};
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PASSPHRASE, new org.apache.thrift.meta_data.FieldMetaData("passphrase", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PUBLIC_KEY, new org.apache.thrift.meta_data.FieldMetaData("publicKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PRIVATE_KEY, new org.apache.thrift.meta_data.FieldMetaData("privateKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SSHCredential.class, metaDataMap);
+  }
+
+  public SSHCredential() {
+  }
+
+  public SSHCredential(
+    String gatewayId,
+    String username,
+    String passphrase)
+  {
+    this();
+    this.gatewayId = gatewayId;
+    this.username = username;
+    this.passphrase = passphrase;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public SSHCredential(SSHCredential other) {
+    __isset_bitfield = other.__isset_bitfield;
+    if (other.isSetGatewayId()) {
+      this.gatewayId = other.gatewayId;
+    }
+    if (other.isSetUsername()) {
+      this.username = other.username;
+    }
+    if (other.isSetPassphrase()) {
+      this.passphrase = other.passphrase;
+    }
+    if (other.isSetPublicKey()) {
+      this.publicKey = other.publicKey;
+    }
+    if (other.isSetPrivateKey()) {
+      this.privateKey = other.privateKey;
+    }
+    this.persistedTime = other.persistedTime;
+    if (other.isSetToken()) {
+      this.token = other.token;
+    }
+  }
+
+  public SSHCredential deepCopy() {
+    return new SSHCredential(this);
+  }
+
+  @Override
+  public void clear() {
+    this.gatewayId = null;
+    this.username = null;
+    this.passphrase = null;
+    this.publicKey = null;
+    this.privateKey = null;
+    setPersistedTimeIsSet(false);
+    this.persistedTime = 0;
+    this.token = null;
+  }
+
+  public String getGatewayId() {
+    return this.gatewayId;
+  }
+
+  public SSHCredential setGatewayId(String gatewayId) {
+    this.gatewayId = gatewayId;
+    return this;
+  }
+
+  public void unsetGatewayId() {
+    this.gatewayId = null;
+  }
+
+  /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */
+  public boolean isSetGatewayId() {
+    return this.gatewayId != null;
+  }
+
+  public void setGatewayIdIsSet(boolean value) {
+    if (!value) {
+      this.gatewayId = null;
+    }
+  }
+
+  public String getUsername() {
+    return this.username;
+  }
+
+  public SSHCredential setUsername(String username) {
+    this.username = username;
+    return this;
+  }
+
+  public void unsetUsername() {
+    this.username = null;
+  }
+
+  /** Returns true if field username is set (has been assigned a value) and false otherwise */
+  public boolean isSetUsername() {
+    return this.username != null;
+  }
+
+  public void setUsernameIsSet(boolean value) {
+    if (!value) {
+      this.username = null;
+    }
+  }
+
+  public String getPassphrase() {
+    return this.passphrase;
+  }
+
+  public SSHCredential setPassphrase(String passphrase) {
+    this.passphrase = passphrase;
+    return this;
+  }
+
+  public void unsetPassphrase() {
+    this.passphrase = null;
+  }
+
+  /** Returns true if field passphrase is set (has been assigned a value) and false otherwise */
+  public boolean isSetPassphrase() {
+    return this.passphrase != null;
+  }
+
+  public void setPassphraseIsSet(boolean value) {
+    if (!value) {
+      this.passphrase = null;
+    }
+  }
+
+  public String getPublicKey() {
+    return this.publicKey;
+  }
+
+  public SSHCredential setPublicKey(String publicKey) {
+    this.publicKey = publicKey;
+    return this;
+  }
+
+  public void unsetPublicKey() {
+    this.publicKey = null;
+  }
+
+  /** Returns true if field publicKey is set (has been assigned a value) and false otherwise */
+  public boolean isSetPublicKey() {
+    return this.publicKey != null;
+  }
+
+  public void setPublicKeyIsSet(boolean value) {
+    if (!value) {
+      this.publicKey = null;
+    }
+  }
+
+  public String getPrivateKey() {
+    return this.privateKey;
+  }
+
+  public SSHCredential setPrivateKey(String privateKey) {
+    this.privateKey = privateKey;
+    return this;
+  }
+
+  public void unsetPrivateKey() {
+    this.privateKey = null;
+  }
+
+  /** Returns true if field privateKey is set (has been assigned a value) and false otherwise */
+  public boolean isSetPrivateKey() {
+    return this.privateKey != null;
+  }
+
+  public void setPrivateKeyIsSet(boolean value) {
+    if (!value) {
+      this.privateKey = null;
+    }
+  }
+
+  public long getPersistedTime() {
+    return this.persistedTime;
+  }
+
+  public SSHCredential setPersistedTime(long persistedTime) {
+    this.persistedTime = persistedTime;
+    setPersistedTimeIsSet(true);
+    return this;
+  }
+
+  public void unsetPersistedTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */
+  public boolean isSetPersistedTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  public void setPersistedTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value);
+  }
+
+  public String getToken() {
+    return this.token;
+  }
+
+  public SSHCredential setToken(String token) {
+    this.token = token;
+    return this;
+  }
+
+  public void unsetToken() {
+    this.token = null;
+  }
+
+  /** Returns true if field token is set (has been assigned a value) and false otherwise */
+  public boolean isSetToken() {
+    return this.token != null;
+  }
+
+  public void setTokenIsSet(boolean value) {
+    if (!value) {
+      this.token = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case GATEWAY_ID:
+      if (value == null) {
+        unsetGatewayId();
+      } else {
+        setGatewayId((String)value);
+      }
+      break;
+
+    case USERNAME:
+      if (value == null) {
+        unsetUsername();
+      } else {
+        setUsername((String)value);
+      }
+      break;
+
+    case PASSPHRASE:
+      if (value == null) {
+        unsetPassphrase();
+      } else {
+        setPassphrase((String)value);
+      }
+      break;
+
+    case PUBLIC_KEY:
+      if (value == null) {
+        unsetPublicKey();
+      } else {
+        setPublicKey((String)value);
+      }
+      break;
+
+    case PRIVATE_KEY:
+      if (value == null) {
+        unsetPrivateKey();
+      } else {
+        setPrivateKey((String)value);
+      }
+      break;
+
+    case PERSISTED_TIME:
+      if (value == null) {
+        unsetPersistedTime();
+      } else {
+        setPersistedTime((Long)value);
+      }
+      break;
+
+    case TOKEN:
+      if (value == null) {
+        unsetToken();
+      } else {
+        setToken((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case GATEWAY_ID:
+      return getGatewayId();
+
+    case USERNAME:
+      return getUsername();
+
+    case PASSPHRASE:
+      return getPassphrase();
+
+    case PUBLIC_KEY:
+      return getPublicKey();
+
+    case PRIVATE_KEY:
+      return getPrivateKey();
+
+    case PERSISTED_TIME:
+      return Long.valueOf(getPersistedTime());
+
+    case TOKEN:
+      return getToken();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case GATEWAY_ID:
+      return isSetGatewayId();
+    case USERNAME:
+      return isSetUsername();
+    case PASSPHRASE:
+      return isSetPassphrase();
+    case PUBLIC_KEY:
+      return isSetPublicKey();
+    case PRIVATE_KEY:
+      return isSetPrivateKey();
+    case PERSISTED_TIME:
+      return isSetPersistedTime();
+    case TOKEN:
+      return isSetToken();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof SSHCredential)
+      return this.equals((SSHCredential)that);
+    return false;
+  }
+
+  public boolean equals(SSHCredential that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_gatewayId = true && this.isSetGatewayId();
+    boolean that_present_gatewayId = true && that.isSetGatewayId();
+    if (this_present_gatewayId || that_present_gatewayId) {
+      if (!(this_present_gatewayId && that_present_gatewayId))
+        return false;
+      if (!this.gatewayId.equals(that.gatewayId))
+        return false;
+    }
+
+    boolean this_present_username = true && this.isSetUsername();
+    boolean that_present_username = true && that.isSetUsername();
+    if (this_present_username || that_present_username) {
+      if (!(this_present_username && that_present_username))
+        return false;
+      if (!this.username.equals(that.username))
+        return false;
+    }
+
+    boolean this_present_passphrase = true && this.isSetPassphrase();
+    boolean that_present_passphrase = true && that.isSetPassphrase();
+    if (this_present_passphrase || that_present_passphrase) {
+      if (!(this_present_passphrase && that_present_passphrase))
+        return false;
+      if (!this.passphrase.equals(that.passphrase))
+        return false;
+    }
+
+    boolean this_present_publicKey = true && this.isSetPublicKey();
+    boolean that_present_publicKey = true && that.isSetPublicKey();
+    if (this_present_publicKey || that_present_publicKey) {
+      if (!(this_present_publicKey && that_present_publicKey))
+        return false;
+      if (!this.publicKey.equals(that.publicKey))
+        return false;
+    }
+
+    boolean this_present_privateKey = true && this.isSetPrivateKey();
+    boolean that_present_privateKey = true && that.isSetPrivateKey();
+    if (this_present_privateKey || that_present_privateKey) {
+      if (!(this_present_privateKey && that_present_privateKey))
+        return false;
+      if (!this.privateKey.equals(that.privateKey))
+        return false;
+    }
+
+    boolean this_present_persistedTime = true && this.isSetPersistedTime();
+    boolean that_present_persistedTime = true && that.isSetPersistedTime();
+    if (this_present_persistedTime || that_present_persistedTime) {
+      if (!(this_present_persistedTime && that_present_persistedTime))
+        return false;
+      if (this.persistedTime != that.persistedTime)
+        return false;
+    }
+
+    boolean this_present_token = true && this.isSetToken();
+    boolean that_present_token = true && that.isSetToken();
+    if (this_present_token || that_present_token) {
+      if (!(this_present_token && that_present_token))
+        return false;
+      if (!this.token.equals(that.token))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(SSHCredential other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(other.isSetGatewayId());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetGatewayId()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, other.gatewayId);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUsername()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPassphrase()).compareTo(other.isSetPassphrase());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPassphrase()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.passphrase, other.passphrase);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPublicKey()).compareTo(other.isSetPublicKey());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPublicKey()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.publicKey, other.publicKey);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPrivateKey()).compareTo(other.isSetPrivateKey());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPrivateKey()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privateKey, other.privateKey);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPersistedTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetToken()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("SSHCredential(");
+    boolean first = true;
+
+    sb.append("gatewayId:");
+    if (this.gatewayId == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.gatewayId);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("username:");
+    if (this.username == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.username);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("passphrase:");
+    if (this.passphrase == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.passphrase);
+    }
+    first = false;
+    if (isSetPublicKey()) {
+      if (!first) sb.append(", ");
+      sb.append("publicKey:");
+      if (this.publicKey == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.publicKey);
+      }
+      first = false;
+    }
+    if (isSetPrivateKey()) {
+      if (!first) sb.append(", ");
+      sb.append("privateKey:");
+      if (this.privateKey == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.privateKey);
+      }
+      first = false;
+    }
+    if (isSetPersistedTime()) {
+      if (!first) sb.append(", ");
+      sb.append("persistedTime:");
+      sb.append(this.persistedTime);
+      first = false;
+    }
+    if (isSetToken()) {
+      if (!first) sb.append(", ");
+      sb.append("token:");
+      if (this.token == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.token);
+      }
+      first = false;
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (gatewayId == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString());
+    }
+    if (username == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
+    }
+    if (passphrase == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'passphrase' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class SSHCredentialStandardSchemeFactory implements SchemeFactory {
+    public SSHCredentialStandardScheme getScheme() {
+      return new SSHCredentialStandardScheme();
+    }
+  }
+
+  private static class SSHCredentialStandardScheme extends StandardScheme<SSHCredential> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, SSHCredential struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // GATEWAY_ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.gatewayId = iprot.readString();
+              struct.setGatewayIdIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // USERNAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.username = iprot.readString();
+              struct.setUsernameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // PASSPHRASE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.passphrase = iprot.readString();
+              struct.setPassphraseIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // PUBLIC_KEY
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.publicKey = iprot.readString();
+              struct.setPublicKeyIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 5: // PRIVATE_KEY
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.privateKey = iprot.readString();
+              struct.setPrivateKeyIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 6: // PERSISTED_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.persistedTime = iprot.readI64();
+              struct.setPersistedTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 7: // TOKEN
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.token = iprot.readString();
+              struct.setTokenIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, SSHCredential struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.gatewayId != null) {
+        oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
+        oprot.writeString(struct.gatewayId);
+        oprot.writeFieldEnd();
+      }
+      if (struct.username != null) {
+        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+        oprot.writeString(struct.username);
+        oprot.writeFieldEnd();
+      }
+      if (struct.passphrase != null) {
+        oprot.writeFieldBegin(PASSPHRASE_FIELD_DESC);
+        oprot.writeString(struct.passphrase);
+        oprot.writeFieldEnd();
+      }
+      if (struct.publicKey != null) {
+        if (struct.isSetPublicKey()) {
+          oprot.writeFieldBegin(PUBLIC_KEY_FIELD_DESC);
+          oprot.writeString(struct.publicKey);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.privateKey != null) {
+        if (struct.isSetPrivateKey()) {
+          oprot.writeFieldBegin(PRIVATE_KEY_FIELD_DESC);
+          oprot.writeString(struct.privateKey);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC);
+        oprot.writeI64(struct.persistedTime);
+        oprot.writeFieldEnd();
+      }
+      if (struct.token != null) {
+        if (struct.isSetToken()) {
+          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
+          oprot.writeString(struct.token);
+          oprot.writeFieldEnd();
+        }
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class SSHCredentialTupleSchemeFactory implements SchemeFactory {
+    public SSHCredentialTupleScheme getScheme() {
+      return new SSHCredentialTupleScheme();
+    }
+  }
+
+  private static class SSHCredentialTupleScheme extends TupleScheme<SSHCredential> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, SSHCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeString(struct.gatewayId);
+      oprot.writeString(struct.username);
+      oprot.writeString(struct.passphrase);
+      BitSet optionals = new BitSet();
+      if (struct.isSetPublicKey()) {
+        optionals.set(0);
+      }
+      if (struct.isSetPrivateKey()) {
+        optionals.set(1);
+      }
+      if (struct.isSetPersistedTime()) {
+        optionals.set(2);
+      }
+      if (struct.isSetToken()) {
+        optionals.set(3);
+      }
+      oprot.writeBitSet(optionals, 4);
+      if (struct.isSetPublicKey()) {
+        oprot.writeString(struct.publicKey);
+      }
+      if (struct.isSetPrivateKey()) {
+        oprot.writeString(struct.privateKey);
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeI64(struct.persistedTime);
+      }
+      if (struct.isSetToken()) {
+        oprot.writeString(struct.token);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, SSHCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.gatewayId = iprot.readString();
+      struct.setGatewayIdIsSet(true);
+      struct.username = iprot.readString();
+      struct.setUsernameIsSet(true);
+      struct.passphrase = iprot.readString();
+      struct.setPassphraseIsSet(true);
+      BitSet incoming = iprot.readBitSet(4);
+      if (incoming.get(0)) {
+        struct.publicKey = iprot.readString();
+        struct.setPublicKeyIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.privateKey = iprot.readString();
+        struct.setPrivateKeyIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.persistedTime = iprot.readI64();
+        struct.setPersistedTimeIsSet(true);
+      }
+      if (incoming.get(3)) {
+        struct.token = iprot.readString();
+        struct.setTokenIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/csDataModelConstants.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/csDataModelConstants.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/csDataModelConstants.java
new file mode 100644
index 0000000..b17513a
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/csDataModelConstants.java
@@ -0,0 +1,55 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class csDataModelConstants {
+
+  public static final String DEFAULT_ID = "DO_NOT_SET_AT_CLIENTS";
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
new file mode 100644
index 0000000..7be01da
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
@@ -0,0 +1,397 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.exception;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class CredentialStoreException extends TException implements org.apache.thrift.TBase<CredentialStoreException, CredentialStoreException._Fields>, java.io.Serializable, Cloneable, Comparable<CredentialStoreException> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CredentialStoreException");
+
+  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CredentialStoreExceptionStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CredentialStoreExceptionTupleSchemeFactory());
+  }
+
+  public String message; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    MESSAGE((short)1, "message");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // MESSAGE
+          return MESSAGE;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CredentialStoreException.class, metaDataMap);
+  }
+
+  public CredentialStoreException() {
+  }
+
+  public CredentialStoreException(
+    String message)
+  {
+    this();
+    this.message = message;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CredentialStoreException(CredentialStoreException other) {
+    if (other.isSetMessage()) {
+      this.message = other.message;
+    }
+  }
+
+  public CredentialStoreException deepCopy() {
+    return new CredentialStoreException(this);
+  }
+
+  @Override
+  public void clear() {
+    this.message = null;
+  }
+
+  public String getMessage() {
+    return this.message;
+  }
+
+  public CredentialStoreException setMessage(String message) {
+    this.message = message;
+    return this;
+  }
+
+  public void unsetMessage() {
+    this.message = null;
+  }
+
+  /** Returns true if field message is set (has been assigned a value) and false otherwise */
+  public boolean isSetMessage() {
+    return this.message != null;
+  }
+
+  public void setMessageIsSet(boolean value) {
+    if (!value) {
+      this.message = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case MESSAGE:
+      if (value == null) {
+        unsetMessage();
+      } else {
+        setMessage((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case MESSAGE:
+      return getMessage();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case MESSAGE:
+      return isSetMessage();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CredentialStoreException)
+      return this.equals((CredentialStoreException)that);
+    return false;
+  }
+
+  public boolean equals(CredentialStoreException that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_message = true && this.isSetMessage();
+    boolean that_present_message = true && that.isSetMessage();
+    if (this_present_message || that_present_message) {
+      if (!(this_present_message && that_present_message))
+        return false;
+      if (!this.message.equals(that.message))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CredentialStoreException other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetMessage()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("CredentialStoreException(");
+    boolean first = true;
+
+    sb.append("message:");
+    if (this.message == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.message);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (message == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'message' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class CredentialStoreExceptionStandardSchemeFactory implements SchemeFactory {
+    public CredentialStoreExceptionStandardScheme getScheme() {
+      return new CredentialStoreExceptionStandardScheme();
+    }
+  }
+
+  private static class CredentialStoreExceptionStandardScheme extends StandardScheme<CredentialStoreException> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CredentialStoreException struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // MESSAGE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.message = iprot.readString();
+              struct.setMessageIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, CredentialStoreException struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.message != null) {
+        oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+        oprot.writeString(struct.message);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CredentialStoreExceptionTupleSchemeFactory implements SchemeFactory {
+    public CredentialStoreExceptionTupleScheme getScheme() {
+      return new CredentialStoreExceptionTupleScheme();
+    }
+  }
+
+  private static class CredentialStoreExceptionTupleScheme extends TupleScheme<CredentialStoreException> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CredentialStoreException struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeString(struct.message);
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CredentialStoreException struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.message = iprot.readString();
+      struct.setMessageIsSet(true);
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java
new file mode 100644
index 0000000..62b6e27
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java
@@ -0,0 +1,42 @@
+package org.apache.airavata.credential.store.notifier;/*
+ *
+ * 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 org.apache.airavata.credential.store.store.CredentialStoreException;
+
+/**
+ * This class is used to notify particular entity with expiring credentials.
+ * The default implementation uses email messages.
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 12/3/13
+ * Time: 4:17 PM
+ */
+public interface CredentialStoreNotifier {
+
+    /**
+     * The specific notifier implementation needs to implement following method.
+     * This method should actually deliver message to desired entity.
+     * @param message The actual message encapsulated
+     * @throws CredentialStoreException
+     */
+    void notifyMessage(NotificationMessage message) throws CredentialStoreException;
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java
new file mode 100644
index 0000000..96f0bd9
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * 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.notifier;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 12/3/13
+ * Time: 4:21 PM
+ */
+
+/**
+ * Encapsulates the notification message.
+ * Usually says particular credential is expiring and need to renew.
+ */
+public class NotificationMessage {
+
+    protected String message;
+
+    public NotificationMessage(String msg) {
+        this.message = msg;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java
new file mode 100644
index 0000000..de84ae2
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java
@@ -0,0 +1,144 @@
+/*
+ *
+ * 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.notifier;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 12/27/13
+ * Time: 2:22 PM
+ */
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.DBUtil;
+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.notifier.impl.EmailNotificationMessage;
+import org.apache.airavata.credential.store.notifier.impl.EmailNotifier;
+import org.apache.airavata.credential.store.notifier.impl.EmailNotifierConfiguration;
+import org.apache.airavata.credential.store.store.CredentialReader;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
+import org.apache.airavata.credential.store.util.Utility;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * This class runs a timer. Periodically it checks for expiring credentials.
+ * Then if there are expiring credentials this will send an email.
+ */
+public class NotifierBootstrap extends TimerTask {
+
+    private static boolean enabled = false;
+
+    private static String MESSAGE = "Credentials for community user {0} expires at {1}";
+    private static String SUBJECT = "Expiring credentials for user {0}";
+
+    private DBUtil dbUtil;
+
+    private long period;
+
+    protected static Logger log = LoggerFactory.getLogger(NotifierBootstrap.class);
+
+
+    private CredentialStoreNotifier credentialStoreNotifier;
+
+    public NotifierBootstrap(long period, DBUtil db, EmailNotifierConfiguration configuration) {
+        this.period = period;
+
+        // bootstrap
+        if (enabled) {
+            Timer timer = new Timer();
+            timer.scheduleAtFixedRate(this, 0, period);
+        }
+
+        this.dbUtil = db;
+
+        this.credentialStoreNotifier = new EmailNotifier(configuration);
+    }
+
+
+
+    public long getPeriod() {
+        return period;
+    }
+
+    public void setPeriod(long period) {
+        this.period = period;
+    }
+
+    public static boolean isEnabled() {
+        return enabled;
+    }
+
+    public static void setEnabled(boolean enabled) {
+        NotifierBootstrap.enabled = enabled;
+    }
+
+    @Override
+    public void run() {
+
+        if (!enabled)
+            return;
+
+        // retrieve OA4MP credentials
+        try {
+            CredentialReader credentialReader = new CredentialReaderImpl(this.dbUtil);
+            List<Credential> credentials = credentialReader.getAllCredentials();
+
+            for(Credential credential : credentials) {
+                if (credential instanceof CertificateCredential) {
+                    CertificateCredential certificateCredential = (CertificateCredential)credential;
+
+                    Date date = Utility.convertStringToDate(certificateCredential.getNotAfter());
+                    date.setDate(date.getDate() + 1);    // gap is 1 days
+
+                    Date currentDate = new Date();
+                    if (currentDate.after(date)) {
+                        // Send an email
+                        CommunityUser communityUser = certificateCredential.getCommunityUser();
+                        String body =
+                                String.format(MESSAGE, communityUser.getUserName(), certificateCredential.getNotAfter());
+                        String subject = String.format(SUBJECT, communityUser.getUserName());
+                        NotificationMessage notificationMessage
+                                = new EmailNotificationMessage(subject, communityUser.getUserEmail(), body);
+
+                        this.credentialStoreNotifier.notifyMessage(notificationMessage);
+
+                    }
+                }
+            }
+
+        } catch (ApplicationSettingsException e) {
+            log.error("Error configuring email senders.", e);
+        } catch (CredentialStoreException e) {
+            log.error("Error sending emails about credential expiring.", e);
+        } catch (ParseException e) {
+            log.error("Error parsing date time when sending emails", e);
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java
new file mode 100644
index 0000000..ffd84c8
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java
@@ -0,0 +1,58 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.credential.store.notifier.impl;
+
+import org.apache.airavata.credential.store.notifier.NotificationMessage;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 12/3/13
+ * Time: 5:01 PM
+ */
+
+public class EmailNotificationMessage extends NotificationMessage {
+
+    public EmailNotificationMessage(String subject, String senderEmail, String msg) {
+        super(msg);
+        this.subject = subject;
+        this.senderEmail = senderEmail;
+    }
+
+    private String subject;
+    private String senderEmail;
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public String getSenderEmail() {
+        return senderEmail;
+    }
+
+    public void setSenderEmail(String senderEmail) {
+        this.senderEmail = senderEmail;
+    }
+}


[03/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/credentialStoreCPIConstants.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/credentialStoreCPIConstants.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/credentialStoreCPIConstants.java
new file mode 100644
index 0000000..36a0039
--- /dev/null
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/credentialStoreCPIConstants.java
@@ -0,0 +1,55 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.cpi;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class credentialStoreCPIConstants {
+
+  public static final String CS_CPI_VERSION = "0.15.0";
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
new file mode 100644
index 0000000..ae37b1d
--- /dev/null
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
@@ -0,0 +1,1104 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class CertificateCredential implements org.apache.thrift.TBase<CertificateCredential, CertificateCredential._Fields>, java.io.Serializable, Cloneable, Comparable<CertificateCredential> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CertificateCredential");
+
+  private static final org.apache.thrift.protocol.TField COMMUNITY_USER_FIELD_DESC = new org.apache.thrift.protocol.TField("communityUser", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+  private static final org.apache.thrift.protocol.TField X509_CERT_FIELD_DESC = new org.apache.thrift.protocol.TField("x509Cert", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField NOT_AFTER_FIELD_DESC = new org.apache.thrift.protocol.TField("notAfter", org.apache.thrift.protocol.TType.STRING, (short)3);
+  private static final org.apache.thrift.protocol.TField PRIVATE_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("privateKey", org.apache.thrift.protocol.TType.STRING, (short)4);
+  private static final org.apache.thrift.protocol.TField LIFE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lifeTime", org.apache.thrift.protocol.TType.I64, (short)5);
+  private static final org.apache.thrift.protocol.TField NOT_BEFORE_FIELD_DESC = new org.apache.thrift.protocol.TField("notBefore", org.apache.thrift.protocol.TType.STRING, (short)6);
+  private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)7);
+  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)8);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CertificateCredentialStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CertificateCredentialTupleSchemeFactory());
+  }
+
+  public CommunityUser communityUser; // required
+  public String x509Cert; // required
+  public String notAfter; // optional
+  public String privateKey; // optional
+  public long lifeTime; // optional
+  public String notBefore; // optional
+  public long persistedTime; // optional
+  public String token; // optional
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    COMMUNITY_USER((short)1, "communityUser"),
+    X509_CERT((short)2, "x509Cert"),
+    NOT_AFTER((short)3, "notAfter"),
+    PRIVATE_KEY((short)4, "privateKey"),
+    LIFE_TIME((short)5, "lifeTime"),
+    NOT_BEFORE((short)6, "notBefore"),
+    PERSISTED_TIME((short)7, "persistedTime"),
+    TOKEN((short)8, "token");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // COMMUNITY_USER
+          return COMMUNITY_USER;
+        case 2: // X509_CERT
+          return X509_CERT;
+        case 3: // NOT_AFTER
+          return NOT_AFTER;
+        case 4: // PRIVATE_KEY
+          return PRIVATE_KEY;
+        case 5: // LIFE_TIME
+          return LIFE_TIME;
+        case 6: // NOT_BEFORE
+          return NOT_BEFORE;
+        case 7: // PERSISTED_TIME
+          return PERSISTED_TIME;
+        case 8: // TOKEN
+          return TOKEN;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __LIFETIME_ISSET_ID = 0;
+  private static final int __PERSISTEDTIME_ISSET_ID = 1;
+  private byte __isset_bitfield = 0;
+  private _Fields optionals[] = {_Fields.NOT_AFTER,_Fields.PRIVATE_KEY,_Fields.LIFE_TIME,_Fields.NOT_BEFORE,_Fields.PERSISTED_TIME,_Fields.TOKEN};
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.COMMUNITY_USER, new org.apache.thrift.meta_data.FieldMetaData("communityUser", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CommunityUser.class)));
+    tmpMap.put(_Fields.X509_CERT, new org.apache.thrift.meta_data.FieldMetaData("x509Cert", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.NOT_AFTER, new org.apache.thrift.meta_data.FieldMetaData("notAfter", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PRIVATE_KEY, new org.apache.thrift.meta_data.FieldMetaData("privateKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.LIFE_TIME, new org.apache.thrift.meta_data.FieldMetaData("lifeTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.NOT_BEFORE, new org.apache.thrift.meta_data.FieldMetaData("notBefore", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CertificateCredential.class, metaDataMap);
+  }
+
+  public CertificateCredential() {
+  }
+
+  public CertificateCredential(
+    CommunityUser communityUser,
+    String x509Cert)
+  {
+    this();
+    this.communityUser = communityUser;
+    this.x509Cert = x509Cert;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CertificateCredential(CertificateCredential other) {
+    __isset_bitfield = other.__isset_bitfield;
+    if (other.isSetCommunityUser()) {
+      this.communityUser = new CommunityUser(other.communityUser);
+    }
+    if (other.isSetX509Cert()) {
+      this.x509Cert = other.x509Cert;
+    }
+    if (other.isSetNotAfter()) {
+      this.notAfter = other.notAfter;
+    }
+    if (other.isSetPrivateKey()) {
+      this.privateKey = other.privateKey;
+    }
+    this.lifeTime = other.lifeTime;
+    if (other.isSetNotBefore()) {
+      this.notBefore = other.notBefore;
+    }
+    this.persistedTime = other.persistedTime;
+    if (other.isSetToken()) {
+      this.token = other.token;
+    }
+  }
+
+  public CertificateCredential deepCopy() {
+    return new CertificateCredential(this);
+  }
+
+  @Override
+  public void clear() {
+    this.communityUser = null;
+    this.x509Cert = null;
+    this.notAfter = null;
+    this.privateKey = null;
+    setLifeTimeIsSet(false);
+    this.lifeTime = 0;
+    this.notBefore = null;
+    setPersistedTimeIsSet(false);
+    this.persistedTime = 0;
+    this.token = null;
+  }
+
+  public CommunityUser getCommunityUser() {
+    return this.communityUser;
+  }
+
+  public CertificateCredential setCommunityUser(CommunityUser communityUser) {
+    this.communityUser = communityUser;
+    return this;
+  }
+
+  public void unsetCommunityUser() {
+    this.communityUser = null;
+  }
+
+  /** Returns true if field communityUser is set (has been assigned a value) and false otherwise */
+  public boolean isSetCommunityUser() {
+    return this.communityUser != null;
+  }
+
+  public void setCommunityUserIsSet(boolean value) {
+    if (!value) {
+      this.communityUser = null;
+    }
+  }
+
+  public String getX509Cert() {
+    return this.x509Cert;
+  }
+
+  public CertificateCredential setX509Cert(String x509Cert) {
+    this.x509Cert = x509Cert;
+    return this;
+  }
+
+  public void unsetX509Cert() {
+    this.x509Cert = null;
+  }
+
+  /** Returns true if field x509Cert is set (has been assigned a value) and false otherwise */
+  public boolean isSetX509Cert() {
+    return this.x509Cert != null;
+  }
+
+  public void setX509CertIsSet(boolean value) {
+    if (!value) {
+      this.x509Cert = null;
+    }
+  }
+
+  public String getNotAfter() {
+    return this.notAfter;
+  }
+
+  public CertificateCredential setNotAfter(String notAfter) {
+    this.notAfter = notAfter;
+    return this;
+  }
+
+  public void unsetNotAfter() {
+    this.notAfter = null;
+  }
+
+  /** Returns true if field notAfter is set (has been assigned a value) and false otherwise */
+  public boolean isSetNotAfter() {
+    return this.notAfter != null;
+  }
+
+  public void setNotAfterIsSet(boolean value) {
+    if (!value) {
+      this.notAfter = null;
+    }
+  }
+
+  public String getPrivateKey() {
+    return this.privateKey;
+  }
+
+  public CertificateCredential setPrivateKey(String privateKey) {
+    this.privateKey = privateKey;
+    return this;
+  }
+
+  public void unsetPrivateKey() {
+    this.privateKey = null;
+  }
+
+  /** Returns true if field privateKey is set (has been assigned a value) and false otherwise */
+  public boolean isSetPrivateKey() {
+    return this.privateKey != null;
+  }
+
+  public void setPrivateKeyIsSet(boolean value) {
+    if (!value) {
+      this.privateKey = null;
+    }
+  }
+
+  public long getLifeTime() {
+    return this.lifeTime;
+  }
+
+  public CertificateCredential setLifeTime(long lifeTime) {
+    this.lifeTime = lifeTime;
+    setLifeTimeIsSet(true);
+    return this;
+  }
+
+  public void unsetLifeTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LIFETIME_ISSET_ID);
+  }
+
+  /** Returns true if field lifeTime is set (has been assigned a value) and false otherwise */
+  public boolean isSetLifeTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __LIFETIME_ISSET_ID);
+  }
+
+  public void setLifeTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LIFETIME_ISSET_ID, value);
+  }
+
+  public String getNotBefore() {
+    return this.notBefore;
+  }
+
+  public CertificateCredential setNotBefore(String notBefore) {
+    this.notBefore = notBefore;
+    return this;
+  }
+
+  public void unsetNotBefore() {
+    this.notBefore = null;
+  }
+
+  /** Returns true if field notBefore is set (has been assigned a value) and false otherwise */
+  public boolean isSetNotBefore() {
+    return this.notBefore != null;
+  }
+
+  public void setNotBeforeIsSet(boolean value) {
+    if (!value) {
+      this.notBefore = null;
+    }
+  }
+
+  public long getPersistedTime() {
+    return this.persistedTime;
+  }
+
+  public CertificateCredential setPersistedTime(long persistedTime) {
+    this.persistedTime = persistedTime;
+    setPersistedTimeIsSet(true);
+    return this;
+  }
+
+  public void unsetPersistedTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */
+  public boolean isSetPersistedTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  public void setPersistedTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value);
+  }
+
+  public String getToken() {
+    return this.token;
+  }
+
+  public CertificateCredential setToken(String token) {
+    this.token = token;
+    return this;
+  }
+
+  public void unsetToken() {
+    this.token = null;
+  }
+
+  /** Returns true if field token is set (has been assigned a value) and false otherwise */
+  public boolean isSetToken() {
+    return this.token != null;
+  }
+
+  public void setTokenIsSet(boolean value) {
+    if (!value) {
+      this.token = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case COMMUNITY_USER:
+      if (value == null) {
+        unsetCommunityUser();
+      } else {
+        setCommunityUser((CommunityUser)value);
+      }
+      break;
+
+    case X509_CERT:
+      if (value == null) {
+        unsetX509Cert();
+      } else {
+        setX509Cert((String)value);
+      }
+      break;
+
+    case NOT_AFTER:
+      if (value == null) {
+        unsetNotAfter();
+      } else {
+        setNotAfter((String)value);
+      }
+      break;
+
+    case PRIVATE_KEY:
+      if (value == null) {
+        unsetPrivateKey();
+      } else {
+        setPrivateKey((String)value);
+      }
+      break;
+
+    case LIFE_TIME:
+      if (value == null) {
+        unsetLifeTime();
+      } else {
+        setLifeTime((Long)value);
+      }
+      break;
+
+    case NOT_BEFORE:
+      if (value == null) {
+        unsetNotBefore();
+      } else {
+        setNotBefore((String)value);
+      }
+      break;
+
+    case PERSISTED_TIME:
+      if (value == null) {
+        unsetPersistedTime();
+      } else {
+        setPersistedTime((Long)value);
+      }
+      break;
+
+    case TOKEN:
+      if (value == null) {
+        unsetToken();
+      } else {
+        setToken((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case COMMUNITY_USER:
+      return getCommunityUser();
+
+    case X509_CERT:
+      return getX509Cert();
+
+    case NOT_AFTER:
+      return getNotAfter();
+
+    case PRIVATE_KEY:
+      return getPrivateKey();
+
+    case LIFE_TIME:
+      return Long.valueOf(getLifeTime());
+
+    case NOT_BEFORE:
+      return getNotBefore();
+
+    case PERSISTED_TIME:
+      return Long.valueOf(getPersistedTime());
+
+    case TOKEN:
+      return getToken();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case COMMUNITY_USER:
+      return isSetCommunityUser();
+    case X509_CERT:
+      return isSetX509Cert();
+    case NOT_AFTER:
+      return isSetNotAfter();
+    case PRIVATE_KEY:
+      return isSetPrivateKey();
+    case LIFE_TIME:
+      return isSetLifeTime();
+    case NOT_BEFORE:
+      return isSetNotBefore();
+    case PERSISTED_TIME:
+      return isSetPersistedTime();
+    case TOKEN:
+      return isSetToken();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CertificateCredential)
+      return this.equals((CertificateCredential)that);
+    return false;
+  }
+
+  public boolean equals(CertificateCredential that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_communityUser = true && this.isSetCommunityUser();
+    boolean that_present_communityUser = true && that.isSetCommunityUser();
+    if (this_present_communityUser || that_present_communityUser) {
+      if (!(this_present_communityUser && that_present_communityUser))
+        return false;
+      if (!this.communityUser.equals(that.communityUser))
+        return false;
+    }
+
+    boolean this_present_x509Cert = true && this.isSetX509Cert();
+    boolean that_present_x509Cert = true && that.isSetX509Cert();
+    if (this_present_x509Cert || that_present_x509Cert) {
+      if (!(this_present_x509Cert && that_present_x509Cert))
+        return false;
+      if (!this.x509Cert.equals(that.x509Cert))
+        return false;
+    }
+
+    boolean this_present_notAfter = true && this.isSetNotAfter();
+    boolean that_present_notAfter = true && that.isSetNotAfter();
+    if (this_present_notAfter || that_present_notAfter) {
+      if (!(this_present_notAfter && that_present_notAfter))
+        return false;
+      if (!this.notAfter.equals(that.notAfter))
+        return false;
+    }
+
+    boolean this_present_privateKey = true && this.isSetPrivateKey();
+    boolean that_present_privateKey = true && that.isSetPrivateKey();
+    if (this_present_privateKey || that_present_privateKey) {
+      if (!(this_present_privateKey && that_present_privateKey))
+        return false;
+      if (!this.privateKey.equals(that.privateKey))
+        return false;
+    }
+
+    boolean this_present_lifeTime = true && this.isSetLifeTime();
+    boolean that_present_lifeTime = true && that.isSetLifeTime();
+    if (this_present_lifeTime || that_present_lifeTime) {
+      if (!(this_present_lifeTime && that_present_lifeTime))
+        return false;
+      if (this.lifeTime != that.lifeTime)
+        return false;
+    }
+
+    boolean this_present_notBefore = true && this.isSetNotBefore();
+    boolean that_present_notBefore = true && that.isSetNotBefore();
+    if (this_present_notBefore || that_present_notBefore) {
+      if (!(this_present_notBefore && that_present_notBefore))
+        return false;
+      if (!this.notBefore.equals(that.notBefore))
+        return false;
+    }
+
+    boolean this_present_persistedTime = true && this.isSetPersistedTime();
+    boolean that_present_persistedTime = true && that.isSetPersistedTime();
+    if (this_present_persistedTime || that_present_persistedTime) {
+      if (!(this_present_persistedTime && that_present_persistedTime))
+        return false;
+      if (this.persistedTime != that.persistedTime)
+        return false;
+    }
+
+    boolean this_present_token = true && this.isSetToken();
+    boolean that_present_token = true && that.isSetToken();
+    if (this_present_token || that_present_token) {
+      if (!(this_present_token && that_present_token))
+        return false;
+      if (!this.token.equals(that.token))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CertificateCredential other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetCommunityUser()).compareTo(other.isSetCommunityUser());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCommunityUser()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.communityUser, other.communityUser);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetX509Cert()).compareTo(other.isSetX509Cert());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetX509Cert()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.x509Cert, other.x509Cert);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetNotAfter()).compareTo(other.isSetNotAfter());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetNotAfter()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notAfter, other.notAfter);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPrivateKey()).compareTo(other.isSetPrivateKey());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPrivateKey()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privateKey, other.privateKey);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetLifeTime()).compareTo(other.isSetLifeTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetLifeTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lifeTime, other.lifeTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetNotBefore()).compareTo(other.isSetNotBefore());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetNotBefore()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notBefore, other.notBefore);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPersistedTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetToken()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("CertificateCredential(");
+    boolean first = true;
+
+    sb.append("communityUser:");
+    if (this.communityUser == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.communityUser);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("x509Cert:");
+    if (this.x509Cert == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.x509Cert);
+    }
+    first = false;
+    if (isSetNotAfter()) {
+      if (!first) sb.append(", ");
+      sb.append("notAfter:");
+      if (this.notAfter == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.notAfter);
+      }
+      first = false;
+    }
+    if (isSetPrivateKey()) {
+      if (!first) sb.append(", ");
+      sb.append("privateKey:");
+      if (this.privateKey == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.privateKey);
+      }
+      first = false;
+    }
+    if (isSetLifeTime()) {
+      if (!first) sb.append(", ");
+      sb.append("lifeTime:");
+      sb.append(this.lifeTime);
+      first = false;
+    }
+    if (isSetNotBefore()) {
+      if (!first) sb.append(", ");
+      sb.append("notBefore:");
+      if (this.notBefore == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.notBefore);
+      }
+      first = false;
+    }
+    if (isSetPersistedTime()) {
+      if (!first) sb.append(", ");
+      sb.append("persistedTime:");
+      sb.append(this.persistedTime);
+      first = false;
+    }
+    if (isSetToken()) {
+      if (!first) sb.append(", ");
+      sb.append("token:");
+      if (this.token == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.token);
+      }
+      first = false;
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (communityUser == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'communityUser' was not present! Struct: " + toString());
+    }
+    if (x509Cert == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'x509Cert' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+    if (communityUser != null) {
+      communityUser.validate();
+    }
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class CertificateCredentialStandardSchemeFactory implements SchemeFactory {
+    public CertificateCredentialStandardScheme getScheme() {
+      return new CertificateCredentialStandardScheme();
+    }
+  }
+
+  private static class CertificateCredentialStandardScheme extends StandardScheme<CertificateCredential> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CertificateCredential struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // COMMUNITY_USER
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+              struct.communityUser = new CommunityUser();
+              struct.communityUser.read(iprot);
+              struct.setCommunityUserIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // X509_CERT
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.x509Cert = iprot.readString();
+              struct.setX509CertIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // NOT_AFTER
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.notAfter = iprot.readString();
+              struct.setNotAfterIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // PRIVATE_KEY
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.privateKey = iprot.readString();
+              struct.setPrivateKeyIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 5: // LIFE_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.lifeTime = iprot.readI64();
+              struct.setLifeTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 6: // NOT_BEFORE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.notBefore = iprot.readString();
+              struct.setNotBeforeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 7: // PERSISTED_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.persistedTime = iprot.readI64();
+              struct.setPersistedTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 8: // TOKEN
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.token = iprot.readString();
+              struct.setTokenIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, CertificateCredential struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.communityUser != null) {
+        oprot.writeFieldBegin(COMMUNITY_USER_FIELD_DESC);
+        struct.communityUser.write(oprot);
+        oprot.writeFieldEnd();
+      }
+      if (struct.x509Cert != null) {
+        oprot.writeFieldBegin(X509_CERT_FIELD_DESC);
+        oprot.writeString(struct.x509Cert);
+        oprot.writeFieldEnd();
+      }
+      if (struct.notAfter != null) {
+        if (struct.isSetNotAfter()) {
+          oprot.writeFieldBegin(NOT_AFTER_FIELD_DESC);
+          oprot.writeString(struct.notAfter);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.privateKey != null) {
+        if (struct.isSetPrivateKey()) {
+          oprot.writeFieldBegin(PRIVATE_KEY_FIELD_DESC);
+          oprot.writeString(struct.privateKey);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.isSetLifeTime()) {
+        oprot.writeFieldBegin(LIFE_TIME_FIELD_DESC);
+        oprot.writeI64(struct.lifeTime);
+        oprot.writeFieldEnd();
+      }
+      if (struct.notBefore != null) {
+        if (struct.isSetNotBefore()) {
+          oprot.writeFieldBegin(NOT_BEFORE_FIELD_DESC);
+          oprot.writeString(struct.notBefore);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC);
+        oprot.writeI64(struct.persistedTime);
+        oprot.writeFieldEnd();
+      }
+      if (struct.token != null) {
+        if (struct.isSetToken()) {
+          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
+          oprot.writeString(struct.token);
+          oprot.writeFieldEnd();
+        }
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CertificateCredentialTupleSchemeFactory implements SchemeFactory {
+    public CertificateCredentialTupleScheme getScheme() {
+      return new CertificateCredentialTupleScheme();
+    }
+  }
+
+  private static class CertificateCredentialTupleScheme extends TupleScheme<CertificateCredential> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CertificateCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      struct.communityUser.write(oprot);
+      oprot.writeString(struct.x509Cert);
+      BitSet optionals = new BitSet();
+      if (struct.isSetNotAfter()) {
+        optionals.set(0);
+      }
+      if (struct.isSetPrivateKey()) {
+        optionals.set(1);
+      }
+      if (struct.isSetLifeTime()) {
+        optionals.set(2);
+      }
+      if (struct.isSetNotBefore()) {
+        optionals.set(3);
+      }
+      if (struct.isSetPersistedTime()) {
+        optionals.set(4);
+      }
+      if (struct.isSetToken()) {
+        optionals.set(5);
+      }
+      oprot.writeBitSet(optionals, 6);
+      if (struct.isSetNotAfter()) {
+        oprot.writeString(struct.notAfter);
+      }
+      if (struct.isSetPrivateKey()) {
+        oprot.writeString(struct.privateKey);
+      }
+      if (struct.isSetLifeTime()) {
+        oprot.writeI64(struct.lifeTime);
+      }
+      if (struct.isSetNotBefore()) {
+        oprot.writeString(struct.notBefore);
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeI64(struct.persistedTime);
+      }
+      if (struct.isSetToken()) {
+        oprot.writeString(struct.token);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CertificateCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.communityUser = new CommunityUser();
+      struct.communityUser.read(iprot);
+      struct.setCommunityUserIsSet(true);
+      struct.x509Cert = iprot.readString();
+      struct.setX509CertIsSet(true);
+      BitSet incoming = iprot.readBitSet(6);
+      if (incoming.get(0)) {
+        struct.notAfter = iprot.readString();
+        struct.setNotAfterIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.privateKey = iprot.readString();
+        struct.setPrivateKeyIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.lifeTime = iprot.readI64();
+        struct.setLifeTimeIsSet(true);
+      }
+      if (incoming.get(3)) {
+        struct.notBefore = iprot.readString();
+        struct.setNotBeforeIsSet(true);
+      }
+      if (incoming.get(4)) {
+        struct.persistedTime = iprot.readI64();
+        struct.setPersistedTimeIsSet(true);
+      }
+      if (incoming.get(5)) {
+        struct.token = iprot.readString();
+        struct.setTokenIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
new file mode 100644
index 0000000..02bce55
--- /dev/null
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
@@ -0,0 +1,589 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class CommunityUser implements org.apache.thrift.TBase<CommunityUser, CommunityUser._Fields>, java.io.Serializable, Cloneable, Comparable<CommunityUser> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CommunityUser");
+
+  private static final org.apache.thrift.protocol.TField GATEWAY_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayName", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField USER_EMAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("userEmail", org.apache.thrift.protocol.TType.STRING, (short)3);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CommunityUserStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CommunityUserTupleSchemeFactory());
+  }
+
+  public String gatewayName; // required
+  public String username; // required
+  public String userEmail; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    GATEWAY_NAME((short)1, "gatewayName"),
+    USERNAME((short)2, "username"),
+    USER_EMAIL((short)3, "userEmail");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // GATEWAY_NAME
+          return GATEWAY_NAME;
+        case 2: // USERNAME
+          return USERNAME;
+        case 3: // USER_EMAIL
+          return USER_EMAIL;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.GATEWAY_NAME, new org.apache.thrift.meta_data.FieldMetaData("gatewayName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.USER_EMAIL, new org.apache.thrift.meta_data.FieldMetaData("userEmail", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CommunityUser.class, metaDataMap);
+  }
+
+  public CommunityUser() {
+  }
+
+  public CommunityUser(
+    String gatewayName,
+    String username,
+    String userEmail)
+  {
+    this();
+    this.gatewayName = gatewayName;
+    this.username = username;
+    this.userEmail = userEmail;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CommunityUser(CommunityUser other) {
+    if (other.isSetGatewayName()) {
+      this.gatewayName = other.gatewayName;
+    }
+    if (other.isSetUsername()) {
+      this.username = other.username;
+    }
+    if (other.isSetUserEmail()) {
+      this.userEmail = other.userEmail;
+    }
+  }
+
+  public CommunityUser deepCopy() {
+    return new CommunityUser(this);
+  }
+
+  @Override
+  public void clear() {
+    this.gatewayName = null;
+    this.username = null;
+    this.userEmail = null;
+  }
+
+  public String getGatewayName() {
+    return this.gatewayName;
+  }
+
+  public CommunityUser setGatewayName(String gatewayName) {
+    this.gatewayName = gatewayName;
+    return this;
+  }
+
+  public void unsetGatewayName() {
+    this.gatewayName = null;
+  }
+
+  /** Returns true if field gatewayName is set (has been assigned a value) and false otherwise */
+  public boolean isSetGatewayName() {
+    return this.gatewayName != null;
+  }
+
+  public void setGatewayNameIsSet(boolean value) {
+    if (!value) {
+      this.gatewayName = null;
+    }
+  }
+
+  public String getUsername() {
+    return this.username;
+  }
+
+  public CommunityUser setUsername(String username) {
+    this.username = username;
+    return this;
+  }
+
+  public void unsetUsername() {
+    this.username = null;
+  }
+
+  /** Returns true if field username is set (has been assigned a value) and false otherwise */
+  public boolean isSetUsername() {
+    return this.username != null;
+  }
+
+  public void setUsernameIsSet(boolean value) {
+    if (!value) {
+      this.username = null;
+    }
+  }
+
+  public String getUserEmail() {
+    return this.userEmail;
+  }
+
+  public CommunityUser setUserEmail(String userEmail) {
+    this.userEmail = userEmail;
+    return this;
+  }
+
+  public void unsetUserEmail() {
+    this.userEmail = null;
+  }
+
+  /** Returns true if field userEmail is set (has been assigned a value) and false otherwise */
+  public boolean isSetUserEmail() {
+    return this.userEmail != null;
+  }
+
+  public void setUserEmailIsSet(boolean value) {
+    if (!value) {
+      this.userEmail = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case GATEWAY_NAME:
+      if (value == null) {
+        unsetGatewayName();
+      } else {
+        setGatewayName((String)value);
+      }
+      break;
+
+    case USERNAME:
+      if (value == null) {
+        unsetUsername();
+      } else {
+        setUsername((String)value);
+      }
+      break;
+
+    case USER_EMAIL:
+      if (value == null) {
+        unsetUserEmail();
+      } else {
+        setUserEmail((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case GATEWAY_NAME:
+      return getGatewayName();
+
+    case USERNAME:
+      return getUsername();
+
+    case USER_EMAIL:
+      return getUserEmail();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case GATEWAY_NAME:
+      return isSetGatewayName();
+    case USERNAME:
+      return isSetUsername();
+    case USER_EMAIL:
+      return isSetUserEmail();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CommunityUser)
+      return this.equals((CommunityUser)that);
+    return false;
+  }
+
+  public boolean equals(CommunityUser that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_gatewayName = true && this.isSetGatewayName();
+    boolean that_present_gatewayName = true && that.isSetGatewayName();
+    if (this_present_gatewayName || that_present_gatewayName) {
+      if (!(this_present_gatewayName && that_present_gatewayName))
+        return false;
+      if (!this.gatewayName.equals(that.gatewayName))
+        return false;
+    }
+
+    boolean this_present_username = true && this.isSetUsername();
+    boolean that_present_username = true && that.isSetUsername();
+    if (this_present_username || that_present_username) {
+      if (!(this_present_username && that_present_username))
+        return false;
+      if (!this.username.equals(that.username))
+        return false;
+    }
+
+    boolean this_present_userEmail = true && this.isSetUserEmail();
+    boolean that_present_userEmail = true && that.isSetUserEmail();
+    if (this_present_userEmail || that_present_userEmail) {
+      if (!(this_present_userEmail && that_present_userEmail))
+        return false;
+      if (!this.userEmail.equals(that.userEmail))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CommunityUser other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetGatewayName()).compareTo(other.isSetGatewayName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetGatewayName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayName, other.gatewayName);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUsername()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetUserEmail()).compareTo(other.isSetUserEmail());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUserEmail()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userEmail, other.userEmail);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("CommunityUser(");
+    boolean first = true;
+
+    sb.append("gatewayName:");
+    if (this.gatewayName == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.gatewayName);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("username:");
+    if (this.username == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.username);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("userEmail:");
+    if (this.userEmail == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.userEmail);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (gatewayName == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayName' was not present! Struct: " + toString());
+    }
+    if (username == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
+    }
+    if (userEmail == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'userEmail' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class CommunityUserStandardSchemeFactory implements SchemeFactory {
+    public CommunityUserStandardScheme getScheme() {
+      return new CommunityUserStandardScheme();
+    }
+  }
+
+  private static class CommunityUserStandardScheme extends StandardScheme<CommunityUser> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CommunityUser struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // GATEWAY_NAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.gatewayName = iprot.readString();
+              struct.setGatewayNameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // USERNAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.username = iprot.readString();
+              struct.setUsernameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // USER_EMAIL
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.userEmail = iprot.readString();
+              struct.setUserEmailIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, CommunityUser struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.gatewayName != null) {
+        oprot.writeFieldBegin(GATEWAY_NAME_FIELD_DESC);
+        oprot.writeString(struct.gatewayName);
+        oprot.writeFieldEnd();
+      }
+      if (struct.username != null) {
+        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+        oprot.writeString(struct.username);
+        oprot.writeFieldEnd();
+      }
+      if (struct.userEmail != null) {
+        oprot.writeFieldBegin(USER_EMAIL_FIELD_DESC);
+        oprot.writeString(struct.userEmail);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CommunityUserTupleSchemeFactory implements SchemeFactory {
+    public CommunityUserTupleScheme getScheme() {
+      return new CommunityUserTupleScheme();
+    }
+  }
+
+  private static class CommunityUserTupleScheme extends TupleScheme<CommunityUser> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CommunityUser struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeString(struct.gatewayName);
+      oprot.writeString(struct.username);
+      oprot.writeString(struct.userEmail);
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CommunityUser struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.gatewayName = iprot.readString();
+      struct.setGatewayNameIsSet(true);
+      struct.username = iprot.readString();
+      struct.setUsernameIsSet(true);
+      struct.userEmail = iprot.readString();
+      struct.setUserEmailIsSet(true);
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
new file mode 100644
index 0000000..f6b6837
--- /dev/null
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
@@ -0,0 +1,698 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class PasswordCredential implements org.apache.thrift.TBase<PasswordCredential, PasswordCredential._Fields>, java.io.Serializable, Cloneable, Comparable<PasswordCredential> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PasswordCredential");
+
+  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)3);
+  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)4);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new PasswordCredentialStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new PasswordCredentialTupleSchemeFactory());
+  }
+
+  public String username; // required
+  public String password; // required
+  public long persistedTime; // optional
+  public String token; // optional
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    USERNAME((short)1, "username"),
+    PASSWORD((short)2, "password"),
+    PERSISTED_TIME((short)3, "persistedTime"),
+    TOKEN((short)4, "token");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // USERNAME
+          return USERNAME;
+        case 2: // PASSWORD
+          return PASSWORD;
+        case 3: // PERSISTED_TIME
+          return PERSISTED_TIME;
+        case 4: // TOKEN
+          return TOKEN;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __PERSISTEDTIME_ISSET_ID = 0;
+  private byte __isset_bitfield = 0;
+  private _Fields optionals[] = {_Fields.PERSISTED_TIME,_Fields.TOKEN};
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PasswordCredential.class, metaDataMap);
+  }
+
+  public PasswordCredential() {
+  }
+
+  public PasswordCredential(
+    String username,
+    String password)
+  {
+    this();
+    this.username = username;
+    this.password = password;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public PasswordCredential(PasswordCredential other) {
+    __isset_bitfield = other.__isset_bitfield;
+    if (other.isSetUsername()) {
+      this.username = other.username;
+    }
+    if (other.isSetPassword()) {
+      this.password = other.password;
+    }
+    this.persistedTime = other.persistedTime;
+    if (other.isSetToken()) {
+      this.token = other.token;
+    }
+  }
+
+  public PasswordCredential deepCopy() {
+    return new PasswordCredential(this);
+  }
+
+  @Override
+  public void clear() {
+    this.username = null;
+    this.password = null;
+    setPersistedTimeIsSet(false);
+    this.persistedTime = 0;
+    this.token = null;
+  }
+
+  public String getUsername() {
+    return this.username;
+  }
+
+  public PasswordCredential setUsername(String username) {
+    this.username = username;
+    return this;
+  }
+
+  public void unsetUsername() {
+    this.username = null;
+  }
+
+  /** Returns true if field username is set (has been assigned a value) and false otherwise */
+  public boolean isSetUsername() {
+    return this.username != null;
+  }
+
+  public void setUsernameIsSet(boolean value) {
+    if (!value) {
+      this.username = null;
+    }
+  }
+
+  public String getPassword() {
+    return this.password;
+  }
+
+  public PasswordCredential setPassword(String password) {
+    this.password = password;
+    return this;
+  }
+
+  public void unsetPassword() {
+    this.password = null;
+  }
+
+  /** Returns true if field password is set (has been assigned a value) and false otherwise */
+  public boolean isSetPassword() {
+    return this.password != null;
+  }
+
+  public void setPasswordIsSet(boolean value) {
+    if (!value) {
+      this.password = null;
+    }
+  }
+
+  public long getPersistedTime() {
+    return this.persistedTime;
+  }
+
+  public PasswordCredential setPersistedTime(long persistedTime) {
+    this.persistedTime = persistedTime;
+    setPersistedTimeIsSet(true);
+    return this;
+  }
+
+  public void unsetPersistedTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */
+  public boolean isSetPersistedTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  public void setPersistedTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value);
+  }
+
+  public String getToken() {
+    return this.token;
+  }
+
+  public PasswordCredential setToken(String token) {
+    this.token = token;
+    return this;
+  }
+
+  public void unsetToken() {
+    this.token = null;
+  }
+
+  /** Returns true if field token is set (has been assigned a value) and false otherwise */
+  public boolean isSetToken() {
+    return this.token != null;
+  }
+
+  public void setTokenIsSet(boolean value) {
+    if (!value) {
+      this.token = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case USERNAME:
+      if (value == null) {
+        unsetUsername();
+      } else {
+        setUsername((String)value);
+      }
+      break;
+
+    case PASSWORD:
+      if (value == null) {
+        unsetPassword();
+      } else {
+        setPassword((String)value);
+      }
+      break;
+
+    case PERSISTED_TIME:
+      if (value == null) {
+        unsetPersistedTime();
+      } else {
+        setPersistedTime((Long)value);
+      }
+      break;
+
+    case TOKEN:
+      if (value == null) {
+        unsetToken();
+      } else {
+        setToken((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case USERNAME:
+      return getUsername();
+
+    case PASSWORD:
+      return getPassword();
+
+    case PERSISTED_TIME:
+      return Long.valueOf(getPersistedTime());
+
+    case TOKEN:
+      return getToken();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case USERNAME:
+      return isSetUsername();
+    case PASSWORD:
+      return isSetPassword();
+    case PERSISTED_TIME:
+      return isSetPersistedTime();
+    case TOKEN:
+      return isSetToken();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof PasswordCredential)
+      return this.equals((PasswordCredential)that);
+    return false;
+  }
+
+  public boolean equals(PasswordCredential that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_username = true && this.isSetUsername();
+    boolean that_present_username = true && that.isSetUsername();
+    if (this_present_username || that_present_username) {
+      if (!(this_present_username && that_present_username))
+        return false;
+      if (!this.username.equals(that.username))
+        return false;
+    }
+
+    boolean this_present_password = true && this.isSetPassword();
+    boolean that_present_password = true && that.isSetPassword();
+    if (this_present_password || that_present_password) {
+      if (!(this_present_password && that_present_password))
+        return false;
+      if (!this.password.equals(that.password))
+        return false;
+    }
+
+    boolean this_present_persistedTime = true && this.isSetPersistedTime();
+    boolean that_present_persistedTime = true && that.isSetPersistedTime();
+    if (this_present_persistedTime || that_present_persistedTime) {
+      if (!(this_present_persistedTime && that_present_persistedTime))
+        return false;
+      if (this.persistedTime != that.persistedTime)
+        return false;
+    }
+
+    boolean this_present_token = true && this.isSetToken();
+    boolean that_present_token = true && that.isSetToken();
+    if (this_present_token || that_present_token) {
+      if (!(this_present_token && that_present_token))
+        return false;
+      if (!this.token.equals(that.token))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(PasswordCredential other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUsername()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPassword()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPersistedTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetToken()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("PasswordCredential(");
+    boolean first = true;
+
+    sb.append("username:");
+    if (this.username == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.username);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("password:");
+    if (this.password == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.password);
+    }
+    first = false;
+    if (isSetPersistedTime()) {
+      if (!first) sb.append(", ");
+      sb.append("persistedTime:");
+      sb.append(this.persistedTime);
+      first = false;
+    }
+    if (isSetToken()) {
+      if (!first) sb.append(", ");
+      sb.append("token:");
+      if (this.token == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.token);
+      }
+      first = false;
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (username == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
+    }
+    if (password == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'password' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class PasswordCredentialStandardSchemeFactory implements SchemeFactory {
+    public PasswordCredentialStandardScheme getScheme() {
+      return new PasswordCredentialStandardScheme();
+    }
+  }
+
+  private static class PasswordCredentialStandardScheme extends StandardScheme<PasswordCredential> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, PasswordCredential struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // USERNAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.username = iprot.readString();
+              struct.setUsernameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // PASSWORD
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.password = iprot.readString();
+              struct.setPasswordIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // PERSISTED_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.persistedTime = iprot.readI64();
+              struct.setPersistedTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // TOKEN
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.token = iprot.readString();
+              struct.setTokenIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, PasswordCredential struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.username != null) {
+        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+        oprot.writeString(struct.username);
+        oprot.writeFieldEnd();
+      }
+      if (struct.password != null) {
+        oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
+        oprot.writeString(struct.password);
+        oprot.writeFieldEnd();
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC);
+        oprot.writeI64(struct.persistedTime);
+        oprot.writeFieldEnd();
+      }
+      if (struct.token != null) {
+        if (struct.isSetToken()) {
+          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
+          oprot.writeString(struct.token);
+          oprot.writeFieldEnd();
+        }
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class PasswordCredentialTupleSchemeFactory implements SchemeFactory {
+    public PasswordCredentialTupleScheme getScheme() {
+      return new PasswordCredentialTupleScheme();
+    }
+  }
+
+  private static class PasswordCredentialTupleScheme extends TupleScheme<PasswordCredential> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, PasswordCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeString(struct.username);
+      oprot.writeString(struct.password);
+      BitSet optionals = new BitSet();
+      if (struct.isSetPersistedTime()) {
+        optionals.set(0);
+      }
+      if (struct.isSetToken()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetPersistedTime()) {
+        oprot.writeI64(struct.persistedTime);
+      }
+      if (struct.isSetToken()) {
+        oprot.writeString(struct.token);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, PasswordCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.username = iprot.readString();
+      struct.setUsernameIsSet(true);
+      struct.password = iprot.readString();
+      struct.setPasswordIsSet(true);
+      BitSet incoming = iprot.readBitSet(2);
+      if (incoming.get(0)) {
+        struct.persistedTime = iprot.readI64();
+        struct.setPersistedTimeIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.token = iprot.readString();
+        struct.setTokenIsSet(true);
+      }
+    }
+  }
+
+}
+


[12/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java
deleted file mode 100644
index e52b211..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * 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.notifier.impl;
-
-import org.apache.airavata.credential.store.notifier.CredentialStoreNotifier;
-import org.apache.airavata.credential.store.notifier.NotificationMessage;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.apache.commons.mail.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 12/3/13
- * Time: 4:25 PM
- */
-
-public class EmailNotifier implements CredentialStoreNotifier {
-
-    protected static Logger log = LoggerFactory.getLogger(EmailNotifier.class);
-
-    private EmailNotifierConfiguration emailNotifierConfiguration;
-
-    public EmailNotifier(EmailNotifierConfiguration notifierConfiguration) {
-        this.emailNotifierConfiguration = notifierConfiguration;
-    }
-
-    public void notifyMessage(NotificationMessage message) throws CredentialStoreException {
-        try {
-            Email email = new SimpleEmail();
-            email.setHostName(this.emailNotifierConfiguration.getEmailServer());
-            email.setSmtpPort(this.emailNotifierConfiguration.getEmailServerPort());
-            email.setAuthenticator(new DefaultAuthenticator(this.emailNotifierConfiguration.getEmailUserName(),
-                    this.emailNotifierConfiguration.getEmailPassword()));
-            email.setSSLOnConnect(this.emailNotifierConfiguration.isSslConnect());
-            email.setFrom(this.emailNotifierConfiguration.getFromAddress());
-
-            EmailNotificationMessage emailMessage = (EmailNotificationMessage)message;
-
-            email.setSubject(emailMessage.getSubject());
-            email.setMsg(emailMessage.getMessage());
-            email.addTo(emailMessage.getSenderEmail());
-            email.send();
-
-        } catch (EmailException e) {
-            log.error("[CredentialStore]Error sending email notification message.");
-            throw new CredentialStoreException("Error sending email notification message", e);
-        }
-
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java
deleted file mode 100644
index b1a204f..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * 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.notifier.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ApplicationSettings;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 12/3/13
- * Time: 5:06 PM
- */
-
-public class EmailNotifierConfiguration {
-    private String emailServer;
-    private int emailServerPort;
-    private String emailUserName;
-    private String emailPassword;
-    private boolean sslConnect;
-    private String fromAddress;
-
-    public EmailNotifierConfiguration(String emailServer, int emailServerPort, String emailUserName,
-                                      String emailPassword, boolean sslConnect, String fromAddress) {
-        this.emailServer = emailServer;
-        this.emailServerPort = emailServerPort;
-        this.emailUserName = emailUserName;
-        this.emailPassword = emailPassword;
-        this.sslConnect = sslConnect;
-        this.fromAddress = fromAddress;
-    }
-
-    public String getEmailServer() {
-        return emailServer;
-    }
-
-    public int getEmailServerPort() {
-        return emailServerPort;
-    }
-
-    public String getEmailUserName() {
-        return emailUserName;
-    }
-
-    public String getEmailPassword() {
-        return emailPassword;
-    }
-
-    public boolean isSslConnect() {
-        return sslConnect;
-    }
-
-    public String getFromAddress() {
-        return fromAddress;
-    }
-
-    public static EmailNotifierConfiguration getEmailNotifierConfigurations() throws ApplicationSettingsException {
-        return new EmailNotifierConfiguration(ApplicationSettings.getCredentialStoreEmailServer(),
-                Integer.parseInt(ApplicationSettings.getCredentialStoreEmailServerPort()),
-                ApplicationSettings.getCredentialStoreEmailUser(),
-                ApplicationSettings.getCredentialStoreEmailPassword(),
-                Boolean.parseBoolean(ApplicationSettings.getCredentialStoreEmailSSLConnect()),
-                ApplicationSettings.getCredentialStoreEmailFromEmail());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
deleted file mode 100644
index f0e14d5..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *
- * 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.server;
-
-
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.IServer;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credential.store.cpi.CredentialStoreService;
-import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TThreadPoolServer;
-import org.apache.thrift.transport.TSSLTransportFactory;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TTransportException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-
-public class CredentialStoreServer  implements IServer {
-    private final static Logger logger = LoggerFactory.getLogger(CredentialStoreServer.class);
-    private static final String SERVER_NAME = "Credential Store Server";
-    private static final String SERVER_VERSION = "1.0";
-
-    private IServer.ServerStatus status;
-    private TServer server;
-
-    public CredentialStoreServer() {
-        setStatus(IServer.ServerStatus.STOPPED);
-    }
-
-    @Override
-    public String getName() {
-        return SERVER_NAME;
-    }
-
-    @Override
-    public String getVersion() {
-        return SERVER_VERSION;
-    }
-
-    @Override
-    public void start() throws Exception {
-        if(ServerSettings.isCredentialStoreStartEnabled()) {
-            try {
-                setStatus(ServerStatus.STARTING);
-                TSSLTransportFactory.TSSLTransportParameters params =
-                        new TSSLTransportFactory.TSSLTransportParameters();
-                String keystorePath = ServerSettings.getCredentialStoreThriftServerKeyStorePath();
-                String keystorePWD = ServerSettings.getCredentialStoreThriftServerKeyStorePassword();
-                final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_PORT, "8960"));
-                final String serverHost = ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_HOST, null);
-                params.setKeyStore(keystorePath, keystorePWD);
-
-                TServerSocket serverTransport = TSSLTransportFactory.getServerSocket(serverPort, 100, InetAddress.getByName(serverHost), params);
-
-
-                CredentialStoreService.Processor processor = new CredentialStoreService.Processor(new CredentialStoreServerHandler());
-
-                server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).
-                        processor(processor));
-                new Thread() {
-                    public void run() {
-                        server.serve();
-                        setStatus(ServerStatus.STOPPED);
-                        logger.info("Credential Store Server Stopped.");
-                    }
-                }.start();
-                new Thread() {
-                    public void run() {
-                        while (!server.isServing()) {
-                            try {
-                                Thread.sleep(500);
-                            } catch (InterruptedException e) {
-                                break;
-                            }
-                        }
-                        if (server.isServing()) {
-                            setStatus(ServerStatus.STARTED);
-                            logger.info("Starting Credential Store Server on Port " + serverPort);
-                            logger.info("Listening to Credential Store Clients ....");
-                        }
-                    }
-                }.start();
-            } catch (TTransportException e) {
-                setStatus(ServerStatus.FAILED);
-                logger.error("Error while starting the credential store service", e);
-                throw new Exception("Error while starting the credential store service", e);
-            }
-        }
-    }
-
-    public static void main(String[] args) {
-        try {
-            new CredentialStoreServer().start();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    @Override
-    public void stop() throws Exception {
-        if (server!=null && server.isServing()){
-            setStatus(ServerStatus.STOPING);
-            server.stop();
-        }
-    }
-
-    @Override
-    public void restart() throws Exception {
-        stop();
-        start();
-    }
-
-    @Override
-    public void configure() throws Exception {
-
-    }
-
-    @Override
-    public ServerStatus getStatus() throws Exception {
-        return null;
-    }
-
-    private void setStatus(IServer.ServerStatus stat){
-        status=stat;
-        status.updateTime();
-    }
-
-    public TServer getServer() {
-        return server;
-    }
-
-    public void setServer(TServer server) {
-        this.server = server;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
deleted file mode 100644
index b5b1ac0..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- *
- * 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.server;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credential.store.cpi.CredentialStoreService;
-import org.apache.airavata.credential.store.cpi.cs_cpi_serviceConstants;
-import org.apache.airavata.credential.store.credential.CommunityUser;
-import org.apache.airavata.credential.store.credential.Credential;
-import org.apache.airavata.credential.store.datamodel.CertificateCredential;
-import org.apache.airavata.credential.store.datamodel.PasswordCredential;
-import org.apache.airavata.credential.store.datamodel.SSHCredential;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.apache.airavata.credential.store.store.impl.CertificateCredentialWriter;
-import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
-import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter;
-import org.apache.airavata.credential.store.util.TokenGenerator;
-import org.apache.airavata.credential.store.util.Utility;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.thrift.TException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import sun.security.provider.X509Factory;
-
-import java.io.ByteArrayInputStream;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.UUID;
-
-public class CredentialStoreServerHandler implements CredentialStoreService.Iface {
-    protected static Logger log = LoggerFactory.getLogger(CredentialStoreServerHandler.class);
-    private DBUtil dbUtil;
-    private SSHCredentialWriter sshCredentialWriter;
-    private CertificateCredentialWriter certificateCredentialWriter;
-    private CredentialReaderImpl credentialReader;
-
-    public CredentialStoreServerHandler() throws ApplicationSettingsException, IllegalAccessException, ClassNotFoundException, InstantiationException {
-        String jdbcUrl = ServerSettings.getCredentialStoreDBURL();
-        String userName = ServerSettings.getCredentialStoreDBUser();
-        String password = ServerSettings.getCredentialStoreDBPassword();
-        String driverName = ServerSettings.getCredentialStoreDBDriver();
-
-        log.debug("Starting credential store, connecting to database - " + jdbcUrl + " DB user - " + userName + " driver name - " + driverName);
-        dbUtil = new DBUtil(jdbcUrl, userName, password, driverName);
-        sshCredentialWriter = new SSHCredentialWriter(dbUtil);
-        certificateCredentialWriter = new CertificateCredentialWriter(dbUtil);
-        credentialReader = new CredentialReaderImpl(dbUtil);
-    }
-
-    @Override
-    public String getCSServiceVersion() throws TException {
-        return cs_cpi_serviceConstants.CS_CPI_VERSION;
-    }
-
-    @Override
-    public String addSSHCredential(SSHCredential sshCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
-        try {
-            org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential credential = new org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential();
-            credential.setGateway(sshCredential.getGatewayId());
-            credential.setPortalUserName(sshCredential.getUsername());
-            // only username and gateway id will be sent by client.
-            String token = TokenGenerator.generateToken(sshCredential.getGatewayId(), null);
-            credential.setToken(token);
-            credential.setPassphrase(String.valueOf(UUID.randomUUID()));
-            if (sshCredential.getPrivateKey() != null) {
-                credential.setPrivateKey(sshCredential.getPrivateKey().getBytes());
-            }
-            if (sshCredential.getPublicKey() != null) {
-                credential.setPublicKey(sshCredential.getPublicKey().getBytes());
-            }
-            if (sshCredential.getPublicKey() == null || sshCredential.getPrivateKey() == null) {
-                credential = Utility.generateKeyPair(credential);
-            }
-            sshCredentialWriter.writeCredentials(credential);
-            return token;
-        } catch (CredentialStoreException e) {
-            log.error("Error occurred while saving SSH Credentials.", e);
-            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while saving SSH Credentials.");
-        } catch (Exception e) {
-            log.error("Error occurred while generating key pair.", e);
-            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while generating key pair..");
-        }
-    }
-
-    @Override
-    public String addCertificateCredential(CertificateCredential certificateCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
-        try {
-            org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential credential = new org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential();
-            credential.setPortalUserName(certificateCredential.getCommunityUser().getUsername());
-            credential.setCommunityUser(new CommunityUser(certificateCredential.getCommunityUser().getGatewayNmae(),
-                    certificateCredential.getCommunityUser().getUsername(), certificateCredential.getCommunityUser().getUserEmail()));
-            String token = TokenGenerator.generateToken(certificateCredential.getCommunityUser().getGatewayNmae(), null);
-            credential.setToken(token);
-            Base64 encoder = new Base64(64);
-            byte [] decoded = encoder.decode(certificateCredential.getX509Cert().replaceAll(X509Factory.BEGIN_CERT, "").replaceAll(X509Factory.END_CERT, ""));
-            CertificateFactory cf = CertificateFactory.getInstance("X.509");
-            X509Certificate certificate = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(decoded));
-            X509Certificate[] certificates = new X509Certificate[1];
-            certificates[0] = certificate;
-            credential.setCertificates(certificates);
-            certificateCredentialWriter.writeCredentials(credential);
-            return token;
-        } catch (CredentialStoreException e) {
-            log.error("Error occurred while saving Certificate Credentials.", e);
-            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while saving Certificate Credentials.");
-        } catch (Exception e) {
-            log.error("Error occurred while converting to X509 certificate.", e);
-            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while converting to X509 certificate..");
-        }
-    }
-
-    @Override
-    public String addPasswordCredential(PasswordCredential passwordCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
-        return null;
-    }
-
-    @Override
-    public SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
-        try {
-            Credential credential = credentialReader.getCredential(gatewayId, tokenId);
-            if (credential instanceof org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) {
-                org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential credential1 = (org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) credential;
-                SSHCredential sshCredential = new SSHCredential();
-                sshCredential.setUsername(credential1.getPortalUserName());
-                sshCredential.setGatewayId(credential1.getGateway());
-                sshCredential.setPublicKey(new String(credential1.getPublicKey()));
-                sshCredential.setPrivateKey(new String(credential1.getPrivateKey()));
-                sshCredential.setPassphrase(credential1.getPassphrase());
-                sshCredential.setToken(credential1.getToken());
-                sshCredential.setPersistedTime(credential1.getCertificateRequestedTime().getTime());
-                return sshCredential;
-            } else {
-                log.info("Could not find SSH credentials for token - " + tokenId + " and "
-                        + "gateway id - " + gatewayId);
-                return null;
-            }
-        } catch (CredentialStoreException e) {
-            log.error("Error occurred while retrieving SSH credentialfor token - " +  tokenId + " and gateway id - " + gatewayId, e);
-            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while retrieving SSH credential for token - " +  tokenId + " and gateway id - " + gatewayId);
-        }
-    }
-
-    @Override
-    public CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
-        try {
-            Credential credential = credentialReader.getCredential(gatewayId, tokenId);
-            if (credential instanceof org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential) {
-                org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential credential1 = (org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential) credential;
-                CertificateCredential certificateCredential = new CertificateCredential();
-                org.apache.airavata.credential.store.datamodel.CommunityUser communityUser = new org.apache.airavata.credential.store.datamodel.CommunityUser();
-                communityUser.setGatewayNmae(credential1.getCommunityUser().getGatewayName());
-                communityUser.setUsername(credential1.getCommunityUser().getUserName());
-                communityUser.setUserEmail(credential1.getCommunityUser().getUserEmail());
-                certificateCredential.setCommunityUser(communityUser);
-                certificateCredential.setToken(credential1.getToken());
-                certificateCredential.setLifeTime(credential1.getLifeTime());
-                certificateCredential.setNotAfter(credential1.getNotAfter());
-                certificateCredential.setNotBefore(credential1.getNotBefore());
-                certificateCredential.setPersistedTime(credential1.getCertificateRequestedTime().getTime());
-                if (credential1.getPrivateKey() != null){
-                    certificateCredential.setPrivateKey(credential1.getPrivateKey().toString());
-                }
-                certificateCredential.setX509Cert(credential1.getCertificates()[0].toString());
-                return certificateCredential;
-            } else {
-                log.info("Could not find Certificate credentials for token - " + tokenId + " and "
-                        + "gateway id - " + gatewayId);
-                return null;
-            }
-        } catch (CredentialStoreException e) {
-            log.error("Error occurred while retrieving Certificate credential for token - " +  tokenId + " and gateway id - " + gatewayId, e);
-            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while retrieving Certificate credential for token - " +  tokenId + " and gateway id - " + gatewayId);
-        }
-    }
-
-    @Override
-    public PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
-        return null;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java
deleted file mode 100644
index b2e8786..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * 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.servlet;
-
-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;
-
-/**
- * Bootstrapper class for credential-store.
- */
-public class CredentialBootstrapper extends ClientBootstrapper {
-
-    protected static Logger log = LoggerFactory.getLogger(CredentialBootstrapper.class);
-
-    public ConfigurationLoader getConfigurationLoader(ServletContext servletContext) throws Exception {
-
-        File currentDirectory = new File(".");
-
-        log.info("Current directory is - " + currentDirectory.getAbsolutePath());
-
-        return super.getConfigurationLoader(servletContext);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
deleted file mode 100644
index 66d4be7..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- *
- * 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.servlet;
-
-import edu.uiuc.ncsa.myproxy.oa4mp.client.AssetResponse;
-import edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment;
-import edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPService;
-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 org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.ApplicationSettings;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.credential.store.credential.CommunityUser;
-import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
-import org.apache.airavata.credential.store.notifier.NotifierBootstrap;
-import org.apache.airavata.credential.store.notifier.impl.EmailNotifierConfiguration;
-import org.apache.airavata.credential.store.store.impl.CertificateCredentialWriter;
-import org.apache.airavata.credential.store.util.ConfigurationReader;
-import org.apache.airavata.credential.store.util.CredentialStoreConstants;
-import org.apache.airavata.credential.store.util.PrivateKeyStore;
-import org.apache.airavata.credential.store.util.Utility;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.security.PrivateKey;
-import java.security.cert.X509Certificate;
-import java.util.HashMap;
-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.
- */
-public class CredentialStoreCallbackServlet extends ClientServlet {
-
-    private OA4MPService oa4mpService;
-
-    private CertificateCredentialWriter certificateCredentialWriter;
-
-    private static ConfigurationReader configurationReader;
-
-    private NotifierBootstrap notifierBootstrap;
-
-    public void init() throws ServletException {
-
-        DBUtil dbUtil;
-
-        try {
-            AiravataUtils.setExecutionAsServer();
-            dbUtil = DBUtil.getCredentialStoreDBUtil();
-        } catch (Exception e) {
-            throw new ServletException("Error initializing database operations.", e);
-        }
-
-        try {
-            configurationReader = new ConfigurationReader();
-            super.init();
-            certificateCredentialWriter = new CertificateCredentialWriter(dbUtil);
-        } catch (Exception e) {
-            throw new ServletException("Error initializing configuration reader.", e);
-        }
-
-
-        // initialize notifier
-        try {
-            boolean enabled = Boolean.parseBoolean(ApplicationSettings.getCredentialStoreNotifierEnabled());
-
-            if (enabled) {
-                EmailNotifierConfiguration notifierConfiguration
-                        = EmailNotifierConfiguration.getEmailNotifierConfigurations();
-                long duration = Long.parseLong(ApplicationSettings.getCredentialStoreNotifierDuration());
-
-                notifierBootstrap = new NotifierBootstrap(duration, dbUtil, notifierConfiguration);
-            }
-
-        } catch (ApplicationSettingsException e) {
-            throw new ServletException("Error initializing notifier.", e);
-        }
-
-
-        info("Credential store callback initialized successfully.");
-    }
-
-    @Override
-    public OA4MPService getOA4MPService() {
-        return oa4mpService;
-    }
-
-    @Override
-    public void loadEnvironment() throws IOException {
-        environment = getConfigurationLoader().load();
-        oa4mpService = new OA4MPService((ClientEnvironment) environment);
-    }
-
-    @Override
-    protected void doIt(HttpServletRequest request, HttpServletResponse response) throws Throwable {
-
-        String gatewayName = request.getParameter(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER);
-        String portalUserName = request.getParameter(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER);
-        String durationParameter = request.getParameter(CredentialStoreConstants.DURATION_QUERY_PARAMETER);
-        String contactEmail = request.getParameter(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER);
-        String portalTokenId = request.getParameter(CredentialStoreConstants.PORTAL_TOKEN_ID_ASSIGNED);
-
-        // TODO remove hard coded values, once passing query parameters is
-        // fixed in OA4MP client api
-        long duration = 864000;
-
-        if (durationParameter != null) {
-            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, configurationReader.getErrorUrl());
-            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(CONST(ClientEnvironment.TOKEN));
-        String verifier = request.getParameter(CONST(ClientEnvironment.VERIFIER));
-        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.");
-            request.setAttribute("exception", ge);
-            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
-            return;
-        }
-        info("2.a Token and verifier found.");
-        X509Certificate[] certificates;
-        AssetResponse assetResponse = null;
-
-        PrivateKey privateKey;
-
-        try {
-
-            PrivateKeyStore privateKeyStore = PrivateKeyStore.getPrivateKeyStore();
-            privateKey = privateKeyStore.getKey(portalTokenId);
-
-            if (privateKey != null) {
-                info("Found private key for token " + portalTokenId);
-            } else {
-                info("Could not find private key for token " + portalTokenId);
-            }
-
-            info("2.a. Getting the cert(s) from the service");
-            assetResponse = getOA4MPService().getCert(token, verifier);
-
-            certificates = assetResponse.getX509Certificates();
-
-        } catch (Throwable t) {
-            warn("2.a. Exception from the server: " + t.getCause().getMessage());
-            error("Exception while trying to get cert. message:" + t.getMessage());
-            request.setAttribute("exception", t);
-            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
-            return;
-        }
-
-        info("2.b. Done! Displaying success page.");
-
-        CertificateCredential certificateCredential = new CertificateCredential();
-
-        certificateCredential.setNotBefore(Utility.convertDateToString(certificates[0].getNotBefore())); //TODO check this is correct
-        certificateCredential.setNotAfter(Utility.convertDateToString(certificates[0].getNotAfter()));
-        certificateCredential.setCertificates(certificates);
-        certificateCredential.setPrivateKey(privateKey);
-        certificateCredential
-                .setCommunityUser(new CommunityUser(gatewayName, assetResponse.getUsername(), contactEmail));
-        certificateCredential.setPortalUserName(portalUserName);
-        certificateCredential.setLifeTime(duration);
-        certificateCredential.setToken(portalTokenId);
-
-
-        certificateCredentialWriter.writeCredentials(certificateCredential);
-
-        StringBuilder stringBuilder = new StringBuilder("Certificate for community user ");
-        stringBuilder.append(assetResponse.getUsername()).append(" successfully persisted.");
-        stringBuilder.append(" Certificate DN - ").append(certificates[0].getSubjectDN());
-
-        info(stringBuilder.toString());
-
-        if (isUrlInSameServer(configurationReader.getSuccessUrl())) {
-
-            String contextPath = request.getContextPath();
-            if (!contextPath.endsWith("/")) {
-                contextPath = contextPath + "/";
-            }
-            request.setAttribute("action", contextPath);
-            request.setAttribute("tokenId", portalTokenId);
-            JSPUtil.fwd(request, response, configurationReader.getSuccessUrl());
-        } else {
-
-            String urlToRedirect = decorateUrlWithToken(configurationReader.getSuccessUrl(), portalTokenId);
-
-            info("Redirecting to url - " + urlToRedirect);
-
-            response.sendRedirect(urlToRedirect);
-        }
-
-        info("2.a. Completely finished with delegation.");
-
-    }
-
-    private boolean isUrlInSameServer(String url) {
-
-        return !(url.toLowerCase().startsWith("http") || url.toLowerCase().startsWith("https"));
-
-    }
-
-    private String decorateUrlWithToken(String url, String tokenId) {
-
-        StringBuilder stringBuilder = new StringBuilder(url);
-        stringBuilder.append("?tokenId=").append(tokenId);
-        return stringBuilder.toString();
-    }
-
-    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();
-
-        String callbackUri = clientEnvironment.getCallback().toString();
-
-        StringBuilder stringBuilder = new StringBuilder(callbackUri);
-
-        stringBuilder.append("?").append(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER).append("=").append(gatewayName).append("&")
-                .append(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER).append("=").append(portalUserName).append("&")
-                .append(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER).append("=").append(portalEmail).append("&")
-                .append(CredentialStoreConstants.PORTAL_TOKEN_ID_ASSIGNED).append("=").append(tokenId);
-
-        info("Callback URI is set to - " + stringBuilder.toString());
-
-        Map<String, String> parameters = new HashMap<String, String>();
-        parameters.put(callbackUriKey, stringBuilder.toString());
-
-        return parameters;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java
deleted file mode 100644
index 3b70242..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *
- * 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.servlet;
-
-import edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment;
-import edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPResponse;
-import edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPService;
-import edu.uiuc.ncsa.myproxy.oa4mp.client.servlet.ClientServlet;
-import edu.uiuc.ncsa.security.servlet.JSPUtil;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.apache.airavata.credential.store.util.ConfigurationReader;
-import org.apache.airavata.credential.store.util.CredentialStoreConstants;
-import org.apache.airavata.credential.store.util.PrivateKeyStore;
-import org.apache.airavata.credential.store.util.TokenGenerator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import static edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment.CALLBACK_URI_KEY;
-
-/**
- * When portal initiate a request to get credentials it will hit this servlet.
- */
-public class CredentialStoreStartServlet extends ClientServlet {
-
-    private static ConfigurationReader configurationReader = null;
-
-    private static Logger log = LoggerFactory.getLogger(CredentialStoreStartServlet.class);
-    private OA4MPService oa4mpService;
-
-    protected String decorateURI(URI inputURI, Map<String, String> parameters) {
-
-        if (parameters.isEmpty()) {
-            return inputURI.toString();
-        }
-
-        String stringUri = inputURI.toString();
-        StringBuilder stringBuilder = new StringBuilder(stringUri);
-
-        boolean isFirst = true;
-
-        for (Map.Entry<String, String> entry : parameters.entrySet()) {
-            if (isFirst) {
-                stringBuilder.append("?");
-                isFirst = false;
-            } else {
-                stringBuilder.append("&");
-            }
-
-            stringBuilder.append(entry.getKey()).append("=").append(entry.getValue());
-        }
-
-        return stringBuilder.toString();
-
-    }
-
-    public void init() throws ServletException {
-
-        super.init();
-
-        try {
-            if (configurationReader == null) {
-                configurationReader = new ConfigurationReader();
-            }
-        } catch (CredentialStoreException e) {
-            throw new ServletException(e);
-        }
-
-    }
-
-    @Override
-    public OA4MPService getOA4MPService() {
-        return oa4mpService;
-    }
-
-    @Override
-    public void loadEnvironment() throws IOException {
-        environment = getConfigurationLoader().load();
-        oa4mpService = new OA4MPService((ClientEnvironment) environment);
-    }
-
-    @Override
-    protected void doIt(HttpServletRequest request, HttpServletResponse response) throws Throwable {
-
-        String gatewayName
-                = request.getParameter(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER);
-        String portalUserName
-                = request.getParameter(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER);
-        String contactEmail
-                = request.getParameter(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER);
-        String associatedToken = TokenGenerator.generateToken(gatewayName, portalUserName);
-
-        if (gatewayName == null) {
-            JSPUtil.handleException(new RuntimeException("Please specify a gateway name."), request, response,
-                    configurationReader.getErrorUrl());
-            return;
-        }
-
-        if (portalUserName == null) {
-            JSPUtil.handleException(new RuntimeException("Please specify a portal user name."), request, response,
-                    configurationReader.getErrorUrl());
-            return;
-        }
-
-        if (contactEmail == null) {
-            JSPUtil.handleException(new RuntimeException("Please specify a contact email address for community"
-                    + " user account."), request, response, configurationReader.getErrorUrl());
-            return;
-        }
-
-        log.info("1.a. Starting transaction");
-        OA4MPResponse gtwResp;
-
-        Map<String, String> queryParameters = new HashMap<String, String>();
-        queryParameters.put(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER, gatewayName);
-        queryParameters.put(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER, portalUserName);
-        queryParameters.put(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER, contactEmail);
-        queryParameters.put(CredentialStoreConstants.PORTAL_TOKEN_ID_ASSIGNED, associatedToken);
-
-        Map<String, String> additionalParameters = new HashMap<String, String>();
-
-        if (getOA4MPService() == null) {
-            loadEnvironment();
-        }
-
-        String modifiedCallbackUri = decorateURI(getOA4MPService().getEnvironment().getCallback(), queryParameters);
-
-        info("The modified callback URI - " + modifiedCallbackUri);
-
-        additionalParameters.put(getEnvironment().getConstants().get(CALLBACK_URI_KEY), modifiedCallbackUri);
-
-        try {
-            gtwResp = getOA4MPService().requestCert(additionalParameters);
-
-            // Private key in store
-            PrivateKeyStore privateKeyStore = PrivateKeyStore.getPrivateKeyStore();
-            privateKeyStore.addKey(associatedToken, gtwResp.getPrivateKey());
-
-        } catch (Throwable t) {
-            JSPUtil.handleException(t, request, response, configurationReader.getErrorUrl());
-            return;
-        }
-        log.info("1.b. Got response. Creating page with redirect for " + gtwResp.getRedirect().getHost());
-        // Normally, we'd just do a redirect, but we will put up a page and show the redirect to the user.
-        // The client response contains the generated private key as well
-        // In a real application, the private key would be stored. This, however, exceeds the scope of this
-        // sample application -- all we need to do to complete the process is send along the redirect url.
-
-        request.setAttribute(REDIR, REDIR);
-        request.setAttribute("redirectUrl", gtwResp.getRedirect().toString());
-        request.setAttribute(ACTION_KEY, ACTION_KEY);
-        request.setAttribute("action", ACTION_REDIRECT_VALUE);
-        log.info("1.b. Showing redirect page.");
-        JSPUtil.fwd(request, response, configurationReader.getPortalRedirectUrl());
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
deleted file mode 100644
index fe54b8e..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * 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;
-
-import java.util.List;
-
-/**
- * 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
-     * @return The Credential object associated with the token.
-     * @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.
-     * @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.
-     * @return CertificateAuditInfo object.
-     */
-    AuditInfo getAuditInfo(String gatewayName, String tokenId) throws CredentialStoreException;
-
-    /**
-     * Gets all the credential records.
-     * @return All credential records as a list
-     * @throws CredentialStoreException If an error occurred while retrieving credentials.
-     */
-    public List<Credential> getAllCredentials() throws CredentialStoreException;
-
-    /**
-     * Updates the community user contact email address.
-     *
-     * @param gatewayName
-     *            The gateway name.
-     * @param communityUser
-     *            The community user name.
-     * @param email
-     *            The new email address.
-     */
-    void updateCommunityUserEmail(String gatewayName, String communityUser, String email)
-            throws CredentialStoreException;
-
-    /**
-     * Will remove credentials for the given gateway id and community user.
-     * 
-     * @param gatewayName
-     *            The gateway Id
-     * @param tokenId
-     *            The issued token id.
-     * @throws CredentialStoreException
-     *             If an error occurred while retrieving data.
-     */
-    void removeCredentials(String gatewayName, String tokenId) throws CredentialStoreException;
-    
-    /**
-     * Retrieves gatewayID from the credential store.
-     * 
-     * @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.
-     */
-    String getGatewayID(String tokenId) throws CredentialStoreException;
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java
deleted file mode 100644
index f4b5e21..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * 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.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
-
-/**
- * Factory class to create credential store readers.
- */
-public class CredentialReaderFactory {
-
-    /**
-     * Creates a credential reader using supplied database configurations.
-     * @param dbUti The database configurations.
-     * @return CredentialReader object.
-     */
-    public static CredentialReader createCredentialStoreReader(DBUtil dbUti) throws ApplicationSettingsException {
-        return new CredentialReaderImpl(dbUti);
-    }
-
-    /**
-     * Creates credential reader using default configurations for credential store database.
-     * @return The credential reader.
-     * @throws ClassNotFoundException If an error occurred while instantiating jdbc driver
-     * @throws ApplicationSettingsException If an error occurred while reading database configurations.
-     * @throws InstantiationException If an error occurred while instantiating jdbc driver
-     * @throws IllegalAccessException A security exception accessing jdbc driver.
-     */
-    public static CredentialReader createCredentialStoreReader() throws ClassNotFoundException,
-            ApplicationSettingsException, InstantiationException, IllegalAccessException {
-        return new CredentialReaderImpl(DBUtil.getCredentialStoreDBUtil());
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java
deleted file mode 100644
index 07bed10..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * 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;
-
-/**
- * An exception class for credential store.
- */
-public class CredentialStoreException extends Exception {
-
-    public CredentialStoreException() {
-        super();
-    }
-
-    public CredentialStoreException(String s) {
-        super(s);
-    }
-
-    public CredentialStoreException(String s, Throwable throwable) {
-        super(s, throwable);
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java
deleted file mode 100644
index 05ae9fe..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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;
-
-/**
- * The entity who's writing credentials to DB will use this interface.
- */
-public interface CredentialWriter {
-
-    /**
-     * Writes given credentials to a persistent storage.
-     * 
-     * @param credential
-     *            The credentials implementation.
-     */
-    void writeCredentials(Credential credential) throws CredentialStoreException;
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java
deleted file mode 100644
index 8b96187..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * 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.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ApplicationSettings;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.DefaultKeyStorePasswordCallback;
-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 org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-/**
- * Writes certificate credentials to database.
- */
-public class CertificateCredentialWriter implements CredentialWriter {
-
-    private CredentialsDAO credentialsDAO;
-    private CommunityUserDAO communityUserDAO;
-
-    protected static Logger log = LoggerFactory.getLogger(CertificateCredentialWriter.class);
-
-    private DBUtil dbUtil;
-
-    public CertificateCredentialWriter(DBUtil dbUtil) throws ApplicationSettingsException {
-
-        this.dbUtil = dbUtil;
-
-        this.credentialsDAO = new CredentialsDAO(ApplicationSettings.getCredentialStoreKeyStorePath(),
-                ApplicationSettings.getCredentialStoreKeyAlias(), new DefaultKeyStorePasswordCallback());
-
-        communityUserDAO = new CommunityUserDAO();
-    }
-
-    public void writeCredentials(Credential credential) throws CredentialStoreException {
-
-        CertificateCredential certificateCredential = (CertificateCredential) credential;
-
-        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);
-
-            if (!connection.getAutoCommit()) {
-                connection.commit();
-            }
-
-        } catch (SQLException e) {
-            if (connection != null) {
-                try {
-                    connection.rollback();
-                } catch (SQLException e1) {
-                    log.error("Unable to rollback transaction", e1);
-                }
-            }
-            throw new CredentialStoreException("Unable to retrieve database connection.", e);
-        } finally {
-            DBUtil.cleanup(connection);
-        }
-
-    }
-
-    public void writeCommunityUser(CommunityUser communityUser, String token, Connection connection)
-            throws CredentialStoreException {
-
-        // First delete existing community user
-        communityUserDAO.deleteCommunityUserByToken(communityUser, token, connection);
-
-        // Persist new community user
-        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); } }
-     */
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
deleted file mode 100644
index dc2fd60..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- *
- * 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.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ApplicationSettings;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.DefaultKeyStorePasswordCallback;
-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;
-import java.util.List;
-
-/**
- * Credential store API implementation.
- */
-public class CredentialReaderImpl implements CredentialReader, Serializable {
-
-    private CredentialsDAO credentialsDAO;
-
-    private DBUtil dbUtil;
-
-    public CredentialReaderImpl(DBUtil dbUtil) throws ApplicationSettingsException {
-
-        this.credentialsDAO = new CredentialsDAO(ApplicationSettings.getCredentialStoreKeyStorePath(),
-                ApplicationSettings.getCredentialStoreKeyAlias(), new DefaultKeyStorePasswordCallback());
-
-        this.dbUtil = dbUtil;
-    }
-
-    private Connection getConnection() throws CredentialStoreException {
-        try {
-            return this.dbUtil.getConnection();
-        } catch (SQLException e) {
-            throw new CredentialStoreException("Unable to retrieve database connection.", e);
-        }
-    }
-
-    @Override
-    public Credential getCredential(String gatewayId, String tokenId) throws CredentialStoreException {
-
-        Connection connection = getConnection();
-
-        try {
-            return this.credentialsDAO.getCredential(gatewayId, tokenId, connection);
-        } finally {
-            DBUtil.cleanup(connection);
-        }
-    }
-
-    public List<Credential> getAllCredentials() throws CredentialStoreException {
-
-        Connection connection = getConnection();
-
-        try {
-            return this.credentialsDAO.getCredentials(connection);
-        } finally {
-            DBUtil.cleanup(connection);
-        }
-
-    }
-
-    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();
-    }
-
-    public CertificateAuditInfo getAuditInfo(String gatewayName, String tokenId) throws CredentialStoreException {
-
-        Connection connection = getConnection();
-
-        CertificateAuditInfo certificateAuditInfo;
-
-        try {
-
-            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;
-    }
-
-    public void updateCommunityUserEmail(String gatewayName, String communityUser, String email)
-            throws CredentialStoreException {
-        // TODO
-    }
-
-    public void removeCredentials(String gatewayName, String tokenId) throws CredentialStoreException {
-
-        Connection connection = getConnection();
-
-        try {
-            credentialsDAO.deleteCredentials(gatewayName, tokenId, connection);
-        } finally {
-            DBUtil.cleanup(connection);
-        }
-
-    }
-
-	@Override
-	public String getGatewayID(String tokenId) throws CredentialStoreException {
-		 Connection connection = getConnection();
-	        try {
-	            return this.credentialsDAO.getGatewayID(tokenId, connection);
-	        } finally {
-	            DBUtil.cleanup(connection);
-	        }
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/SSHCredentialWriter.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/SSHCredentialWriter.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/SSHCredentialWriter.java
deleted file mode 100644
index ad4f6b3..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/SSHCredentialWriter.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * 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 java.sql.Connection;
-import java.sql.SQLException;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ApplicationSettings;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.DefaultKeyStorePasswordCallback;
-import org.apache.airavata.credential.store.credential.Credential;
-import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.apache.airavata.credential.store.store.CredentialWriter;
-import org.apache.airavata.credential.store.store.impl.db.CredentialsDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writes SSH credentials to database.
- */
-public class SSHCredentialWriter implements CredentialWriter {
-
-    private CredentialsDAO credentialsDAO;
-    private DBUtil dbUtil;
-    
-    protected static Logger logger = LoggerFactory.getLogger(SSHCredentialWriter.class);
-
-    public SSHCredentialWriter(DBUtil dbUtil) throws ApplicationSettingsException {
-        this.dbUtil = dbUtil;
-        this.credentialsDAO = new CredentialsDAO(ApplicationSettings.getCredentialStoreKeyStorePath(),
-                ApplicationSettings.getCredentialStoreKeyAlias(), new DefaultKeyStorePasswordCallback());
-
-    }
-
-    public void writeCredentials(Credential credential) throws CredentialStoreException {
-
-        SSHCredential sshCredential = (SSHCredential) credential;
-        Connection connection = null;
-
-        try {
-            connection = dbUtil.getConnection();
-            // First delete existing credentials
-            credentialsDAO.deleteCredentials(sshCredential.getGateway(), sshCredential.getToken(), connection);
-            // Add the new certificate
-            credentialsDAO.addCredentials(sshCredential.getGateway(), credential, connection);
-
-            if (!connection.getAutoCommit()) {
-                connection.commit();
-            }
-
-        } catch (SQLException e) {
-            if (connection != null) {
-                try {
-                    connection.rollback();
-                } catch (SQLException e1) {
-                    logger.error("Unable to rollback transaction", e1);
-                }
-            }
-            throw new CredentialStoreException("Unable to retrieve database connection.", e);
-        } finally {
-            DBUtil.cleanup(connection);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java
deleted file mode 100644
index f55cd55..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- *
- * 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;
-import org.apache.airavata.credential.store.credential.CommunityUser;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Data access class for community_user table.
- */
-public class CommunityUserDAO extends ParentDAO {
-
-    public CommunityUserDAO() {
-        super();
-    }
-
-    public void addCommunityUser(CommunityUser user, String token, Connection connection)
-            throws CredentialStoreException {
-
-        String sql = "INSERT INTO COMMUNITY_USER VALUES (?, ?, ?, ?)";
-
-        PreparedStatement preparedStatement = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, user.getGatewayName());
-            preparedStatement.setString(2, user.getUserName());
-            preparedStatement.setString(3, token);
-            preparedStatement.setString(4, user.getUserEmail());
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error persisting community user.");
-            stringBuilder.append("gateway - ").append(user.getGatewayName());
-            stringBuilder.append("community user name - ").append(user.getUserName());
-            stringBuilder.append("community user email - ").append(user.getUserEmail());
-            stringBuilder.append("token id - ").append(token);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-
-            DBUtil.cleanup(preparedStatement);
-        }
-    }
-
-    public void deleteCommunityUser(CommunityUser user, Connection connection) throws CredentialStoreException {
-
-        String sql = "DELETE FROM COMMUNITY_USER WHERE GATEWAY_NAME=? AND COMMUNITY_USER_NAME=?";
-
-        PreparedStatement preparedStatement = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, user.getGatewayName());
-            preparedStatement.setString(2, user.getUserName());
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error deleting community user.");
-            stringBuilder.append("gateway - ").append(user.getGatewayName());
-            stringBuilder.append("community user name - ").append(user.getUserName());
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-            DBUtil.cleanup(preparedStatement);
-        }
-    }
-
-    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);
-        }
-    }
-
-    public void updateCommunityUser(CommunityUser user) throws CredentialStoreException {
-
-        // TODO
-    }
-
-    public CommunityUser getCommunityUser(String gatewayName, String communityUserName, Connection connection)
-            throws CredentialStoreException {
-
-        String sql = "SELECT * FROM COMMUNITY_USER WHERE GATEWAY_NAME=? AND COMMUNITY_USER_NAME=?";
-
-        PreparedStatement preparedStatement = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, gatewayName);
-            preparedStatement.setString(2, communityUserName);
-
-            ResultSet resultSet = preparedStatement.executeQuery();
-
-            if (resultSet.next()) {
-                String email = resultSet.getString("COMMUNITY_USER_EMAIL"); // TODO fix typo
-
-                return new CommunityUser(gatewayName, communityUserName, email);
-
-            }
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error retrieving community user.");
-            stringBuilder.append("gateway - ").append(gatewayName);
-            stringBuilder.append("community user name - ").append(communityUserName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-            DBUtil.cleanup(preparedStatement);
-        }
-
-        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, Connection connection)
-            throws CredentialStoreException {
-
-        List<CommunityUser> userList = new ArrayList<CommunityUser>();
-
-        String sql = "SELECT * FROM COMMUNITY_USER WHERE GATEWAY_NAME=?";
-
-        PreparedStatement preparedStatement = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, gatewayName);
-
-            ResultSet resultSet = preparedStatement.executeQuery();
-
-            while (resultSet.next()) {
-                String userName = resultSet.getString("COMMUNITY_USER_NAME");
-                String email = resultSet.getString("COMMUNITY_USER_EMAIL"); // TODO fix typo
-
-                userList.add(new CommunityUser(gatewayName, userName, email));
-
-            }
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error retrieving community users for ");
-            stringBuilder.append("gateway - ").append(gatewayName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-            DBUtil.cleanup(preparedStatement);
-        }
-
-        return userList;
-    }
-
-}


[08/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/cpi/cs_cpi_serviceConstants.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/cpi/cs_cpi_serviceConstants.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/cpi/cs_cpi_serviceConstants.java
new file mode 100644
index 0000000..2b8858e
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/cpi/cs_cpi_serviceConstants.java
@@ -0,0 +1,55 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.cpi;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class cs_cpi_serviceConstants {
+
+  public static final String CS_CPI_VERSION = "0.15.0";
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java
new file mode 100644
index 0000000..93b4e94
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java
@@ -0,0 +1,53 @@
+/*
+ *
+ * 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;
+import java.util.Date;
+
+/**
+ * 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();
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java
new file mode 100644
index 0000000..2856f36
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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;
+
+/**
+ * Represents the community user.
+ */
+public class CommunityUser implements Serializable {
+
+    static final long serialVersionUID = 5783370135149452010L;
+
+    private String gatewayName;
+    private String userName;
+    private String userEmail;
+
+    public String getGatewayName() {
+        return gatewayName;
+    }
+
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
+    }
+
+    public String getUserEmail() {
+        return userEmail;
+    }
+
+    public void setUserEmail(String userEmail) {
+        this.userEmail = userEmail;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public CommunityUser(String gatewayName, String userName, String userEmail) {
+        this.gatewayName = gatewayName;
+        this.userName = userName;
+        this.userEmail = userEmail;
+    }
+
+    public CommunityUser(String gatewayName, String userName) {
+        this.gatewayName = gatewayName;
+        this.userName = userName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
new file mode 100644
index 0000000..4f04123
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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;
+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 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;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java
new file mode 100644
index 0000000..17ddb3f
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java
@@ -0,0 +1,101 @@
+/*
+ *
+ * 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;
+import org.apache.airavata.credential.store.credential.CommunityUser;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Date;
+
+/**
+ * Audit information related to community credential.
+ */
+@XmlRootElement
+public class CertificateAuditInfo implements AuditInfo {
+
+    private static final long serialVersionUID = 13213123L;
+
+    private String gatewayName;
+    private String communityUserName;
+    private String portalUserName;
+    private Date credentialsRequestedTime;
+    private String notBefore;
+    private String notAfter;
+    private long credentialLifeTime;
+
+    public String getGatewayName() {
+        return gatewayName;
+    }
+
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
+    }
+
+    public void setCommunityUserName(String communityUserName) {
+        this.communityUserName = communityUserName;
+    }
+
+    public void setPortalUserName(String portalUserName) {
+        this.portalUserName = portalUserName;
+    }
+
+    public void setCredentialsRequestedTime(Date credentialsRequestedTime) {
+        this.credentialsRequestedTime = credentialsRequestedTime;
+    }
+
+    public String getNotBefore() {
+        return notBefore;
+    }
+
+    public void setNotBefore(String notBefore) {
+        this.notBefore = notBefore;
+    }
+
+    public String getNotAfter() {
+        return notAfter;
+    }
+
+    public void setNotAfter(String notAfter) {
+        this.notAfter = notAfter;
+    }
+
+    public long getCredentialLifeTime() {
+        return credentialLifeTime;
+    }
+
+    public void setCredentialLifeTime(long credentialLifeTime) {
+        this.credentialLifeTime = credentialLifeTime;
+    }
+
+    public CommunityUser getCommunityUser() {
+        return new CommunityUser(gatewayName, communityUserName);
+    }
+
+    public String getPortalUserId() {
+        return portalUserName;
+    }
+
+    public Date getTimePersisted() {
+        return credentialsRequestedTime;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java
new file mode 100644
index 0000000..16c3351
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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 java.security.cert.X509Certificate;
+
+/**
+ * Represents the certificate credentials.
+ */
+public class CertificateCredential extends Credential {
+
+    static final long serialVersionUID = 6603675553790734432L;
+
+    /**
+     * The community user associated with this credentials.
+     */
+    private CommunityUser communityUser;
+
+    private String notAfter;
+
+    private X509Certificate[] certificates;
+
+    private PrivateKey privateKey;
+
+    private long lifeTime;
+
+    private String notBefore;
+
+    public CertificateCredential() {
+    }
+
+    public String getNotBefore() {
+        return notBefore;
+    }
+
+    public void setNotBefore(String notBefore) {
+        this.notBefore = notBefore;
+    }
+
+    public String getNotAfter() {
+        return notAfter;
+    }
+
+    public void setNotAfter(String notAfter) {
+        this.notAfter = notAfter;
+    }
+
+    public PrivateKey getPrivateKey() {
+        return privateKey;
+    }
+
+    public void setPrivateKey(PrivateKey privateKey) {
+        this.privateKey = privateKey;
+    }
+
+    public X509Certificate[] getCertificates() {
+        return certificates;
+    }
+
+    public void setCertificates(X509Certificate[] certificate) {
+        this.certificates = certificate;
+    }
+
+    public long getLifeTime() {
+        return lifeTime;
+    }
+
+    public void setLifeTime(long lifeTime) {
+        this.lifeTime = lifeTime;
+    }
+
+    public CommunityUser getCommunityUser() {
+        return communityUser;
+    }
+
+    public void setCommunityUser(CommunityUser communityUser) {
+        this.communityUser = communityUser;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java
new file mode 100644
index 0000000..a31c98b
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java
@@ -0,0 +1,53 @@
+/*
+ *
+ * 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 org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
+
+import java.util.Date;
+
+/**
+ * User name password credentials.
+ */
+public class PasswordCredential extends SSHCredential {
+
+    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;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java
new file mode 100644
index 0000000..d41af21
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java
@@ -0,0 +1,88 @@
+/*
+ *
+ * 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.ssh;
+
+import org.apache.airavata.credential.store.credential.Credential;
+import java.io.Serializable;
+
+/**
+ * An SSH Credential class which is an extension of Airavata Credential 
+ */
+public class SSHCredential extends Credential implements Serializable {
+
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1277154647420198981L;
+	
+	private byte[] privatekey;
+    private byte[] publicKey;
+    private String passphrase;
+    private String gateway;
+    private String username;
+
+
+    public SSHCredential() {
+    }
+
+    public SSHCredential(byte[] privatekey, byte[] publicKey, String passphrase, String gateway,String username) {
+        this.privatekey = privatekey;
+        this.publicKey = publicKey;
+        this.passphrase = passphrase;
+        this.gateway = gateway;
+        this.username = username;
+        this.setPortalUserName(username);
+    }
+
+    public byte[] getPrivateKey() {
+        return privatekey;
+    }
+
+    public void setPrivateKey(byte[] privatekey) {
+        this.privatekey = privatekey;
+    }
+
+    public byte[] getPublicKey() {
+        return publicKey;
+    }
+
+    public void setPublicKey(byte[] pubKey) {
+        this.publicKey = pubKey;
+    }
+
+    public String getPassphrase() {
+        return passphrase;
+    }
+
+    public void setPassphrase(String passphrase) {
+        this.passphrase = passphrase;
+    }
+
+	public String getGateway() {
+		return gateway;
+	}
+
+	public void setGateway(String gateway) {
+		this.gateway = gateway;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java
new file mode 100644
index 0000000..ac1f0df
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java
@@ -0,0 +1,103 @@
+/*
+ *
+ * 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.ssh;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.RandomStringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.KeyPair;
+
+/**
+ * A class which generates an SSH credential
+ */
+public class SSHCredentialGenerator {
+	
+	private static Logger logger = LoggerFactory.getLogger(SSHCredentialWriter.class);
+	
+	/**
+	 * 
+	 * @return a SSH Credential generated and encrypted using a randomly generated password
+	 * @throws CredentialStoreException 
+	 */
+	public SSHCredential generateCredential(String tokenId) throws CredentialStoreException {
+        JSch jsch=new JSch();
+        try {
+            KeyPair kpair=KeyPair.genKeyPair(jsch, KeyPair.RSA);
+            File file;
+			
+				file = File.createTempFile("id_rsa", "");
+			
+            String fileName = file.getAbsolutePath();
+
+            String password = generateRandomString();
+            // We are encrypting the private key with the hash of (tokenId+password). 
+            // Any client which wants to use this private key will also generate a hash and then use it to decrypt the key.  
+            kpair.writePrivateKey(fileName,password.getBytes());
+            kpair.writePublicKey(fileName + ".pub"  , "");
+            kpair.dispose();
+            byte[] priKey = FileUtils.readFileToByteArray(new File(fileName));
+            byte[] pubKey = FileUtils.readFileToByteArray(new File(fileName + ".pub"));
+            SSHCredential sshCredential = new SSHCredential();
+            sshCredential.setPrivateKey(priKey);
+            sshCredential.setPublicKey(pubKey);
+            sshCredential.setPassphrase(password);
+            return sshCredential;
+		} catch (IOException e) {
+			logger.error("IO Exception when creating SSH credential ",e);
+			throw new CredentialStoreException("Unable to generate SSH Credential", e);
+		} catch (JSchException e) {
+			logger.error("JSch SSH credential creation exception ",e);
+			throw new CredentialStoreException("Unable to generate SSH Credential. JSch exception ", e);
+		}
+	}
+	
+	private String generateHash(String tokenId, String password) {
+        byte[] bytesOfMessage = new byte[0];
+        try {
+            bytesOfMessage = password.getBytes("UTF-8");
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            return new String( md.digest(bytesOfMessage));
+        } catch (UnsupportedEncodingException e) {
+            logger.error(e.getMessage(), e);
+        } catch (NoSuchAlgorithmException e) {
+            logger.error(e.getMessage(), e);
+        }
+        return  null;
+    }
+
+	// Generate a random alphanumberic string of 16 characters length
+	private String generateRandomString() {
+		return RandomStringUtils.randomAlphanumeric(16);
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
new file mode 100644
index 0000000..ae37b1d
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
@@ -0,0 +1,1104 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class CertificateCredential implements org.apache.thrift.TBase<CertificateCredential, CertificateCredential._Fields>, java.io.Serializable, Cloneable, Comparable<CertificateCredential> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CertificateCredential");
+
+  private static final org.apache.thrift.protocol.TField COMMUNITY_USER_FIELD_DESC = new org.apache.thrift.protocol.TField("communityUser", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+  private static final org.apache.thrift.protocol.TField X509_CERT_FIELD_DESC = new org.apache.thrift.protocol.TField("x509Cert", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField NOT_AFTER_FIELD_DESC = new org.apache.thrift.protocol.TField("notAfter", org.apache.thrift.protocol.TType.STRING, (short)3);
+  private static final org.apache.thrift.protocol.TField PRIVATE_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("privateKey", org.apache.thrift.protocol.TType.STRING, (short)4);
+  private static final org.apache.thrift.protocol.TField LIFE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lifeTime", org.apache.thrift.protocol.TType.I64, (short)5);
+  private static final org.apache.thrift.protocol.TField NOT_BEFORE_FIELD_DESC = new org.apache.thrift.protocol.TField("notBefore", org.apache.thrift.protocol.TType.STRING, (short)6);
+  private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)7);
+  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)8);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CertificateCredentialStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CertificateCredentialTupleSchemeFactory());
+  }
+
+  public CommunityUser communityUser; // required
+  public String x509Cert; // required
+  public String notAfter; // optional
+  public String privateKey; // optional
+  public long lifeTime; // optional
+  public String notBefore; // optional
+  public long persistedTime; // optional
+  public String token; // optional
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    COMMUNITY_USER((short)1, "communityUser"),
+    X509_CERT((short)2, "x509Cert"),
+    NOT_AFTER((short)3, "notAfter"),
+    PRIVATE_KEY((short)4, "privateKey"),
+    LIFE_TIME((short)5, "lifeTime"),
+    NOT_BEFORE((short)6, "notBefore"),
+    PERSISTED_TIME((short)7, "persistedTime"),
+    TOKEN((short)8, "token");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // COMMUNITY_USER
+          return COMMUNITY_USER;
+        case 2: // X509_CERT
+          return X509_CERT;
+        case 3: // NOT_AFTER
+          return NOT_AFTER;
+        case 4: // PRIVATE_KEY
+          return PRIVATE_KEY;
+        case 5: // LIFE_TIME
+          return LIFE_TIME;
+        case 6: // NOT_BEFORE
+          return NOT_BEFORE;
+        case 7: // PERSISTED_TIME
+          return PERSISTED_TIME;
+        case 8: // TOKEN
+          return TOKEN;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __LIFETIME_ISSET_ID = 0;
+  private static final int __PERSISTEDTIME_ISSET_ID = 1;
+  private byte __isset_bitfield = 0;
+  private _Fields optionals[] = {_Fields.NOT_AFTER,_Fields.PRIVATE_KEY,_Fields.LIFE_TIME,_Fields.NOT_BEFORE,_Fields.PERSISTED_TIME,_Fields.TOKEN};
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.COMMUNITY_USER, new org.apache.thrift.meta_data.FieldMetaData("communityUser", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CommunityUser.class)));
+    tmpMap.put(_Fields.X509_CERT, new org.apache.thrift.meta_data.FieldMetaData("x509Cert", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.NOT_AFTER, new org.apache.thrift.meta_data.FieldMetaData("notAfter", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PRIVATE_KEY, new org.apache.thrift.meta_data.FieldMetaData("privateKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.LIFE_TIME, new org.apache.thrift.meta_data.FieldMetaData("lifeTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.NOT_BEFORE, new org.apache.thrift.meta_data.FieldMetaData("notBefore", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CertificateCredential.class, metaDataMap);
+  }
+
+  public CertificateCredential() {
+  }
+
+  public CertificateCredential(
+    CommunityUser communityUser,
+    String x509Cert)
+  {
+    this();
+    this.communityUser = communityUser;
+    this.x509Cert = x509Cert;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CertificateCredential(CertificateCredential other) {
+    __isset_bitfield = other.__isset_bitfield;
+    if (other.isSetCommunityUser()) {
+      this.communityUser = new CommunityUser(other.communityUser);
+    }
+    if (other.isSetX509Cert()) {
+      this.x509Cert = other.x509Cert;
+    }
+    if (other.isSetNotAfter()) {
+      this.notAfter = other.notAfter;
+    }
+    if (other.isSetPrivateKey()) {
+      this.privateKey = other.privateKey;
+    }
+    this.lifeTime = other.lifeTime;
+    if (other.isSetNotBefore()) {
+      this.notBefore = other.notBefore;
+    }
+    this.persistedTime = other.persistedTime;
+    if (other.isSetToken()) {
+      this.token = other.token;
+    }
+  }
+
+  public CertificateCredential deepCopy() {
+    return new CertificateCredential(this);
+  }
+
+  @Override
+  public void clear() {
+    this.communityUser = null;
+    this.x509Cert = null;
+    this.notAfter = null;
+    this.privateKey = null;
+    setLifeTimeIsSet(false);
+    this.lifeTime = 0;
+    this.notBefore = null;
+    setPersistedTimeIsSet(false);
+    this.persistedTime = 0;
+    this.token = null;
+  }
+
+  public CommunityUser getCommunityUser() {
+    return this.communityUser;
+  }
+
+  public CertificateCredential setCommunityUser(CommunityUser communityUser) {
+    this.communityUser = communityUser;
+    return this;
+  }
+
+  public void unsetCommunityUser() {
+    this.communityUser = null;
+  }
+
+  /** Returns true if field communityUser is set (has been assigned a value) and false otherwise */
+  public boolean isSetCommunityUser() {
+    return this.communityUser != null;
+  }
+
+  public void setCommunityUserIsSet(boolean value) {
+    if (!value) {
+      this.communityUser = null;
+    }
+  }
+
+  public String getX509Cert() {
+    return this.x509Cert;
+  }
+
+  public CertificateCredential setX509Cert(String x509Cert) {
+    this.x509Cert = x509Cert;
+    return this;
+  }
+
+  public void unsetX509Cert() {
+    this.x509Cert = null;
+  }
+
+  /** Returns true if field x509Cert is set (has been assigned a value) and false otherwise */
+  public boolean isSetX509Cert() {
+    return this.x509Cert != null;
+  }
+
+  public void setX509CertIsSet(boolean value) {
+    if (!value) {
+      this.x509Cert = null;
+    }
+  }
+
+  public String getNotAfter() {
+    return this.notAfter;
+  }
+
+  public CertificateCredential setNotAfter(String notAfter) {
+    this.notAfter = notAfter;
+    return this;
+  }
+
+  public void unsetNotAfter() {
+    this.notAfter = null;
+  }
+
+  /** Returns true if field notAfter is set (has been assigned a value) and false otherwise */
+  public boolean isSetNotAfter() {
+    return this.notAfter != null;
+  }
+
+  public void setNotAfterIsSet(boolean value) {
+    if (!value) {
+      this.notAfter = null;
+    }
+  }
+
+  public String getPrivateKey() {
+    return this.privateKey;
+  }
+
+  public CertificateCredential setPrivateKey(String privateKey) {
+    this.privateKey = privateKey;
+    return this;
+  }
+
+  public void unsetPrivateKey() {
+    this.privateKey = null;
+  }
+
+  /** Returns true if field privateKey is set (has been assigned a value) and false otherwise */
+  public boolean isSetPrivateKey() {
+    return this.privateKey != null;
+  }
+
+  public void setPrivateKeyIsSet(boolean value) {
+    if (!value) {
+      this.privateKey = null;
+    }
+  }
+
+  public long getLifeTime() {
+    return this.lifeTime;
+  }
+
+  public CertificateCredential setLifeTime(long lifeTime) {
+    this.lifeTime = lifeTime;
+    setLifeTimeIsSet(true);
+    return this;
+  }
+
+  public void unsetLifeTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LIFETIME_ISSET_ID);
+  }
+
+  /** Returns true if field lifeTime is set (has been assigned a value) and false otherwise */
+  public boolean isSetLifeTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __LIFETIME_ISSET_ID);
+  }
+
+  public void setLifeTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LIFETIME_ISSET_ID, value);
+  }
+
+  public String getNotBefore() {
+    return this.notBefore;
+  }
+
+  public CertificateCredential setNotBefore(String notBefore) {
+    this.notBefore = notBefore;
+    return this;
+  }
+
+  public void unsetNotBefore() {
+    this.notBefore = null;
+  }
+
+  /** Returns true if field notBefore is set (has been assigned a value) and false otherwise */
+  public boolean isSetNotBefore() {
+    return this.notBefore != null;
+  }
+
+  public void setNotBeforeIsSet(boolean value) {
+    if (!value) {
+      this.notBefore = null;
+    }
+  }
+
+  public long getPersistedTime() {
+    return this.persistedTime;
+  }
+
+  public CertificateCredential setPersistedTime(long persistedTime) {
+    this.persistedTime = persistedTime;
+    setPersistedTimeIsSet(true);
+    return this;
+  }
+
+  public void unsetPersistedTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */
+  public boolean isSetPersistedTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  public void setPersistedTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value);
+  }
+
+  public String getToken() {
+    return this.token;
+  }
+
+  public CertificateCredential setToken(String token) {
+    this.token = token;
+    return this;
+  }
+
+  public void unsetToken() {
+    this.token = null;
+  }
+
+  /** Returns true if field token is set (has been assigned a value) and false otherwise */
+  public boolean isSetToken() {
+    return this.token != null;
+  }
+
+  public void setTokenIsSet(boolean value) {
+    if (!value) {
+      this.token = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case COMMUNITY_USER:
+      if (value == null) {
+        unsetCommunityUser();
+      } else {
+        setCommunityUser((CommunityUser)value);
+      }
+      break;
+
+    case X509_CERT:
+      if (value == null) {
+        unsetX509Cert();
+      } else {
+        setX509Cert((String)value);
+      }
+      break;
+
+    case NOT_AFTER:
+      if (value == null) {
+        unsetNotAfter();
+      } else {
+        setNotAfter((String)value);
+      }
+      break;
+
+    case PRIVATE_KEY:
+      if (value == null) {
+        unsetPrivateKey();
+      } else {
+        setPrivateKey((String)value);
+      }
+      break;
+
+    case LIFE_TIME:
+      if (value == null) {
+        unsetLifeTime();
+      } else {
+        setLifeTime((Long)value);
+      }
+      break;
+
+    case NOT_BEFORE:
+      if (value == null) {
+        unsetNotBefore();
+      } else {
+        setNotBefore((String)value);
+      }
+      break;
+
+    case PERSISTED_TIME:
+      if (value == null) {
+        unsetPersistedTime();
+      } else {
+        setPersistedTime((Long)value);
+      }
+      break;
+
+    case TOKEN:
+      if (value == null) {
+        unsetToken();
+      } else {
+        setToken((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case COMMUNITY_USER:
+      return getCommunityUser();
+
+    case X509_CERT:
+      return getX509Cert();
+
+    case NOT_AFTER:
+      return getNotAfter();
+
+    case PRIVATE_KEY:
+      return getPrivateKey();
+
+    case LIFE_TIME:
+      return Long.valueOf(getLifeTime());
+
+    case NOT_BEFORE:
+      return getNotBefore();
+
+    case PERSISTED_TIME:
+      return Long.valueOf(getPersistedTime());
+
+    case TOKEN:
+      return getToken();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case COMMUNITY_USER:
+      return isSetCommunityUser();
+    case X509_CERT:
+      return isSetX509Cert();
+    case NOT_AFTER:
+      return isSetNotAfter();
+    case PRIVATE_KEY:
+      return isSetPrivateKey();
+    case LIFE_TIME:
+      return isSetLifeTime();
+    case NOT_BEFORE:
+      return isSetNotBefore();
+    case PERSISTED_TIME:
+      return isSetPersistedTime();
+    case TOKEN:
+      return isSetToken();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CertificateCredential)
+      return this.equals((CertificateCredential)that);
+    return false;
+  }
+
+  public boolean equals(CertificateCredential that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_communityUser = true && this.isSetCommunityUser();
+    boolean that_present_communityUser = true && that.isSetCommunityUser();
+    if (this_present_communityUser || that_present_communityUser) {
+      if (!(this_present_communityUser && that_present_communityUser))
+        return false;
+      if (!this.communityUser.equals(that.communityUser))
+        return false;
+    }
+
+    boolean this_present_x509Cert = true && this.isSetX509Cert();
+    boolean that_present_x509Cert = true && that.isSetX509Cert();
+    if (this_present_x509Cert || that_present_x509Cert) {
+      if (!(this_present_x509Cert && that_present_x509Cert))
+        return false;
+      if (!this.x509Cert.equals(that.x509Cert))
+        return false;
+    }
+
+    boolean this_present_notAfter = true && this.isSetNotAfter();
+    boolean that_present_notAfter = true && that.isSetNotAfter();
+    if (this_present_notAfter || that_present_notAfter) {
+      if (!(this_present_notAfter && that_present_notAfter))
+        return false;
+      if (!this.notAfter.equals(that.notAfter))
+        return false;
+    }
+
+    boolean this_present_privateKey = true && this.isSetPrivateKey();
+    boolean that_present_privateKey = true && that.isSetPrivateKey();
+    if (this_present_privateKey || that_present_privateKey) {
+      if (!(this_present_privateKey && that_present_privateKey))
+        return false;
+      if (!this.privateKey.equals(that.privateKey))
+        return false;
+    }
+
+    boolean this_present_lifeTime = true && this.isSetLifeTime();
+    boolean that_present_lifeTime = true && that.isSetLifeTime();
+    if (this_present_lifeTime || that_present_lifeTime) {
+      if (!(this_present_lifeTime && that_present_lifeTime))
+        return false;
+      if (this.lifeTime != that.lifeTime)
+        return false;
+    }
+
+    boolean this_present_notBefore = true && this.isSetNotBefore();
+    boolean that_present_notBefore = true && that.isSetNotBefore();
+    if (this_present_notBefore || that_present_notBefore) {
+      if (!(this_present_notBefore && that_present_notBefore))
+        return false;
+      if (!this.notBefore.equals(that.notBefore))
+        return false;
+    }
+
+    boolean this_present_persistedTime = true && this.isSetPersistedTime();
+    boolean that_present_persistedTime = true && that.isSetPersistedTime();
+    if (this_present_persistedTime || that_present_persistedTime) {
+      if (!(this_present_persistedTime && that_present_persistedTime))
+        return false;
+      if (this.persistedTime != that.persistedTime)
+        return false;
+    }
+
+    boolean this_present_token = true && this.isSetToken();
+    boolean that_present_token = true && that.isSetToken();
+    if (this_present_token || that_present_token) {
+      if (!(this_present_token && that_present_token))
+        return false;
+      if (!this.token.equals(that.token))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CertificateCredential other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetCommunityUser()).compareTo(other.isSetCommunityUser());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCommunityUser()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.communityUser, other.communityUser);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetX509Cert()).compareTo(other.isSetX509Cert());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetX509Cert()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.x509Cert, other.x509Cert);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetNotAfter()).compareTo(other.isSetNotAfter());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetNotAfter()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notAfter, other.notAfter);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPrivateKey()).compareTo(other.isSetPrivateKey());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPrivateKey()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privateKey, other.privateKey);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetLifeTime()).compareTo(other.isSetLifeTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetLifeTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lifeTime, other.lifeTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetNotBefore()).compareTo(other.isSetNotBefore());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetNotBefore()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notBefore, other.notBefore);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPersistedTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetToken()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("CertificateCredential(");
+    boolean first = true;
+
+    sb.append("communityUser:");
+    if (this.communityUser == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.communityUser);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("x509Cert:");
+    if (this.x509Cert == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.x509Cert);
+    }
+    first = false;
+    if (isSetNotAfter()) {
+      if (!first) sb.append(", ");
+      sb.append("notAfter:");
+      if (this.notAfter == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.notAfter);
+      }
+      first = false;
+    }
+    if (isSetPrivateKey()) {
+      if (!first) sb.append(", ");
+      sb.append("privateKey:");
+      if (this.privateKey == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.privateKey);
+      }
+      first = false;
+    }
+    if (isSetLifeTime()) {
+      if (!first) sb.append(", ");
+      sb.append("lifeTime:");
+      sb.append(this.lifeTime);
+      first = false;
+    }
+    if (isSetNotBefore()) {
+      if (!first) sb.append(", ");
+      sb.append("notBefore:");
+      if (this.notBefore == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.notBefore);
+      }
+      first = false;
+    }
+    if (isSetPersistedTime()) {
+      if (!first) sb.append(", ");
+      sb.append("persistedTime:");
+      sb.append(this.persistedTime);
+      first = false;
+    }
+    if (isSetToken()) {
+      if (!first) sb.append(", ");
+      sb.append("token:");
+      if (this.token == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.token);
+      }
+      first = false;
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (communityUser == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'communityUser' was not present! Struct: " + toString());
+    }
+    if (x509Cert == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'x509Cert' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+    if (communityUser != null) {
+      communityUser.validate();
+    }
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class CertificateCredentialStandardSchemeFactory implements SchemeFactory {
+    public CertificateCredentialStandardScheme getScheme() {
+      return new CertificateCredentialStandardScheme();
+    }
+  }
+
+  private static class CertificateCredentialStandardScheme extends StandardScheme<CertificateCredential> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CertificateCredential struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // COMMUNITY_USER
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+              struct.communityUser = new CommunityUser();
+              struct.communityUser.read(iprot);
+              struct.setCommunityUserIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // X509_CERT
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.x509Cert = iprot.readString();
+              struct.setX509CertIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // NOT_AFTER
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.notAfter = iprot.readString();
+              struct.setNotAfterIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // PRIVATE_KEY
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.privateKey = iprot.readString();
+              struct.setPrivateKeyIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 5: // LIFE_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.lifeTime = iprot.readI64();
+              struct.setLifeTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 6: // NOT_BEFORE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.notBefore = iprot.readString();
+              struct.setNotBeforeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 7: // PERSISTED_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.persistedTime = iprot.readI64();
+              struct.setPersistedTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 8: // TOKEN
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.token = iprot.readString();
+              struct.setTokenIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, CertificateCredential struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.communityUser != null) {
+        oprot.writeFieldBegin(COMMUNITY_USER_FIELD_DESC);
+        struct.communityUser.write(oprot);
+        oprot.writeFieldEnd();
+      }
+      if (struct.x509Cert != null) {
+        oprot.writeFieldBegin(X509_CERT_FIELD_DESC);
+        oprot.writeString(struct.x509Cert);
+        oprot.writeFieldEnd();
+      }
+      if (struct.notAfter != null) {
+        if (struct.isSetNotAfter()) {
+          oprot.writeFieldBegin(NOT_AFTER_FIELD_DESC);
+          oprot.writeString(struct.notAfter);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.privateKey != null) {
+        if (struct.isSetPrivateKey()) {
+          oprot.writeFieldBegin(PRIVATE_KEY_FIELD_DESC);
+          oprot.writeString(struct.privateKey);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.isSetLifeTime()) {
+        oprot.writeFieldBegin(LIFE_TIME_FIELD_DESC);
+        oprot.writeI64(struct.lifeTime);
+        oprot.writeFieldEnd();
+      }
+      if (struct.notBefore != null) {
+        if (struct.isSetNotBefore()) {
+          oprot.writeFieldBegin(NOT_BEFORE_FIELD_DESC);
+          oprot.writeString(struct.notBefore);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC);
+        oprot.writeI64(struct.persistedTime);
+        oprot.writeFieldEnd();
+      }
+      if (struct.token != null) {
+        if (struct.isSetToken()) {
+          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
+          oprot.writeString(struct.token);
+          oprot.writeFieldEnd();
+        }
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CertificateCredentialTupleSchemeFactory implements SchemeFactory {
+    public CertificateCredentialTupleScheme getScheme() {
+      return new CertificateCredentialTupleScheme();
+    }
+  }
+
+  private static class CertificateCredentialTupleScheme extends TupleScheme<CertificateCredential> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CertificateCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      struct.communityUser.write(oprot);
+      oprot.writeString(struct.x509Cert);
+      BitSet optionals = new BitSet();
+      if (struct.isSetNotAfter()) {
+        optionals.set(0);
+      }
+      if (struct.isSetPrivateKey()) {
+        optionals.set(1);
+      }
+      if (struct.isSetLifeTime()) {
+        optionals.set(2);
+      }
+      if (struct.isSetNotBefore()) {
+        optionals.set(3);
+      }
+      if (struct.isSetPersistedTime()) {
+        optionals.set(4);
+      }
+      if (struct.isSetToken()) {
+        optionals.set(5);
+      }
+      oprot.writeBitSet(optionals, 6);
+      if (struct.isSetNotAfter()) {
+        oprot.writeString(struct.notAfter);
+      }
+      if (struct.isSetPrivateKey()) {
+        oprot.writeString(struct.privateKey);
+      }
+      if (struct.isSetLifeTime()) {
+        oprot.writeI64(struct.lifeTime);
+      }
+      if (struct.isSetNotBefore()) {
+        oprot.writeString(struct.notBefore);
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeI64(struct.persistedTime);
+      }
+      if (struct.isSetToken()) {
+        oprot.writeString(struct.token);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CertificateCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.communityUser = new CommunityUser();
+      struct.communityUser.read(iprot);
+      struct.setCommunityUserIsSet(true);
+      struct.x509Cert = iprot.readString();
+      struct.setX509CertIsSet(true);
+      BitSet incoming = iprot.readBitSet(6);
+      if (incoming.get(0)) {
+        struct.notAfter = iprot.readString();
+        struct.setNotAfterIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.privateKey = iprot.readString();
+        struct.setPrivateKeyIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.lifeTime = iprot.readI64();
+        struct.setLifeTimeIsSet(true);
+      }
+      if (incoming.get(3)) {
+        struct.notBefore = iprot.readString();
+        struct.setNotBeforeIsSet(true);
+      }
+      if (incoming.get(4)) {
+        struct.persistedTime = iprot.readI64();
+        struct.setPersistedTimeIsSet(true);
+      }
+      if (incoming.get(5)) {
+        struct.token = iprot.readString();
+        struct.setTokenIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
new file mode 100644
index 0000000..9b62310
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
@@ -0,0 +1,589 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class CommunityUser implements org.apache.thrift.TBase<CommunityUser, CommunityUser._Fields>, java.io.Serializable, Cloneable, Comparable<CommunityUser> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CommunityUser");
+
+  private static final org.apache.thrift.protocol.TField GATEWAY_NMAE_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayNmae", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField USER_EMAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("userEmail", org.apache.thrift.protocol.TType.STRING, (short)3);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CommunityUserStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CommunityUserTupleSchemeFactory());
+  }
+
+  public String gatewayNmae; // required
+  public String username; // required
+  public String userEmail; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    GATEWAY_NMAE((short)1, "gatewayNmae"),
+    USERNAME((short)2, "username"),
+    USER_EMAIL((short)3, "userEmail");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // GATEWAY_NMAE
+          return GATEWAY_NMAE;
+        case 2: // USERNAME
+          return USERNAME;
+        case 3: // USER_EMAIL
+          return USER_EMAIL;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.GATEWAY_NMAE, new org.apache.thrift.meta_data.FieldMetaData("gatewayNmae", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.USER_EMAIL, new org.apache.thrift.meta_data.FieldMetaData("userEmail", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CommunityUser.class, metaDataMap);
+  }
+
+  public CommunityUser() {
+  }
+
+  public CommunityUser(
+    String gatewayNmae,
+    String username,
+    String userEmail)
+  {
+    this();
+    this.gatewayNmae = gatewayNmae;
+    this.username = username;
+    this.userEmail = userEmail;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CommunityUser(CommunityUser other) {
+    if (other.isSetGatewayNmae()) {
+      this.gatewayNmae = other.gatewayNmae;
+    }
+    if (other.isSetUsername()) {
+      this.username = other.username;
+    }
+    if (other.isSetUserEmail()) {
+      this.userEmail = other.userEmail;
+    }
+  }
+
+  public CommunityUser deepCopy() {
+    return new CommunityUser(this);
+  }
+
+  @Override
+  public void clear() {
+    this.gatewayNmae = null;
+    this.username = null;
+    this.userEmail = null;
+  }
+
+  public String getGatewayNmae() {
+    return this.gatewayNmae;
+  }
+
+  public CommunityUser setGatewayNmae(String gatewayNmae) {
+    this.gatewayNmae = gatewayNmae;
+    return this;
+  }
+
+  public void unsetGatewayNmae() {
+    this.gatewayNmae = null;
+  }
+
+  /** Returns true if field gatewayNmae is set (has been assigned a value) and false otherwise */
+  public boolean isSetGatewayNmae() {
+    return this.gatewayNmae != null;
+  }
+
+  public void setGatewayNmaeIsSet(boolean value) {
+    if (!value) {
+      this.gatewayNmae = null;
+    }
+  }
+
+  public String getUsername() {
+    return this.username;
+  }
+
+  public CommunityUser setUsername(String username) {
+    this.username = username;
+    return this;
+  }
+
+  public void unsetUsername() {
+    this.username = null;
+  }
+
+  /** Returns true if field username is set (has been assigned a value) and false otherwise */
+  public boolean isSetUsername() {
+    return this.username != null;
+  }
+
+  public void setUsernameIsSet(boolean value) {
+    if (!value) {
+      this.username = null;
+    }
+  }
+
+  public String getUserEmail() {
+    return this.userEmail;
+  }
+
+  public CommunityUser setUserEmail(String userEmail) {
+    this.userEmail = userEmail;
+    return this;
+  }
+
+  public void unsetUserEmail() {
+    this.userEmail = null;
+  }
+
+  /** Returns true if field userEmail is set (has been assigned a value) and false otherwise */
+  public boolean isSetUserEmail() {
+    return this.userEmail != null;
+  }
+
+  public void setUserEmailIsSet(boolean value) {
+    if (!value) {
+      this.userEmail = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case GATEWAY_NMAE:
+      if (value == null) {
+        unsetGatewayNmae();
+      } else {
+        setGatewayNmae((String)value);
+      }
+      break;
+
+    case USERNAME:
+      if (value == null) {
+        unsetUsername();
+      } else {
+        setUsername((String)value);
+      }
+      break;
+
+    case USER_EMAIL:
+      if (value == null) {
+        unsetUserEmail();
+      } else {
+        setUserEmail((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case GATEWAY_NMAE:
+      return getGatewayNmae();
+
+    case USERNAME:
+      return getUsername();
+
+    case USER_EMAIL:
+      return getUserEmail();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case GATEWAY_NMAE:
+      return isSetGatewayNmae();
+    case USERNAME:
+      return isSetUsername();
+    case USER_EMAIL:
+      return isSetUserEmail();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CommunityUser)
+      return this.equals((CommunityUser)that);
+    return false;
+  }
+
+  public boolean equals(CommunityUser that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_gatewayNmae = true && this.isSetGatewayNmae();
+    boolean that_present_gatewayNmae = true && that.isSetGatewayNmae();
+    if (this_present_gatewayNmae || that_present_gatewayNmae) {
+      if (!(this_present_gatewayNmae && that_present_gatewayNmae))
+        return false;
+      if (!this.gatewayNmae.equals(that.gatewayNmae))
+        return false;
+    }
+
+    boolean this_present_username = true && this.isSetUsername();
+    boolean that_present_username = true && that.isSetUsername();
+    if (this_present_username || that_present_username) {
+      if (!(this_present_username && that_present_username))
+        return false;
+      if (!this.username.equals(that.username))
+        return false;
+    }
+
+    boolean this_present_userEmail = true && this.isSetUserEmail();
+    boolean that_present_userEmail = true && that.isSetUserEmail();
+    if (this_present_userEmail || that_present_userEmail) {
+      if (!(this_present_userEmail && that_present_userEmail))
+        return false;
+      if (!this.userEmail.equals(that.userEmail))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CommunityUser other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetGatewayNmae()).compareTo(other.isSetGatewayNmae());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetGatewayNmae()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayNmae, other.gatewayNmae);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUsername()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetUserEmail()).compareTo(other.isSetUserEmail());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUserEmail()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userEmail, other.userEmail);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("CommunityUser(");
+    boolean first = true;
+
+    sb.append("gatewayNmae:");
+    if (this.gatewayNmae == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.gatewayNmae);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("username:");
+    if (this.username == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.username);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("userEmail:");
+    if (this.userEmail == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.userEmail);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (gatewayNmae == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayNmae' was not present! Struct: " + toString());
+    }
+    if (username == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
+    }
+    if (userEmail == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'userEmail' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class CommunityUserStandardSchemeFactory implements SchemeFactory {
+    public CommunityUserStandardScheme getScheme() {
+      return new CommunityUserStandardScheme();
+    }
+  }
+
+  private static class CommunityUserStandardScheme extends StandardScheme<CommunityUser> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CommunityUser struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // GATEWAY_NMAE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.gatewayNmae = iprot.readString();
+              struct.setGatewayNmaeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // USERNAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.username = iprot.readString();
+              struct.setUsernameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // USER_EMAIL
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.userEmail = iprot.readString();
+              struct.setUserEmailIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, CommunityUser struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.gatewayNmae != null) {
+        oprot.writeFieldBegin(GATEWAY_NMAE_FIELD_DESC);
+        oprot.writeString(struct.gatewayNmae);
+        oprot.writeFieldEnd();
+      }
+      if (struct.username != null) {
+        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+        oprot.writeString(struct.username);
+        oprot.writeFieldEnd();
+      }
+      if (struct.userEmail != null) {
+        oprot.writeFieldBegin(USER_EMAIL_FIELD_DESC);
+        oprot.writeString(struct.userEmail);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CommunityUserTupleSchemeFactory implements SchemeFactory {
+    public CommunityUserTupleScheme getScheme() {
+      return new CommunityUserTupleScheme();
+    }
+  }
+
+  private static class CommunityUserTupleScheme extends TupleScheme<CommunityUser> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CommunityUser struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeString(struct.gatewayNmae);
+      oprot.writeString(struct.username);
+      oprot.writeString(struct.userEmail);
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CommunityUser struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.gatewayNmae = iprot.readString();
+      struct.setGatewayNmaeIsSet(true);
+      struct.username = iprot.readString();
+      struct.setUsernameIsSet(true);
+      struct.userEmail = iprot.readString();
+      struct.setUserEmailIsSet(true);
+    }
+  }
+
+}
+


[13/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
deleted file mode 100644
index f6b6837..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
+++ /dev/null
@@ -1,698 +0,0 @@
-    /*
-     * 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.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.credential.store.datamodel;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class PasswordCredential implements org.apache.thrift.TBase<PasswordCredential, PasswordCredential._Fields>, java.io.Serializable, Cloneable, Comparable<PasswordCredential> {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PasswordCredential");
-
-  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1);
-  private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
-  private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)3);
-  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)4);
-
-  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new PasswordCredentialStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new PasswordCredentialTupleSchemeFactory());
-  }
-
-  public String username; // required
-  public String password; // required
-  public long persistedTime; // optional
-  public String token; // optional
-
-  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    USERNAME((short)1, "username"),
-    PASSWORD((short)2, "password"),
-    PERSISTED_TIME((short)3, "persistedTime"),
-    TOKEN((short)4, "token");
-
-    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-    static {
-      for (_Fields field : EnumSet.allOf(_Fields.class)) {
-        byName.put(field.getFieldName(), field);
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, or null if its not found.
-     */
-    public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // USERNAME
-          return USERNAME;
-        case 2: // PASSWORD
-          return PASSWORD;
-        case 3: // PERSISTED_TIME
-          return PERSISTED_TIME;
-        case 4: // TOKEN
-          return TOKEN;
-        default:
-          return null;
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, throwing an exception
-     * if it is not found.
-     */
-    public static _Fields findByThriftIdOrThrow(int fieldId) {
-      _Fields fields = findByThriftId(fieldId);
-      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      return fields;
-    }
-
-    /**
-     * Find the _Fields constant that matches name, or null if its not found.
-     */
-    public static _Fields findByName(String name) {
-      return byName.get(name);
-    }
-
-    private final short _thriftId;
-    private final String _fieldName;
-
-    _Fields(short thriftId, String fieldName) {
-      _thriftId = thriftId;
-      _fieldName = fieldName;
-    }
-
-    public short getThriftFieldId() {
-      return _thriftId;
-    }
-
-    public String getFieldName() {
-      return _fieldName;
-    }
-  }
-
-  // isset id assignments
-  private static final int __PERSISTEDTIME_ISSET_ID = 0;
-  private byte __isset_bitfield = 0;
-  private _Fields optionals[] = {_Fields.PERSISTED_TIME,_Fields.TOKEN};
-  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
-    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
-    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PasswordCredential.class, metaDataMap);
-  }
-
-  public PasswordCredential() {
-  }
-
-  public PasswordCredential(
-    String username,
-    String password)
-  {
-    this();
-    this.username = username;
-    this.password = password;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public PasswordCredential(PasswordCredential other) {
-    __isset_bitfield = other.__isset_bitfield;
-    if (other.isSetUsername()) {
-      this.username = other.username;
-    }
-    if (other.isSetPassword()) {
-      this.password = other.password;
-    }
-    this.persistedTime = other.persistedTime;
-    if (other.isSetToken()) {
-      this.token = other.token;
-    }
-  }
-
-  public PasswordCredential deepCopy() {
-    return new PasswordCredential(this);
-  }
-
-  @Override
-  public void clear() {
-    this.username = null;
-    this.password = null;
-    setPersistedTimeIsSet(false);
-    this.persistedTime = 0;
-    this.token = null;
-  }
-
-  public String getUsername() {
-    return this.username;
-  }
-
-  public PasswordCredential setUsername(String username) {
-    this.username = username;
-    return this;
-  }
-
-  public void unsetUsername() {
-    this.username = null;
-  }
-
-  /** Returns true if field username is set (has been assigned a value) and false otherwise */
-  public boolean isSetUsername() {
-    return this.username != null;
-  }
-
-  public void setUsernameIsSet(boolean value) {
-    if (!value) {
-      this.username = null;
-    }
-  }
-
-  public String getPassword() {
-    return this.password;
-  }
-
-  public PasswordCredential setPassword(String password) {
-    this.password = password;
-    return this;
-  }
-
-  public void unsetPassword() {
-    this.password = null;
-  }
-
-  /** Returns true if field password is set (has been assigned a value) and false otherwise */
-  public boolean isSetPassword() {
-    return this.password != null;
-  }
-
-  public void setPasswordIsSet(boolean value) {
-    if (!value) {
-      this.password = null;
-    }
-  }
-
-  public long getPersistedTime() {
-    return this.persistedTime;
-  }
-
-  public PasswordCredential setPersistedTime(long persistedTime) {
-    this.persistedTime = persistedTime;
-    setPersistedTimeIsSet(true);
-    return this;
-  }
-
-  public void unsetPersistedTime() {
-    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
-  }
-
-  /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */
-  public boolean isSetPersistedTime() {
-    return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
-  }
-
-  public void setPersistedTimeIsSet(boolean value) {
-    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value);
-  }
-
-  public String getToken() {
-    return this.token;
-  }
-
-  public PasswordCredential setToken(String token) {
-    this.token = token;
-    return this;
-  }
-
-  public void unsetToken() {
-    this.token = null;
-  }
-
-  /** Returns true if field token is set (has been assigned a value) and false otherwise */
-  public boolean isSetToken() {
-    return this.token != null;
-  }
-
-  public void setTokenIsSet(boolean value) {
-    if (!value) {
-      this.token = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case USERNAME:
-      if (value == null) {
-        unsetUsername();
-      } else {
-        setUsername((String)value);
-      }
-      break;
-
-    case PASSWORD:
-      if (value == null) {
-        unsetPassword();
-      } else {
-        setPassword((String)value);
-      }
-      break;
-
-    case PERSISTED_TIME:
-      if (value == null) {
-        unsetPersistedTime();
-      } else {
-        setPersistedTime((Long)value);
-      }
-      break;
-
-    case TOKEN:
-      if (value == null) {
-        unsetToken();
-      } else {
-        setToken((String)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case USERNAME:
-      return getUsername();
-
-    case PASSWORD:
-      return getPassword();
-
-    case PERSISTED_TIME:
-      return Long.valueOf(getPersistedTime());
-
-    case TOKEN:
-      return getToken();
-
-    }
-    throw new IllegalStateException();
-  }
-
-  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
-    switch (field) {
-    case USERNAME:
-      return isSetUsername();
-    case PASSWORD:
-      return isSetPassword();
-    case PERSISTED_TIME:
-      return isSetPersistedTime();
-    case TOKEN:
-      return isSetToken();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof PasswordCredential)
-      return this.equals((PasswordCredential)that);
-    return false;
-  }
-
-  public boolean equals(PasswordCredential that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_username = true && this.isSetUsername();
-    boolean that_present_username = true && that.isSetUsername();
-    if (this_present_username || that_present_username) {
-      if (!(this_present_username && that_present_username))
-        return false;
-      if (!this.username.equals(that.username))
-        return false;
-    }
-
-    boolean this_present_password = true && this.isSetPassword();
-    boolean that_present_password = true && that.isSetPassword();
-    if (this_present_password || that_present_password) {
-      if (!(this_present_password && that_present_password))
-        return false;
-      if (!this.password.equals(that.password))
-        return false;
-    }
-
-    boolean this_present_persistedTime = true && this.isSetPersistedTime();
-    boolean that_present_persistedTime = true && that.isSetPersistedTime();
-    if (this_present_persistedTime || that_present_persistedTime) {
-      if (!(this_present_persistedTime && that_present_persistedTime))
-        return false;
-      if (this.persistedTime != that.persistedTime)
-        return false;
-    }
-
-    boolean this_present_token = true && this.isSetToken();
-    boolean that_present_token = true && that.isSetToken();
-    if (this_present_token || that_present_token) {
-      if (!(this_present_token && that_present_token))
-        return false;
-      if (!this.token.equals(that.token))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return 0;
-  }
-
-  @Override
-  public int compareTo(PasswordCredential other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-
-    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetUsername()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetPassword()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetPersistedTime()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetToken()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
-  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-  }
-
-  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("PasswordCredential(");
-    boolean first = true;
-
-    sb.append("username:");
-    if (this.username == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.username);
-    }
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("password:");
-    if (this.password == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.password);
-    }
-    first = false;
-    if (isSetPersistedTime()) {
-      if (!first) sb.append(", ");
-      sb.append("persistedTime:");
-      sb.append(this.persistedTime);
-      first = false;
-    }
-    if (isSetToken()) {
-      if (!first) sb.append(", ");
-      sb.append("token:");
-      if (this.token == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.token);
-      }
-      first = false;
-    }
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    if (username == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
-    }
-    if (password == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'password' was not present! Struct: " + toString());
-    }
-    // check for sub-struct validity
-  }
-
-  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-    try {
-      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-    try {
-      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
-      __isset_bitfield = 0;
-      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private static class PasswordCredentialStandardSchemeFactory implements SchemeFactory {
-    public PasswordCredentialStandardScheme getScheme() {
-      return new PasswordCredentialStandardScheme();
-    }
-  }
-
-  private static class PasswordCredentialStandardScheme extends StandardScheme<PasswordCredential> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, PasswordCredential struct) throws org.apache.thrift.TException {
-      org.apache.thrift.protocol.TField schemeField;
-      iprot.readStructBegin();
-      while (true)
-      {
-        schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-          break;
-        }
-        switch (schemeField.id) {
-          case 1: // USERNAME
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.username = iprot.readString();
-              struct.setUsernameIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 2: // PASSWORD
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.password = iprot.readString();
-              struct.setPasswordIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 3: // PERSISTED_TIME
-            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
-              struct.persistedTime = iprot.readI64();
-              struct.setPersistedTimeIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 4: // TOKEN
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.token = iprot.readString();
-              struct.setTokenIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          default:
-            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-        }
-        iprot.readFieldEnd();
-      }
-      iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
-      struct.validate();
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot, PasswordCredential struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.username != null) {
-        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
-        oprot.writeString(struct.username);
-        oprot.writeFieldEnd();
-      }
-      if (struct.password != null) {
-        oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
-        oprot.writeString(struct.password);
-        oprot.writeFieldEnd();
-      }
-      if (struct.isSetPersistedTime()) {
-        oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC);
-        oprot.writeI64(struct.persistedTime);
-        oprot.writeFieldEnd();
-      }
-      if (struct.token != null) {
-        if (struct.isSetToken()) {
-          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
-          oprot.writeString(struct.token);
-          oprot.writeFieldEnd();
-        }
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class PasswordCredentialTupleSchemeFactory implements SchemeFactory {
-    public PasswordCredentialTupleScheme getScheme() {
-      return new PasswordCredentialTupleScheme();
-    }
-  }
-
-  private static class PasswordCredentialTupleScheme extends TupleScheme<PasswordCredential> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, PasswordCredential struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      oprot.writeString(struct.username);
-      oprot.writeString(struct.password);
-      BitSet optionals = new BitSet();
-      if (struct.isSetPersistedTime()) {
-        optionals.set(0);
-      }
-      if (struct.isSetToken()) {
-        optionals.set(1);
-      }
-      oprot.writeBitSet(optionals, 2);
-      if (struct.isSetPersistedTime()) {
-        oprot.writeI64(struct.persistedTime);
-      }
-      if (struct.isSetToken()) {
-        oprot.writeString(struct.token);
-      }
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, PasswordCredential struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      struct.username = iprot.readString();
-      struct.setUsernameIsSet(true);
-      struct.password = iprot.readString();
-      struct.setPasswordIsSet(true);
-      BitSet incoming = iprot.readBitSet(2);
-      if (incoming.get(0)) {
-        struct.persistedTime = iprot.readI64();
-        struct.setPersistedTimeIsSet(true);
-      }
-      if (incoming.get(1)) {
-        struct.token = iprot.readString();
-        struct.setTokenIsSet(true);
-      }
-    }
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
deleted file mode 100644
index 9fc373a..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
+++ /dev/null
@@ -1,998 +0,0 @@
-    /*
-     * 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.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.credential.store.datamodel;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class SSHCredential implements org.apache.thrift.TBase<SSHCredential, SSHCredential._Fields>, java.io.Serializable, Cloneable, Comparable<SSHCredential> {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SSHCredential");
-
-  private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1);
-  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2);
-  private static final org.apache.thrift.protocol.TField PASSPHRASE_FIELD_DESC = new org.apache.thrift.protocol.TField("passphrase", org.apache.thrift.protocol.TType.STRING, (short)3);
-  private static final org.apache.thrift.protocol.TField PUBLIC_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("publicKey", org.apache.thrift.protocol.TType.STRING, (short)4);
-  private static final org.apache.thrift.protocol.TField PRIVATE_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("privateKey", org.apache.thrift.protocol.TType.STRING, (short)5);
-  private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)6);
-  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)7);
-
-  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new SSHCredentialStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new SSHCredentialTupleSchemeFactory());
-  }
-
-  public String gatewayId; // required
-  public String username; // required
-  public String passphrase; // required
-  public String publicKey; // optional
-  public String privateKey; // optional
-  public long persistedTime; // optional
-  public String token; // optional
-
-  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    GATEWAY_ID((short)1, "gatewayId"),
-    USERNAME((short)2, "username"),
-    PASSPHRASE((short)3, "passphrase"),
-    PUBLIC_KEY((short)4, "publicKey"),
-    PRIVATE_KEY((short)5, "privateKey"),
-    PERSISTED_TIME((short)6, "persistedTime"),
-    TOKEN((short)7, "token");
-
-    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-    static {
-      for (_Fields field : EnumSet.allOf(_Fields.class)) {
-        byName.put(field.getFieldName(), field);
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, or null if its not found.
-     */
-    public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // GATEWAY_ID
-          return GATEWAY_ID;
-        case 2: // USERNAME
-          return USERNAME;
-        case 3: // PASSPHRASE
-          return PASSPHRASE;
-        case 4: // PUBLIC_KEY
-          return PUBLIC_KEY;
-        case 5: // PRIVATE_KEY
-          return PRIVATE_KEY;
-        case 6: // PERSISTED_TIME
-          return PERSISTED_TIME;
-        case 7: // TOKEN
-          return TOKEN;
-        default:
-          return null;
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, throwing an exception
-     * if it is not found.
-     */
-    public static _Fields findByThriftIdOrThrow(int fieldId) {
-      _Fields fields = findByThriftId(fieldId);
-      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      return fields;
-    }
-
-    /**
-     * Find the _Fields constant that matches name, or null if its not found.
-     */
-    public static _Fields findByName(String name) {
-      return byName.get(name);
-    }
-
-    private final short _thriftId;
-    private final String _fieldName;
-
-    _Fields(short thriftId, String fieldName) {
-      _thriftId = thriftId;
-      _fieldName = fieldName;
-    }
-
-    public short getThriftFieldId() {
-      return _thriftId;
-    }
-
-    public String getFieldName() {
-      return _fieldName;
-    }
-  }
-
-  // isset id assignments
-  private static final int __PERSISTEDTIME_ISSET_ID = 0;
-  private byte __isset_bitfield = 0;
-  private _Fields optionals[] = {_Fields.PUBLIC_KEY,_Fields.PRIVATE_KEY,_Fields.PERSISTED_TIME,_Fields.TOKEN};
-  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PASSPHRASE, new org.apache.thrift.meta_data.FieldMetaData("passphrase", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PUBLIC_KEY, new org.apache.thrift.meta_data.FieldMetaData("publicKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PRIVATE_KEY, new org.apache.thrift.meta_data.FieldMetaData("privateKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
-    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
-    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SSHCredential.class, metaDataMap);
-  }
-
-  public SSHCredential() {
-  }
-
-  public SSHCredential(
-    String gatewayId,
-    String username,
-    String passphrase)
-  {
-    this();
-    this.gatewayId = gatewayId;
-    this.username = username;
-    this.passphrase = passphrase;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public SSHCredential(SSHCredential other) {
-    __isset_bitfield = other.__isset_bitfield;
-    if (other.isSetGatewayId()) {
-      this.gatewayId = other.gatewayId;
-    }
-    if (other.isSetUsername()) {
-      this.username = other.username;
-    }
-    if (other.isSetPassphrase()) {
-      this.passphrase = other.passphrase;
-    }
-    if (other.isSetPublicKey()) {
-      this.publicKey = other.publicKey;
-    }
-    if (other.isSetPrivateKey()) {
-      this.privateKey = other.privateKey;
-    }
-    this.persistedTime = other.persistedTime;
-    if (other.isSetToken()) {
-      this.token = other.token;
-    }
-  }
-
-  public SSHCredential deepCopy() {
-    return new SSHCredential(this);
-  }
-
-  @Override
-  public void clear() {
-    this.gatewayId = null;
-    this.username = null;
-    this.passphrase = null;
-    this.publicKey = null;
-    this.privateKey = null;
-    setPersistedTimeIsSet(false);
-    this.persistedTime = 0;
-    this.token = null;
-  }
-
-  public String getGatewayId() {
-    return this.gatewayId;
-  }
-
-  public SSHCredential setGatewayId(String gatewayId) {
-    this.gatewayId = gatewayId;
-    return this;
-  }
-
-  public void unsetGatewayId() {
-    this.gatewayId = null;
-  }
-
-  /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */
-  public boolean isSetGatewayId() {
-    return this.gatewayId != null;
-  }
-
-  public void setGatewayIdIsSet(boolean value) {
-    if (!value) {
-      this.gatewayId = null;
-    }
-  }
-
-  public String getUsername() {
-    return this.username;
-  }
-
-  public SSHCredential setUsername(String username) {
-    this.username = username;
-    return this;
-  }
-
-  public void unsetUsername() {
-    this.username = null;
-  }
-
-  /** Returns true if field username is set (has been assigned a value) and false otherwise */
-  public boolean isSetUsername() {
-    return this.username != null;
-  }
-
-  public void setUsernameIsSet(boolean value) {
-    if (!value) {
-      this.username = null;
-    }
-  }
-
-  public String getPassphrase() {
-    return this.passphrase;
-  }
-
-  public SSHCredential setPassphrase(String passphrase) {
-    this.passphrase = passphrase;
-    return this;
-  }
-
-  public void unsetPassphrase() {
-    this.passphrase = null;
-  }
-
-  /** Returns true if field passphrase is set (has been assigned a value) and false otherwise */
-  public boolean isSetPassphrase() {
-    return this.passphrase != null;
-  }
-
-  public void setPassphraseIsSet(boolean value) {
-    if (!value) {
-      this.passphrase = null;
-    }
-  }
-
-  public String getPublicKey() {
-    return this.publicKey;
-  }
-
-  public SSHCredential setPublicKey(String publicKey) {
-    this.publicKey = publicKey;
-    return this;
-  }
-
-  public void unsetPublicKey() {
-    this.publicKey = null;
-  }
-
-  /** Returns true if field publicKey is set (has been assigned a value) and false otherwise */
-  public boolean isSetPublicKey() {
-    return this.publicKey != null;
-  }
-
-  public void setPublicKeyIsSet(boolean value) {
-    if (!value) {
-      this.publicKey = null;
-    }
-  }
-
-  public String getPrivateKey() {
-    return this.privateKey;
-  }
-
-  public SSHCredential setPrivateKey(String privateKey) {
-    this.privateKey = privateKey;
-    return this;
-  }
-
-  public void unsetPrivateKey() {
-    this.privateKey = null;
-  }
-
-  /** Returns true if field privateKey is set (has been assigned a value) and false otherwise */
-  public boolean isSetPrivateKey() {
-    return this.privateKey != null;
-  }
-
-  public void setPrivateKeyIsSet(boolean value) {
-    if (!value) {
-      this.privateKey = null;
-    }
-  }
-
-  public long getPersistedTime() {
-    return this.persistedTime;
-  }
-
-  public SSHCredential setPersistedTime(long persistedTime) {
-    this.persistedTime = persistedTime;
-    setPersistedTimeIsSet(true);
-    return this;
-  }
-
-  public void unsetPersistedTime() {
-    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
-  }
-
-  /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */
-  public boolean isSetPersistedTime() {
-    return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
-  }
-
-  public void setPersistedTimeIsSet(boolean value) {
-    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value);
-  }
-
-  public String getToken() {
-    return this.token;
-  }
-
-  public SSHCredential setToken(String token) {
-    this.token = token;
-    return this;
-  }
-
-  public void unsetToken() {
-    this.token = null;
-  }
-
-  /** Returns true if field token is set (has been assigned a value) and false otherwise */
-  public boolean isSetToken() {
-    return this.token != null;
-  }
-
-  public void setTokenIsSet(boolean value) {
-    if (!value) {
-      this.token = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case GATEWAY_ID:
-      if (value == null) {
-        unsetGatewayId();
-      } else {
-        setGatewayId((String)value);
-      }
-      break;
-
-    case USERNAME:
-      if (value == null) {
-        unsetUsername();
-      } else {
-        setUsername((String)value);
-      }
-      break;
-
-    case PASSPHRASE:
-      if (value == null) {
-        unsetPassphrase();
-      } else {
-        setPassphrase((String)value);
-      }
-      break;
-
-    case PUBLIC_KEY:
-      if (value == null) {
-        unsetPublicKey();
-      } else {
-        setPublicKey((String)value);
-      }
-      break;
-
-    case PRIVATE_KEY:
-      if (value == null) {
-        unsetPrivateKey();
-      } else {
-        setPrivateKey((String)value);
-      }
-      break;
-
-    case PERSISTED_TIME:
-      if (value == null) {
-        unsetPersistedTime();
-      } else {
-        setPersistedTime((Long)value);
-      }
-      break;
-
-    case TOKEN:
-      if (value == null) {
-        unsetToken();
-      } else {
-        setToken((String)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case GATEWAY_ID:
-      return getGatewayId();
-
-    case USERNAME:
-      return getUsername();
-
-    case PASSPHRASE:
-      return getPassphrase();
-
-    case PUBLIC_KEY:
-      return getPublicKey();
-
-    case PRIVATE_KEY:
-      return getPrivateKey();
-
-    case PERSISTED_TIME:
-      return Long.valueOf(getPersistedTime());
-
-    case TOKEN:
-      return getToken();
-
-    }
-    throw new IllegalStateException();
-  }
-
-  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
-    switch (field) {
-    case GATEWAY_ID:
-      return isSetGatewayId();
-    case USERNAME:
-      return isSetUsername();
-    case PASSPHRASE:
-      return isSetPassphrase();
-    case PUBLIC_KEY:
-      return isSetPublicKey();
-    case PRIVATE_KEY:
-      return isSetPrivateKey();
-    case PERSISTED_TIME:
-      return isSetPersistedTime();
-    case TOKEN:
-      return isSetToken();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof SSHCredential)
-      return this.equals((SSHCredential)that);
-    return false;
-  }
-
-  public boolean equals(SSHCredential that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_gatewayId = true && this.isSetGatewayId();
-    boolean that_present_gatewayId = true && that.isSetGatewayId();
-    if (this_present_gatewayId || that_present_gatewayId) {
-      if (!(this_present_gatewayId && that_present_gatewayId))
-        return false;
-      if (!this.gatewayId.equals(that.gatewayId))
-        return false;
-    }
-
-    boolean this_present_username = true && this.isSetUsername();
-    boolean that_present_username = true && that.isSetUsername();
-    if (this_present_username || that_present_username) {
-      if (!(this_present_username && that_present_username))
-        return false;
-      if (!this.username.equals(that.username))
-        return false;
-    }
-
-    boolean this_present_passphrase = true && this.isSetPassphrase();
-    boolean that_present_passphrase = true && that.isSetPassphrase();
-    if (this_present_passphrase || that_present_passphrase) {
-      if (!(this_present_passphrase && that_present_passphrase))
-        return false;
-      if (!this.passphrase.equals(that.passphrase))
-        return false;
-    }
-
-    boolean this_present_publicKey = true && this.isSetPublicKey();
-    boolean that_present_publicKey = true && that.isSetPublicKey();
-    if (this_present_publicKey || that_present_publicKey) {
-      if (!(this_present_publicKey && that_present_publicKey))
-        return false;
-      if (!this.publicKey.equals(that.publicKey))
-        return false;
-    }
-
-    boolean this_present_privateKey = true && this.isSetPrivateKey();
-    boolean that_present_privateKey = true && that.isSetPrivateKey();
-    if (this_present_privateKey || that_present_privateKey) {
-      if (!(this_present_privateKey && that_present_privateKey))
-        return false;
-      if (!this.privateKey.equals(that.privateKey))
-        return false;
-    }
-
-    boolean this_present_persistedTime = true && this.isSetPersistedTime();
-    boolean that_present_persistedTime = true && that.isSetPersistedTime();
-    if (this_present_persistedTime || that_present_persistedTime) {
-      if (!(this_present_persistedTime && that_present_persistedTime))
-        return false;
-      if (this.persistedTime != that.persistedTime)
-        return false;
-    }
-
-    boolean this_present_token = true && this.isSetToken();
-    boolean that_present_token = true && that.isSetToken();
-    if (this_present_token || that_present_token) {
-      if (!(this_present_token && that_present_token))
-        return false;
-      if (!this.token.equals(that.token))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return 0;
-  }
-
-  @Override
-  public int compareTo(SSHCredential other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-
-    lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(other.isSetGatewayId());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetGatewayId()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, other.gatewayId);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetUsername()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetPassphrase()).compareTo(other.isSetPassphrase());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetPassphrase()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.passphrase, other.passphrase);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetPublicKey()).compareTo(other.isSetPublicKey());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetPublicKey()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.publicKey, other.publicKey);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetPrivateKey()).compareTo(other.isSetPrivateKey());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetPrivateKey()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privateKey, other.privateKey);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetPersistedTime()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetToken()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
-  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-  }
-
-  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("SSHCredential(");
-    boolean first = true;
-
-    sb.append("gatewayId:");
-    if (this.gatewayId == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.gatewayId);
-    }
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("username:");
-    if (this.username == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.username);
-    }
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("passphrase:");
-    if (this.passphrase == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.passphrase);
-    }
-    first = false;
-    if (isSetPublicKey()) {
-      if (!first) sb.append(", ");
-      sb.append("publicKey:");
-      if (this.publicKey == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.publicKey);
-      }
-      first = false;
-    }
-    if (isSetPrivateKey()) {
-      if (!first) sb.append(", ");
-      sb.append("privateKey:");
-      if (this.privateKey == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.privateKey);
-      }
-      first = false;
-    }
-    if (isSetPersistedTime()) {
-      if (!first) sb.append(", ");
-      sb.append("persistedTime:");
-      sb.append(this.persistedTime);
-      first = false;
-    }
-    if (isSetToken()) {
-      if (!first) sb.append(", ");
-      sb.append("token:");
-      if (this.token == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.token);
-      }
-      first = false;
-    }
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    if (gatewayId == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString());
-    }
-    if (username == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
-    }
-    if (passphrase == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'passphrase' was not present! Struct: " + toString());
-    }
-    // check for sub-struct validity
-  }
-
-  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-    try {
-      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-    try {
-      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
-      __isset_bitfield = 0;
-      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private static class SSHCredentialStandardSchemeFactory implements SchemeFactory {
-    public SSHCredentialStandardScheme getScheme() {
-      return new SSHCredentialStandardScheme();
-    }
-  }
-
-  private static class SSHCredentialStandardScheme extends StandardScheme<SSHCredential> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, SSHCredential struct) throws org.apache.thrift.TException {
-      org.apache.thrift.protocol.TField schemeField;
-      iprot.readStructBegin();
-      while (true)
-      {
-        schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-          break;
-        }
-        switch (schemeField.id) {
-          case 1: // GATEWAY_ID
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.gatewayId = iprot.readString();
-              struct.setGatewayIdIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 2: // USERNAME
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.username = iprot.readString();
-              struct.setUsernameIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 3: // PASSPHRASE
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.passphrase = iprot.readString();
-              struct.setPassphraseIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 4: // PUBLIC_KEY
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.publicKey = iprot.readString();
-              struct.setPublicKeyIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 5: // PRIVATE_KEY
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.privateKey = iprot.readString();
-              struct.setPrivateKeyIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 6: // PERSISTED_TIME
-            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
-              struct.persistedTime = iprot.readI64();
-              struct.setPersistedTimeIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 7: // TOKEN
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.token = iprot.readString();
-              struct.setTokenIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          default:
-            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-        }
-        iprot.readFieldEnd();
-      }
-      iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
-      struct.validate();
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot, SSHCredential struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.gatewayId != null) {
-        oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
-        oprot.writeString(struct.gatewayId);
-        oprot.writeFieldEnd();
-      }
-      if (struct.username != null) {
-        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
-        oprot.writeString(struct.username);
-        oprot.writeFieldEnd();
-      }
-      if (struct.passphrase != null) {
-        oprot.writeFieldBegin(PASSPHRASE_FIELD_DESC);
-        oprot.writeString(struct.passphrase);
-        oprot.writeFieldEnd();
-      }
-      if (struct.publicKey != null) {
-        if (struct.isSetPublicKey()) {
-          oprot.writeFieldBegin(PUBLIC_KEY_FIELD_DESC);
-          oprot.writeString(struct.publicKey);
-          oprot.writeFieldEnd();
-        }
-      }
-      if (struct.privateKey != null) {
-        if (struct.isSetPrivateKey()) {
-          oprot.writeFieldBegin(PRIVATE_KEY_FIELD_DESC);
-          oprot.writeString(struct.privateKey);
-          oprot.writeFieldEnd();
-        }
-      }
-      if (struct.isSetPersistedTime()) {
-        oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC);
-        oprot.writeI64(struct.persistedTime);
-        oprot.writeFieldEnd();
-      }
-      if (struct.token != null) {
-        if (struct.isSetToken()) {
-          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
-          oprot.writeString(struct.token);
-          oprot.writeFieldEnd();
-        }
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class SSHCredentialTupleSchemeFactory implements SchemeFactory {
-    public SSHCredentialTupleScheme getScheme() {
-      return new SSHCredentialTupleScheme();
-    }
-  }
-
-  private static class SSHCredentialTupleScheme extends TupleScheme<SSHCredential> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, SSHCredential struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      oprot.writeString(struct.gatewayId);
-      oprot.writeString(struct.username);
-      oprot.writeString(struct.passphrase);
-      BitSet optionals = new BitSet();
-      if (struct.isSetPublicKey()) {
-        optionals.set(0);
-      }
-      if (struct.isSetPrivateKey()) {
-        optionals.set(1);
-      }
-      if (struct.isSetPersistedTime()) {
-        optionals.set(2);
-      }
-      if (struct.isSetToken()) {
-        optionals.set(3);
-      }
-      oprot.writeBitSet(optionals, 4);
-      if (struct.isSetPublicKey()) {
-        oprot.writeString(struct.publicKey);
-      }
-      if (struct.isSetPrivateKey()) {
-        oprot.writeString(struct.privateKey);
-      }
-      if (struct.isSetPersistedTime()) {
-        oprot.writeI64(struct.persistedTime);
-      }
-      if (struct.isSetToken()) {
-        oprot.writeString(struct.token);
-      }
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, SSHCredential struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      struct.gatewayId = iprot.readString();
-      struct.setGatewayIdIsSet(true);
-      struct.username = iprot.readString();
-      struct.setUsernameIsSet(true);
-      struct.passphrase = iprot.readString();
-      struct.setPassphraseIsSet(true);
-      BitSet incoming = iprot.readBitSet(4);
-      if (incoming.get(0)) {
-        struct.publicKey = iprot.readString();
-        struct.setPublicKeyIsSet(true);
-      }
-      if (incoming.get(1)) {
-        struct.privateKey = iprot.readString();
-        struct.setPrivateKeyIsSet(true);
-      }
-      if (incoming.get(2)) {
-        struct.persistedTime = iprot.readI64();
-        struct.setPersistedTimeIsSet(true);
-      }
-      if (incoming.get(3)) {
-        struct.token = iprot.readString();
-        struct.setTokenIsSet(true);
-      }
-    }
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/csDataModelConstants.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/csDataModelConstants.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/csDataModelConstants.java
deleted file mode 100644
index b17513a..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/csDataModelConstants.java
+++ /dev/null
@@ -1,55 +0,0 @@
-    /*
-     * 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.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.credential.store.datamodel;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class csDataModelConstants {
-
-  public static final String DEFAULT_ID = "DO_NOT_SET_AT_CLIENTS";
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
deleted file mode 100644
index 7be01da..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
+++ /dev/null
@@ -1,397 +0,0 @@
-    /*
-     * 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.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.credential.store.exception;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class CredentialStoreException extends TException implements org.apache.thrift.TBase<CredentialStoreException, CredentialStoreException._Fields>, java.io.Serializable, Cloneable, Comparable<CredentialStoreException> {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CredentialStoreException");
-
-  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
-
-  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new CredentialStoreExceptionStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new CredentialStoreExceptionTupleSchemeFactory());
-  }
-
-  public String message; // required
-
-  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    MESSAGE((short)1, "message");
-
-    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-    static {
-      for (_Fields field : EnumSet.allOf(_Fields.class)) {
-        byName.put(field.getFieldName(), field);
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, or null if its not found.
-     */
-    public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // MESSAGE
-          return MESSAGE;
-        default:
-          return null;
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, throwing an exception
-     * if it is not found.
-     */
-    public static _Fields findByThriftIdOrThrow(int fieldId) {
-      _Fields fields = findByThriftId(fieldId);
-      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      return fields;
-    }
-
-    /**
-     * Find the _Fields constant that matches name, or null if its not found.
-     */
-    public static _Fields findByName(String name) {
-      return byName.get(name);
-    }
-
-    private final short _thriftId;
-    private final String _fieldName;
-
-    _Fields(short thriftId, String fieldName) {
-      _thriftId = thriftId;
-      _fieldName = fieldName;
-    }
-
-    public short getThriftFieldId() {
-      return _thriftId;
-    }
-
-    public String getFieldName() {
-      return _fieldName;
-    }
-  }
-
-  // isset id assignments
-  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
-    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CredentialStoreException.class, metaDataMap);
-  }
-
-  public CredentialStoreException() {
-  }
-
-  public CredentialStoreException(
-    String message)
-  {
-    this();
-    this.message = message;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public CredentialStoreException(CredentialStoreException other) {
-    if (other.isSetMessage()) {
-      this.message = other.message;
-    }
-  }
-
-  public CredentialStoreException deepCopy() {
-    return new CredentialStoreException(this);
-  }
-
-  @Override
-  public void clear() {
-    this.message = null;
-  }
-
-  public String getMessage() {
-    return this.message;
-  }
-
-  public CredentialStoreException setMessage(String message) {
-    this.message = message;
-    return this;
-  }
-
-  public void unsetMessage() {
-    this.message = null;
-  }
-
-  /** Returns true if field message is set (has been assigned a value) and false otherwise */
-  public boolean isSetMessage() {
-    return this.message != null;
-  }
-
-  public void setMessageIsSet(boolean value) {
-    if (!value) {
-      this.message = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case MESSAGE:
-      if (value == null) {
-        unsetMessage();
-      } else {
-        setMessage((String)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case MESSAGE:
-      return getMessage();
-
-    }
-    throw new IllegalStateException();
-  }
-
-  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
-    switch (field) {
-    case MESSAGE:
-      return isSetMessage();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof CredentialStoreException)
-      return this.equals((CredentialStoreException)that);
-    return false;
-  }
-
-  public boolean equals(CredentialStoreException that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_message = true && this.isSetMessage();
-    boolean that_present_message = true && that.isSetMessage();
-    if (this_present_message || that_present_message) {
-      if (!(this_present_message && that_present_message))
-        return false;
-      if (!this.message.equals(that.message))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return 0;
-  }
-
-  @Override
-  public int compareTo(CredentialStoreException other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-
-    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetMessage()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
-  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-  }
-
-  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("CredentialStoreException(");
-    boolean first = true;
-
-    sb.append("message:");
-    if (this.message == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.message);
-    }
-    first = false;
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    if (message == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'message' was not present! Struct: " + toString());
-    }
-    // check for sub-struct validity
-  }
-
-  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-    try {
-      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-    try {
-      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private static class CredentialStoreExceptionStandardSchemeFactory implements SchemeFactory {
-    public CredentialStoreExceptionStandardScheme getScheme() {
-      return new CredentialStoreExceptionStandardScheme();
-    }
-  }
-
-  private static class CredentialStoreExceptionStandardScheme extends StandardScheme<CredentialStoreException> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, CredentialStoreException struct) throws org.apache.thrift.TException {
-      org.apache.thrift.protocol.TField schemeField;
-      iprot.readStructBegin();
-      while (true)
-      {
-        schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-          break;
-        }
-        switch (schemeField.id) {
-          case 1: // MESSAGE
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.message = iprot.readString();
-              struct.setMessageIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          default:
-            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-        }
-        iprot.readFieldEnd();
-      }
-      iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
-      struct.validate();
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot, CredentialStoreException struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.message != null) {
-        oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
-        oprot.writeString(struct.message);
-        oprot.writeFieldEnd();
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class CredentialStoreExceptionTupleSchemeFactory implements SchemeFactory {
-    public CredentialStoreExceptionTupleScheme getScheme() {
-      return new CredentialStoreExceptionTupleScheme();
-    }
-  }
-
-  private static class CredentialStoreExceptionTupleScheme extends TupleScheme<CredentialStoreException> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, CredentialStoreException struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      oprot.writeString(struct.message);
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, CredentialStoreException struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      struct.message = iprot.readString();
-      struct.setMessageIsSet(true);
-    }
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java
deleted file mode 100644
index 62b6e27..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/CredentialStoreNotifier.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.airavata.credential.store.notifier;/*
- *
- * 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 org.apache.airavata.credential.store.store.CredentialStoreException;
-
-/**
- * This class is used to notify particular entity with expiring credentials.
- * The default implementation uses email messages.
- * User: AmilaJ (amilaj@apache.org)
- * Date: 12/3/13
- * Time: 4:17 PM
- */
-public interface CredentialStoreNotifier {
-
-    /**
-     * The specific notifier implementation needs to implement following method.
-     * This method should actually deliver message to desired entity.
-     * @param message The actual message encapsulated
-     * @throws CredentialStoreException
-     */
-    void notifyMessage(NotificationMessage message) throws CredentialStoreException;
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java
deleted file mode 100644
index 96f0bd9..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/NotificationMessage.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * 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.notifier;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 12/3/13
- * Time: 4:21 PM
- */
-
-/**
- * Encapsulates the notification message.
- * Usually says particular credential is expiring and need to renew.
- */
-public class NotificationMessage {
-
-    protected String message;
-
-    public NotificationMessage(String msg) {
-        this.message = msg;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java
deleted file mode 100644
index de84ae2..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *
- * 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.notifier;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 12/27/13
- * Time: 2:22 PM
- */
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.DBUtil;
-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.notifier.impl.EmailNotificationMessage;
-import org.apache.airavata.credential.store.notifier.impl.EmailNotifier;
-import org.apache.airavata.credential.store.notifier.impl.EmailNotifierConfiguration;
-import org.apache.airavata.credential.store.store.CredentialReader;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
-import org.apache.airavata.credential.store.util.Utility;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-/**
- * This class runs a timer. Periodically it checks for expiring credentials.
- * Then if there are expiring credentials this will send an email.
- */
-public class NotifierBootstrap extends TimerTask {
-
-    private static boolean enabled = false;
-
-    private static String MESSAGE = "Credentials for community user {0} expires at {1}";
-    private static String SUBJECT = "Expiring credentials for user {0}";
-
-    private DBUtil dbUtil;
-
-    private long period;
-
-    protected static Logger log = LoggerFactory.getLogger(NotifierBootstrap.class);
-
-
-    private CredentialStoreNotifier credentialStoreNotifier;
-
-    public NotifierBootstrap(long period, DBUtil db, EmailNotifierConfiguration configuration) {
-        this.period = period;
-
-        // bootstrap
-        if (enabled) {
-            Timer timer = new Timer();
-            timer.scheduleAtFixedRate(this, 0, period);
-        }
-
-        this.dbUtil = db;
-
-        this.credentialStoreNotifier = new EmailNotifier(configuration);
-    }
-
-
-
-    public long getPeriod() {
-        return period;
-    }
-
-    public void setPeriod(long period) {
-        this.period = period;
-    }
-
-    public static boolean isEnabled() {
-        return enabled;
-    }
-
-    public static void setEnabled(boolean enabled) {
-        NotifierBootstrap.enabled = enabled;
-    }
-
-    @Override
-    public void run() {
-
-        if (!enabled)
-            return;
-
-        // retrieve OA4MP credentials
-        try {
-            CredentialReader credentialReader = new CredentialReaderImpl(this.dbUtil);
-            List<Credential> credentials = credentialReader.getAllCredentials();
-
-            for(Credential credential : credentials) {
-                if (credential instanceof CertificateCredential) {
-                    CertificateCredential certificateCredential = (CertificateCredential)credential;
-
-                    Date date = Utility.convertStringToDate(certificateCredential.getNotAfter());
-                    date.setDate(date.getDate() + 1);    // gap is 1 days
-
-                    Date currentDate = new Date();
-                    if (currentDate.after(date)) {
-                        // Send an email
-                        CommunityUser communityUser = certificateCredential.getCommunityUser();
-                        String body =
-                                String.format(MESSAGE, communityUser.getUserName(), certificateCredential.getNotAfter());
-                        String subject = String.format(SUBJECT, communityUser.getUserName());
-                        NotificationMessage notificationMessage
-                                = new EmailNotificationMessage(subject, communityUser.getUserEmail(), body);
-
-                        this.credentialStoreNotifier.notifyMessage(notificationMessage);
-
-                    }
-                }
-            }
-
-        } catch (ApplicationSettingsException e) {
-            log.error("Error configuring email senders.", e);
-        } catch (CredentialStoreException e) {
-            log.error("Error sending emails about credential expiring.", e);
-        } catch (ParseException e) {
-            log.error("Error parsing date time when sending emails", e);
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java
deleted file mode 100644
index ffd84c8..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotificationMessage.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * 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.notifier.impl;
-
-import org.apache.airavata.credential.store.notifier.NotificationMessage;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 12/3/13
- * Time: 5:01 PM
- */
-
-public class EmailNotificationMessage extends NotificationMessage {
-
-    public EmailNotificationMessage(String subject, String senderEmail, String msg) {
-        super(msg);
-        this.subject = subject;
-        this.senderEmail = senderEmail;
-    }
-
-    private String subject;
-    private String senderEmail;
-
-    public String getSubject() {
-        return subject;
-    }
-
-    public void setSubject(String subject) {
-        this.subject = subject;
-    }
-
-    public String getSenderEmail() {
-        return senderEmail;
-    }
-
-    public void setSenderEmail(String senderEmail) {
-        this.senderEmail = senderEmail;
-    }
-}


[15/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
deleted file mode 100644
index 5d9c05c..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
+++ /dev/null
@@ -1,6888 +0,0 @@
-    /*
-     * 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.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.credential.store.cpi;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class CredentialStoreService {
-
-  public interface Iface {
-
-    /**
-     * Query CS server to fetch the CPI version
-     */
-    public String getCSServiceVersion() throws org.apache.thrift.TException;
-
-    /**
-     * This method is to add SSHCredential which will return the token Id in success
-     * 
-     * 
-     * @param sshCredential
-     */
-    public String addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
-
-    public String addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
-
-    public String addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
-
-    public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
-
-    public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
-
-    public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
-
-  }
-
-  public interface AsyncIface {
-
-    public void getCSServiceVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
-    public void addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
-    public void addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
-    public void addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
-    public void getSSHCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
-    public void getCertificateCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
-    public void getPasswordCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
-  }
-
-  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
-    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
-      public Factory() {}
-      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
-        return new Client(prot);
-      }
-      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
-        return new Client(iprot, oprot);
-      }
-    }
-
-    public Client(org.apache.thrift.protocol.TProtocol prot)
-    {
-      super(prot, prot);
-    }
-
-    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
-      super(iprot, oprot);
-    }
-
-    public String getCSServiceVersion() throws org.apache.thrift.TException
-    {
-      send_getCSServiceVersion();
-      return recv_getCSServiceVersion();
-    }
-
-    public void send_getCSServiceVersion() throws org.apache.thrift.TException
-    {
-      getCSServiceVersion_args args = new getCSServiceVersion_args();
-      sendBase("getCSServiceVersion", args);
-    }
-
-    public String recv_getCSServiceVersion() throws org.apache.thrift.TException
-    {
-      getCSServiceVersion_result result = new getCSServiceVersion_result();
-      receiveBase(result, "getCSServiceVersion");
-      if (result.isSetSuccess()) {
-        return result.success;
-      }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCSServiceVersion failed: unknown result");
-    }
-
-    public String addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      send_addSSHCredential(sshCredential);
-      return recv_addSSHCredential();
-    }
-
-    public void send_addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) throws org.apache.thrift.TException
-    {
-      addSSHCredential_args args = new addSSHCredential_args();
-      args.setSshCredential(sshCredential);
-      sendBase("addSSHCredential", args);
-    }
-
-    public String recv_addSSHCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      addSSHCredential_result result = new addSSHCredential_result();
-      receiveBase(result, "addSSHCredential");
-      if (result.isSetSuccess()) {
-        return result.success;
-      }
-      if (result.csException != null) {
-        throw result.csException;
-      }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addSSHCredential failed: unknown result");
-    }
-
-    public String addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      send_addCertificateCredential(certificateCredential);
-      return recv_addCertificateCredential();
-    }
-
-    public void send_addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential) throws org.apache.thrift.TException
-    {
-      addCertificateCredential_args args = new addCertificateCredential_args();
-      args.setCertificateCredential(certificateCredential);
-      sendBase("addCertificateCredential", args);
-    }
-
-    public String recv_addCertificateCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      addCertificateCredential_result result = new addCertificateCredential_result();
-      receiveBase(result, "addCertificateCredential");
-      if (result.isSetSuccess()) {
-        return result.success;
-      }
-      if (result.csException != null) {
-        throw result.csException;
-      }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addCertificateCredential failed: unknown result");
-    }
-
-    public String addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      send_addPasswordCredential(passwordCredential);
-      return recv_addPasswordCredential();
-    }
-
-    public void send_addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.thrift.TException
-    {
-      addPasswordCredential_args args = new addPasswordCredential_args();
-      args.setPasswordCredential(passwordCredential);
-      sendBase("addPasswordCredential", args);
-    }
-
-    public String recv_addPasswordCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      addPasswordCredential_result result = new addPasswordCredential_result();
-      receiveBase(result, "addPasswordCredential");
-      if (result.isSetSuccess()) {
-        return result.success;
-      }
-      if (result.csException != null) {
-        throw result.csException;
-      }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addPasswordCredential failed: unknown result");
-    }
-
-    public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      send_getSSHCredential(tokenId, gatewayId);
-      return recv_getSSHCredential();
-    }
-
-    public void send_getSSHCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException
-    {
-      getSSHCredential_args args = new getSSHCredential_args();
-      args.setTokenId(tokenId);
-      args.setGatewayId(gatewayId);
-      sendBase("getSSHCredential", args);
-    }
-
-    public org.apache.airavata.credential.store.datamodel.SSHCredential recv_getSSHCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      getSSHCredential_result result = new getSSHCredential_result();
-      receiveBase(result, "getSSHCredential");
-      if (result.isSetSuccess()) {
-        return result.success;
-      }
-      if (result.csException != null) {
-        throw result.csException;
-      }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getSSHCredential failed: unknown result");
-    }
-
-    public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      send_getCertificateCredential(tokenId, gatewayId);
-      return recv_getCertificateCredential();
-    }
-
-    public void send_getCertificateCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException
-    {
-      getCertificateCredential_args args = new getCertificateCredential_args();
-      args.setTokenId(tokenId);
-      args.setGatewayId(gatewayId);
-      sendBase("getCertificateCredential", args);
-    }
-
-    public org.apache.airavata.credential.store.datamodel.CertificateCredential recv_getCertificateCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      getCertificateCredential_result result = new getCertificateCredential_result();
-      receiveBase(result, "getCertificateCredential");
-      if (result.isSetSuccess()) {
-        return result.success;
-      }
-      if (result.csException != null) {
-        throw result.csException;
-      }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCertificateCredential failed: unknown result");
-    }
-
-    public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      send_getPasswordCredential(tokenId, gatewayId);
-      return recv_getPasswordCredential();
-    }
-
-    public void send_getPasswordCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException
-    {
-      getPasswordCredential_args args = new getPasswordCredential_args();
-      args.setTokenId(tokenId);
-      args.setGatewayId(gatewayId);
-      sendBase("getPasswordCredential", args);
-    }
-
-    public org.apache.airavata.credential.store.datamodel.PasswordCredential recv_getPasswordCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
-    {
-      getPasswordCredential_result result = new getPasswordCredential_result();
-      receiveBase(result, "getPasswordCredential");
-      if (result.isSetSuccess()) {
-        return result.success;
-      }
-      if (result.csException != null) {
-        throw result.csException;
-      }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPasswordCredential failed: unknown result");
-    }
-
-  }
-  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
-    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
-      private org.apache.thrift.async.TAsyncClientManager clientManager;
-      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
-      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
-        this.clientManager = clientManager;
-        this.protocolFactory = protocolFactory;
-      }
-      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
-        return new AsyncClient(protocolFactory, clientManager, transport);
-      }
-    }
-
-    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
-      super(protocolFactory, clientManager, transport);
-    }
-
-    public void getCSServiceVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      getCSServiceVersion_call method_call = new getCSServiceVersion_call(resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class getCSServiceVersion_call extends org.apache.thrift.async.TAsyncMethodCall {
-      public getCSServiceVersion_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
-        super(client, protocolFactory, transport, resultHandler, false);
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCSServiceVersion", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        getCSServiceVersion_args args = new getCSServiceVersion_args();
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public String getResult() throws org.apache.thrift.TException {
-        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
-          throw new IllegalStateException("Method call not finished!");
-        }
-        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
-        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        return (new Client(prot)).recv_getCSServiceVersion();
-      }
-    }
-
-    public void addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      addSSHCredential_call method_call = new addSSHCredential_call(sshCredential, resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class addSSHCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential;
-      public addSSHCredential_call(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
-        super(client, protocolFactory, transport, resultHandler, false);
-        this.sshCredential = sshCredential;
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addSSHCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        addSSHCredential_args args = new addSSHCredential_args();
-        args.setSshCredential(sshCredential);
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public String getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
-        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
-          throw new IllegalStateException("Method call not finished!");
-        }
-        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
-        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        return (new Client(prot)).recv_addSSHCredential();
-      }
-    }
-
-    public void addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      addCertificateCredential_call method_call = new addCertificateCredential_call(certificateCredential, resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class addCertificateCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential;
-      public addCertificateCredential_call(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
-        super(client, protocolFactory, transport, resultHandler, false);
-        this.certificateCredential = certificateCredential;
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addCertificateCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        addCertificateCredential_args args = new addCertificateCredential_args();
-        args.setCertificateCredential(certificateCredential);
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public String getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
-        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
-          throw new IllegalStateException("Method call not finished!");
-        }
-        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
-        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        return (new Client(prot)).recv_addCertificateCredential();
-      }
-    }
-
-    public void addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      addPasswordCredential_call method_call = new addPasswordCredential_call(passwordCredential, resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class addPasswordCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential;
-      public addPasswordCredential_call(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
-        super(client, protocolFactory, transport, resultHandler, false);
-        this.passwordCredential = passwordCredential;
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addPasswordCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        addPasswordCredential_args args = new addPasswordCredential_args();
-        args.setPasswordCredential(passwordCredential);
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public String getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
-        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
-          throw new IllegalStateException("Method call not finished!");
-        }
-        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
-        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        return (new Client(prot)).recv_addPasswordCredential();
-      }
-    }
-
-    public void getSSHCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      getSSHCredential_call method_call = new getSSHCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class getSSHCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private String tokenId;
-      private String gatewayId;
-      public getSSHCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
-        super(client, protocolFactory, transport, resultHandler, false);
-        this.tokenId = tokenId;
-        this.gatewayId = gatewayId;
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getSSHCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        getSSHCredential_args args = new getSSHCredential_args();
-        args.setTokenId(tokenId);
-        args.setGatewayId(gatewayId);
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public org.apache.airavata.credential.store.datamodel.SSHCredential getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
-        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
-          throw new IllegalStateException("Method call not finished!");
-        }
-        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
-        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        return (new Client(prot)).recv_getSSHCredential();
-      }
-    }
-
-    public void getCertificateCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      getCertificateCredential_call method_call = new getCertificateCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class getCertificateCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private String tokenId;
-      private String gatewayId;
-      public getCertificateCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
-        super(client, protocolFactory, transport, resultHandler, false);
-        this.tokenId = tokenId;
-        this.gatewayId = gatewayId;
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCertificateCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        getCertificateCredential_args args = new getCertificateCredential_args();
-        args.setTokenId(tokenId);
-        args.setGatewayId(gatewayId);
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public org.apache.airavata.credential.store.datamodel.CertificateCredential getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
-        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
-          throw new IllegalStateException("Method call not finished!");
-        }
-        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
-        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        return (new Client(prot)).recv_getCertificateCredential();
-      }
-    }
-
-    public void getPasswordCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      getPasswordCredential_call method_call = new getPasswordCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class getPasswordCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private String tokenId;
-      private String gatewayId;
-      public getPasswordCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
-        super(client, protocolFactory, transport, resultHandler, false);
-        this.tokenId = tokenId;
-        this.gatewayId = gatewayId;
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPasswordCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        getPasswordCredential_args args = new getPasswordCredential_args();
-        args.setTokenId(tokenId);
-        args.setGatewayId(gatewayId);
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public org.apache.airavata.credential.store.datamodel.PasswordCredential getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
-        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
-          throw new IllegalStateException("Method call not finished!");
-        }
-        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
-        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        return (new Client(prot)).recv_getPasswordCredential();
-      }
-    }
-
-  }
-
-  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
-    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
-    public Processor(I iface) {
-      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
-    }
-
-    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
-      super(iface, getProcessMap(processMap));
-    }
-
-    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
-      processMap.put("getCSServiceVersion", new getCSServiceVersion());
-      processMap.put("addSSHCredential", new addSSHCredential());
-      processMap.put("addCertificateCredential", new addCertificateCredential());
-      processMap.put("addPasswordCredential", new addPasswordCredential());
-      processMap.put("getSSHCredential", new getSSHCredential());
-      processMap.put("getCertificateCredential", new getCertificateCredential());
-      processMap.put("getPasswordCredential", new getPasswordCredential());
-      return processMap;
-    }
-
-    public static class getCSServiceVersion<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getCSServiceVersion_args> {
-      public getCSServiceVersion() {
-        super("getCSServiceVersion");
-      }
-
-      public getCSServiceVersion_args getEmptyArgsInstance() {
-        return new getCSServiceVersion_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public getCSServiceVersion_result getResult(I iface, getCSServiceVersion_args args) throws org.apache.thrift.TException {
-        getCSServiceVersion_result result = new getCSServiceVersion_result();
-        result.success = iface.getCSServiceVersion();
-        return result;
-      }
-    }
-
-    public static class addSSHCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addSSHCredential_args> {
-      public addSSHCredential() {
-        super("addSSHCredential");
-      }
-
-      public addSSHCredential_args getEmptyArgsInstance() {
-        return new addSSHCredential_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public addSSHCredential_result getResult(I iface, addSSHCredential_args args) throws org.apache.thrift.TException {
-        addSSHCredential_result result = new addSSHCredential_result();
-        try {
-          result.success = iface.addSSHCredential(args.sshCredential);
-        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
-          result.csException = csException;
-        }
-        return result;
-      }
-    }
-
-    public static class addCertificateCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addCertificateCredential_args> {
-      public addCertificateCredential() {
-        super("addCertificateCredential");
-      }
-
-      public addCertificateCredential_args getEmptyArgsInstance() {
-        return new addCertificateCredential_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public addCertificateCredential_result getResult(I iface, addCertificateCredential_args args) throws org.apache.thrift.TException {
-        addCertificateCredential_result result = new addCertificateCredential_result();
-        try {
-          result.success = iface.addCertificateCredential(args.certificateCredential);
-        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
-          result.csException = csException;
-        }
-        return result;
-      }
-    }
-
-    public static class addPasswordCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addPasswordCredential_args> {
-      public addPasswordCredential() {
-        super("addPasswordCredential");
-      }
-
-      public addPasswordCredential_args getEmptyArgsInstance() {
-        return new addPasswordCredential_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public addPasswordCredential_result getResult(I iface, addPasswordCredential_args args) throws org.apache.thrift.TException {
-        addPasswordCredential_result result = new addPasswordCredential_result();
-        try {
-          result.success = iface.addPasswordCredential(args.passwordCredential);
-        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
-          result.csException = csException;
-        }
-        return result;
-      }
-    }
-
-    public static class getSSHCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getSSHCredential_args> {
-      public getSSHCredential() {
-        super("getSSHCredential");
-      }
-
-      public getSSHCredential_args getEmptyArgsInstance() {
-        return new getSSHCredential_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public getSSHCredential_result getResult(I iface, getSSHCredential_args args) throws org.apache.thrift.TException {
-        getSSHCredential_result result = new getSSHCredential_result();
-        try {
-          result.success = iface.getSSHCredential(args.tokenId, args.gatewayId);
-        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
-          result.csException = csException;
-        }
-        return result;
-      }
-    }
-
-    public static class getCertificateCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getCertificateCredential_args> {
-      public getCertificateCredential() {
-        super("getCertificateCredential");
-      }
-
-      public getCertificateCredential_args getEmptyArgsInstance() {
-        return new getCertificateCredential_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public getCertificateCredential_result getResult(I iface, getCertificateCredential_args args) throws org.apache.thrift.TException {
-        getCertificateCredential_result result = new getCertificateCredential_result();
-        try {
-          result.success = iface.getCertificateCredential(args.tokenId, args.gatewayId);
-        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
-          result.csException = csException;
-        }
-        return result;
-      }
-    }
-
-    public static class getPasswordCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getPasswordCredential_args> {
-      public getPasswordCredential() {
-        super("getPasswordCredential");
-      }
-
-      public getPasswordCredential_args getEmptyArgsInstance() {
-        return new getPasswordCredential_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public getPasswordCredential_result getResult(I iface, getPasswordCredential_args args) throws org.apache.thrift.TException {
-        getPasswordCredential_result result = new getPasswordCredential_result();
-        try {
-          result.success = iface.getPasswordCredential(args.tokenId, args.gatewayId);
-        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
-          result.csException = csException;
-        }
-        return result;
-      }
-    }
-
-  }
-
-  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
-    public AsyncProcessor(I iface) {
-      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
-    }
-
-    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
-      super(iface, getProcessMap(processMap));
-    }
-
-    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
-      processMap.put("getCSServiceVersion", new getCSServiceVersion());
-      processMap.put("addSSHCredential", new addSSHCredential());
-      processMap.put("addCertificateCredential", new addCertificateCredential());
-      processMap.put("addPasswordCredential", new addPasswordCredential());
-      processMap.put("getSSHCredential", new getSSHCredential());
-      processMap.put("getCertificateCredential", new getCertificateCredential());
-      processMap.put("getPasswordCredential", new getPasswordCredential());
-      return processMap;
-    }
-
-    public static class getCSServiceVersion<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getCSServiceVersion_args, String> {
-      public getCSServiceVersion() {
-        super("getCSServiceVersion");
-      }
-
-      public getCSServiceVersion_args getEmptyArgsInstance() {
-        return new getCSServiceVersion_args();
-      }
-
-      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
-        final org.apache.thrift.AsyncProcessFunction fcall = this;
-        return new AsyncMethodCallback<String>() { 
-          public void onComplete(String o) {
-            getCSServiceVersion_result result = new getCSServiceVersion_result();
-            result.success = o;
-            try {
-              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
-              return;
-            } catch (Exception e) {
-              LOGGER.error("Exception writing to internal frame buffer", e);
-            }
-            fb.close();
-          }
-          public void onError(Exception e) {
-            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
-            org.apache.thrift.TBase msg;
-            getCSServiceVersion_result result = new getCSServiceVersion_result();
-            {
-              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
-              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
-            }
-            try {
-              fcall.sendResponse(fb,msg,msgType,seqid);
-              return;
-            } catch (Exception ex) {
-              LOGGER.error("Exception writing to internal frame buffer", ex);
-            }
-            fb.close();
-          }
-        };
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public void start(I iface, getCSServiceVersion_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
-        iface.getCSServiceVersion(resultHandler);
-      }
-    }
-
-    public static class addSSHCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addSSHCredential_args, String> {
-      public addSSHCredential() {
-        super("addSSHCredential");
-      }
-
-      public addSSHCredential_args getEmptyArgsInstance() {
-        return new addSSHCredential_args();
-      }
-
-      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
-        final org.apache.thrift.AsyncProcessFunction fcall = this;
-        return new AsyncMethodCallback<String>() { 
-          public void onComplete(String o) {
-            addSSHCredential_result result = new addSSHCredential_result();
-            result.success = o;
-            try {
-              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
-              return;
-            } catch (Exception e) {
-              LOGGER.error("Exception writing to internal frame buffer", e);
-            }
-            fb.close();
-          }
-          public void onError(Exception e) {
-            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
-            org.apache.thrift.TBase msg;
-            addSSHCredential_result result = new addSSHCredential_result();
-            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
-                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
-                        result.setCsExceptionIsSet(true);
-                        msg = result;
-            }
-             else 
-            {
-              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
-              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
-            }
-            try {
-              fcall.sendResponse(fb,msg,msgType,seqid);
-              return;
-            } catch (Exception ex) {
-              LOGGER.error("Exception writing to internal frame buffer", ex);
-            }
-            fb.close();
-          }
-        };
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public void start(I iface, addSSHCredential_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
-        iface.addSSHCredential(args.sshCredential,resultHandler);
-      }
-    }
-
-    public static class addCertificateCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addCertificateCredential_args, String> {
-      public addCertificateCredential() {
-        super("addCertificateCredential");
-      }
-
-      public addCertificateCredential_args getEmptyArgsInstance() {
-        return new addCertificateCredential_args();
-      }
-
-      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
-        final org.apache.thrift.AsyncProcessFunction fcall = this;
-        return new AsyncMethodCallback<String>() { 
-          public void onComplete(String o) {
-            addCertificateCredential_result result = new addCertificateCredential_result();
-            result.success = o;
-            try {
-              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
-              return;
-            } catch (Exception e) {
-              LOGGER.error("Exception writing to internal frame buffer", e);
-            }
-            fb.close();
-          }
-          public void onError(Exception e) {
-            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
-            org.apache.thrift.TBase msg;
-            addCertificateCredential_result result = new addCertificateCredential_result();
-            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
-                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
-                        result.setCsExceptionIsSet(true);
-                        msg = result;
-            }
-             else 
-            {
-              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
-              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
-            }
-            try {
-              fcall.sendResponse(fb,msg,msgType,seqid);
-              return;
-            } catch (Exception ex) {
-              LOGGER.error("Exception writing to internal frame buffer", ex);
-            }
-            fb.close();
-          }
-        };
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public void start(I iface, addCertificateCredential_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
-        iface.addCertificateCredential(args.certificateCredential,resultHandler);
-      }
-    }
-
-    public static class addPasswordCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addPasswordCredential_args, String> {
-      public addPasswordCredential() {
-        super("addPasswordCredential");
-      }
-
-      public addPasswordCredential_args getEmptyArgsInstance() {
-        return new addPasswordCredential_args();
-      }
-
-      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
-        final org.apache.thrift.AsyncProcessFunction fcall = this;
-        return new AsyncMethodCallback<String>() { 
-          public void onComplete(String o) {
-            addPasswordCredential_result result = new addPasswordCredential_result();
-            result.success = o;
-            try {
-              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
-              return;
-            } catch (Exception e) {
-              LOGGER.error("Exception writing to internal frame buffer", e);
-            }
-            fb.close();
-          }
-          public void onError(Exception e) {
-            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
-            org.apache.thrift.TBase msg;
-            addPasswordCredential_result result = new addPasswordCredential_result();
-            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
-                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
-                        result.setCsExceptionIsSet(true);
-                        msg = result;
-            }
-             else 
-            {
-              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
-              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
-            }
-            try {
-              fcall.sendResponse(fb,msg,msgType,seqid);
-              return;
-            } catch (Exception ex) {
-              LOGGER.error("Exception writing to internal frame buffer", ex);
-            }
-            fb.close();
-          }
-        };
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public void start(I iface, addPasswordCredential_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
-        iface.addPasswordCredential(args.passwordCredential,resultHandler);
-      }
-    }
-
-    public static class getSSHCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getSSHCredential_args, org.apache.airavata.credential.store.datamodel.SSHCredential> {
-      public getSSHCredential() {
-        super("getSSHCredential");
-      }
-
-      public getSSHCredential_args getEmptyArgsInstance() {
-        return new getSSHCredential_args();
-      }
-
-      public AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
-        final org.apache.thrift.AsyncProcessFunction fcall = this;
-        return new AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential>() { 
-          public void onComplete(org.apache.airavata.credential.store.datamodel.SSHCredential o) {
-            getSSHCredential_result result = new getSSHCredential_result();
-            result.success = o;
-            try {
-              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
-              return;
-            } catch (Exception e) {
-              LOGGER.error("Exception writing to internal frame buffer", e);
-            }
-            fb.close();
-          }
-          public void onError(Exception e) {
-            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
-            org.apache.thrift.TBase msg;
-            getSSHCredential_result result = new getSSHCredential_result();
-            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
-                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
-                        result.setCsExceptionIsSet(true);
-                        msg = result;
-            }
-             else 
-            {
-              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
-              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
-            }
-            try {
-              fcall.sendResponse(fb,msg,msgType,seqid);
-              return;
-            } catch (Exception ex) {
-              LOGGER.error("Exception writing to internal frame buffer", ex);
-            }
-            fb.close();
-          }
-        };
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public void start(I iface, getSSHCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential> resultHandler) throws TException {
-        iface.getSSHCredential(args.tokenId, args.gatewayId,resultHandler);
-      }
-    }
-
-    public static class getCertificateCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getCertificateCredential_args, org.apache.airavata.credential.store.datamodel.CertificateCredential> {
-      public getCertificateCredential() {
-        super("getCertificateCredential");
-      }
-
-      public getCertificateCredential_args getEmptyArgsInstance() {
-        return new getCertificateCredential_args();
-      }
-
-      public AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
-        final org.apache.thrift.AsyncProcessFunction fcall = this;
-        return new AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential>() { 
-          public void onComplete(org.apache.airavata.credential.store.datamodel.CertificateCredential o) {
-            getCertificateCredential_result result = new getCertificateCredential_result();
-            result.success = o;
-            try {
-              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
-              return;
-            } catch (Exception e) {
-              LOGGER.error("Exception writing to internal frame buffer", e);
-            }
-            fb.close();
-          }
-          public void onError(Exception e) {
-            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
-            org.apache.thrift.TBase msg;
-            getCertificateCredential_result result = new getCertificateCredential_result();
-            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
-                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
-                        result.setCsExceptionIsSet(true);
-                        msg = result;
-            }
-             else 
-            {
-              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
-              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
-            }
-            try {
-              fcall.sendResponse(fb,msg,msgType,seqid);
-              return;
-            } catch (Exception ex) {
-              LOGGER.error("Exception writing to internal frame buffer", ex);
-            }
-            fb.close();
-          }
-        };
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public void start(I iface, getCertificateCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential> resultHandler) throws TException {
-        iface.getCertificateCredential(args.tokenId, args.gatewayId,resultHandler);
-      }
-    }
-
-    public static class getPasswordCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getPasswordCredential_args, org.apache.airavata.credential.store.datamodel.PasswordCredential> {
-      public getPasswordCredential() {
-        super("getPasswordCredential");
-      }
-
-      public getPasswordCredential_args getEmptyArgsInstance() {
-        return new getPasswordCredential_args();
-      }
-
-      public AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
-        final org.apache.thrift.AsyncProcessFunction fcall = this;
-        return new AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential>() { 
-          public void onComplete(org.apache.airavata.credential.store.datamodel.PasswordCredential o) {
-            getPasswordCredential_result result = new getPasswordCredential_result();
-            result.success = o;
-            try {
-              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
-              return;
-            } catch (Exception e) {
-              LOGGER.error("Exception writing to internal frame buffer", e);
-            }
-            fb.close();
-          }
-          public void onError(Exception e) {
-            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
-            org.apache.thrift.TBase msg;
-            getPasswordCredential_result result = new getPasswordCredential_result();
-            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
-                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
-                        result.setCsExceptionIsSet(true);
-                        msg = result;
-            }
-             else 
-            {
-              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
-              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
-            }
-            try {
-              fcall.sendResponse(fb,msg,msgType,seqid);
-              return;
-            } catch (Exception ex) {
-              LOGGER.error("Exception writing to internal frame buffer", ex);
-            }
-            fb.close();
-          }
-        };
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public void start(I iface, getPasswordCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential> resultHandler) throws TException {
-        iface.getPasswordCredential(args.tokenId, args.gatewayId,resultHandler);
-      }
-    }
-
-  }
-
-  public static class getCSServiceVersion_args implements org.apache.thrift.TBase<getCSServiceVersion_args, getCSServiceVersion_args._Fields>, java.io.Serializable, Cloneable, Comparable<getCSServiceVersion_args>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getCSServiceVersion_args");
-
-
-    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-    static {
-      schemes.put(StandardScheme.class, new getCSServiceVersion_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new getCSServiceVersion_argsTupleSchemeFactory());
-    }
-
-
-    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-;
-
-      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-      static {
-        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-          byName.put(field.getFieldName(), field);
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, or null if its not found.
-       */
-      public static _Fields findByThriftId(int fieldId) {
-        switch(fieldId) {
-          default:
-            return null;
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, throwing an exception
-       * if it is not found.
-       */
-      public static _Fields findByThriftIdOrThrow(int fieldId) {
-        _Fields fields = findByThriftId(fieldId);
-        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-        return fields;
-      }
-
-      /**
-       * Find the _Fields constant that matches name, or null if its not found.
-       */
-      public static _Fields findByName(String name) {
-        return byName.get(name);
-      }
-
-      private final short _thriftId;
-      private final String _fieldName;
-
-      _Fields(short thriftId, String fieldName) {
-        _thriftId = thriftId;
-        _fieldName = fieldName;
-      }
-
-      public short getThriftFieldId() {
-        return _thriftId;
-      }
-
-      public String getFieldName() {
-        return _fieldName;
-      }
-    }
-    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-    static {
-      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCSServiceVersion_args.class, metaDataMap);
-    }
-
-    public getCSServiceVersion_args() {
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public getCSServiceVersion_args(getCSServiceVersion_args other) {
-    }
-
-    public getCSServiceVersion_args deepCopy() {
-      return new getCSServiceVersion_args(this);
-    }
-
-    @Override
-    public void clear() {
-    }
-
-    public void setFieldValue(_Fields field, Object value) {
-      switch (field) {
-      }
-    }
-
-    public Object getFieldValue(_Fields field) {
-      switch (field) {
-      }
-      throw new IllegalStateException();
-    }
-
-    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-    public boolean isSet(_Fields field) {
-      if (field == null) {
-        throw new IllegalArgumentException();
-      }
-
-      switch (field) {
-      }
-      throw new IllegalStateException();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-      if (that == null)
-        return false;
-      if (that instanceof getCSServiceVersion_args)
-        return this.equals((getCSServiceVersion_args)that);
-      return false;
-    }
-
-    public boolean equals(getCSServiceVersion_args that) {
-      if (that == null)
-        return false;
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      return 0;
-    }
-
-    @Override
-    public int compareTo(getCSServiceVersion_args other) {
-      if (!getClass().equals(other.getClass())) {
-        return getClass().getName().compareTo(other.getClass().getName());
-      }
-
-      int lastComparison = 0;
-
-      return 0;
-    }
-
-    public _Fields fieldForId(int fieldId) {
-      return _Fields.findByThriftId(fieldId);
-    }
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-    }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("getCSServiceVersion_args(");
-      boolean first = true;
-
-      sb.append(")");
-      return sb.toString();
-    }
-
-    public void validate() throws org.apache.thrift.TException {
-      // check for required fields
-      // check for sub-struct validity
-    }
-
-    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-      try {
-        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-      try {
-        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private static class getCSServiceVersion_argsStandardSchemeFactory implements SchemeFactory {
-      public getCSServiceVersion_argsStandardScheme getScheme() {
-        return new getCSServiceVersion_argsStandardScheme();
-      }
-    }
-
-    private static class getCSServiceVersion_argsStandardScheme extends StandardScheme<getCSServiceVersion_args> {
-
-      public void read(org.apache.thrift.protocol.TProtocol iprot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
-        org.apache.thrift.protocol.TField schemeField;
-        iprot.readStructBegin();
-        while (true)
-        {
-          schemeField = iprot.readFieldBegin();
-          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-            break;
-          }
-          switch (schemeField.id) {
-            default:
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-          }
-          iprot.readFieldEnd();
-        }
-        iprot.readStructEnd();
-
-        // check for required fields of primitive type, which can't be checked in the validate method
-        struct.validate();
-      }
-
-      public void write(org.apache.thrift.protocol.TProtocol oprot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
-        struct.validate();
-
-        oprot.writeStructBegin(STRUCT_DESC);
-        oprot.writeFieldStop();
-        oprot.writeStructEnd();
-      }
-
-    }
-
-    private static class getCSServiceVersion_argsTupleSchemeFactory implements SchemeFactory {
-      public getCSServiceVersion_argsTupleScheme getScheme() {
-        return new getCSServiceVersion_argsTupleScheme();
-      }
-    }
-
-    private static class getCSServiceVersion_argsTupleScheme extends TupleScheme<getCSServiceVersion_args> {
-
-      @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol oprot = (TTupleProtocol) prot;
-      }
-
-      @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol iprot = (TTupleProtocol) prot;
-      }
-    }
-
-  }
-
-  public static class getCSServiceVersion_result implements org.apache.thrift.TBase<getCSServiceVersion_result, getCSServiceVersion_result._Fields>, java.io.Serializable, Cloneable, Comparable<getCSServiceVersion_result>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getCSServiceVersion_result");
-
-    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
-
-    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-    static {
-      schemes.put(StandardScheme.class, new getCSServiceVersion_resultStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new getCSServiceVersion_resultTupleSchemeFactory());
-    }
-
-    public String success; // required
-
-    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-      SUCCESS((short)0, "success");
-
-      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-      static {
-        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-          byName.put(field.getFieldName(), field);
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, or null if its not found.
-       */
-      public static _Fields findByThriftId(int fieldId) {
-        switch(fieldId) {
-          case 0: // SUCCESS
-            return SUCCESS;
-          default:
-            return null;
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, throwing an exception
-       * if it is not found.
-       */
-      public static _Fields findByThriftIdOrThrow(int fieldId) {
-        _Fields fields = findByThriftId(fieldId);
-        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-        return fields;
-      }
-
-      /**
-       * Find the _Fields constant that matches name, or null if its not found.
-       */
-      public static _Fields findByName(String name) {
-        return byName.get(name);
-      }
-
-      private final short _thriftId;
-      private final String _fieldName;
-
-      _Fields(short thriftId, String fieldName) {
-        _thriftId = thriftId;
-        _fieldName = fieldName;
-      }
-
-      public short getThriftFieldId() {
-        return _thriftId;
-      }
-
-      public String getFieldName() {
-        return _fieldName;
-      }
-    }
-
-    // isset id assignments
-    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-    static {
-      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCSServiceVersion_result.class, metaDataMap);
-    }
-
-    public getCSServiceVersion_result() {
-    }
-
-    public getCSServiceVersion_result(
-      String success)
-    {
-      this();
-      this.success = success;
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public getCSServiceVersion_result(getCSServiceVersion_result other) {
-      if (other.isSetSuccess()) {
-        this.success = other.success;
-      }
-    }
-
-    public getCSServiceVersion_result deepCopy() {
-      return new getCSServiceVersion_result(this);
-    }
-
-    @Override
-    public void clear() {
-      this.success = null;
-    }
-
-    public String getSuccess() {
-      return this.success;
-    }
-
-    public getCSServiceVersion_result setSuccess(String success) {
-      this.success = success;
-      return this;
-    }
-
-    public void unsetSuccess() {
-      this.success = null;
-    }
-
-    /** Returns true if field success is set (has been assigned a value) and false otherwise */
-    public boolean isSetSuccess() {
-      return this.success != null;
-    }
-
-    public void setSuccessIsSet(boolean value) {
-      if (!value) {
-        this.success = null;
-      }
-    }
-
-    public void setFieldValue(_Fields field, Object value) {
-      switch (field) {
-      case SUCCESS:
-        if (value == null) {
-          unsetSuccess();
-        } else {
-          setSuccess((String)value);
-        }
-        break;
-
-      }
-    }
-
-    public Object getFieldValue(_Fields field) {
-      switch (field) {
-      case SUCCESS:
-        return getSuccess();
-
-      }
-      throw new IllegalStateException();
-    }
-
-    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-    public boolean isSet(_Fields field) {
-      if (field == null) {
-        throw new IllegalArgumentException();
-      }
-
-      switch (field) {
-      case SUCCESS:
-        return isSetSuccess();
-      }
-      throw new IllegalStateException();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-      if (that == null)
-        return false;
-      if (that instanceof getCSServiceVersion_result)
-        return this.equals((getCSServiceVersion_result)that);
-      return false;
-    }
-
-    public boolean equals(getCSServiceVersion_result that) {
-      if (that == null)
-        return false;
-
-      boolean this_present_success = true && this.isSetSuccess();
-      boolean that_present_success = true && that.isSetSuccess();
-      if (this_present_success || that_present_success) {
-        if (!(this_present_success && that_present_success))
-          return false;
-        if (!this.success.equals(that.success))
-          return false;
-      }
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      return 0;
-    }
-
-    @Override
-    public int compareTo(getCSServiceVersion_result other) {
-      if (!getClass().equals(other.getClass())) {
-        return getClass().getName().compareTo(other.getClass().getName());
-      }
-
-      int lastComparison = 0;
-
-      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-      if (isSetSuccess()) {
-        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
-        if (lastComparison != 0) {
-          return lastComparison;
-        }
-      }
-      return 0;
-    }
-
-    public _Fields fieldForId(int fieldId) {
-      return _Fields.findByThriftId(fieldId);
-    }
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-      }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("getCSServiceVersion_result(");
-      boolean first = true;
-
-      sb.append("success:");
-      if (this.success == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.success);
-      }
-      first = false;
-      sb.append(")");
-      return sb.toString();
-    }
-
-    public void validate() throws org.apache.thrift.TException {
-      // check for required fields
-      // check for sub-struct validity
-    }
-
-    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-      try {
-        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-      try {
-        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private static class getCSServiceVersion_resultStandardSchemeFactory implements SchemeFactory {
-      public getCSServiceVersion_resultStandardScheme getScheme() {
-        return new getCSServiceVersion_resultStandardScheme();
-      }
-    }
-
-    private static class getCSServiceVersion_resultStandardScheme extends StandardScheme<getCSServiceVersion_result> {
-
-      public void read(org.apache.thrift.protocol.TProtocol iprot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
-        org.apache.thrift.protocol.TField schemeField;
-        iprot.readStructBegin();
-        while (true)
-        {
-          schemeField = iprot.readFieldBegin();
-          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-            break;
-          }
-          switch (schemeField.id) {
-            case 0: // SUCCESS
-              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-                struct.success = iprot.readString();
-                struct.setSuccessIsSet(true);
-              } else { 
-                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-              }
-              break;
-            default:
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-          }
-          iprot.readFieldEnd();
-        }
-        iprot.readStructEnd();
-
-        // check for required fields of primitive type, which can't be checked in the validate method
-        struct.validate();
-      }
-
-      public void write(org.apache.thrift.protocol.TProtocol oprot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
-        struct.validate();
-
-        oprot.writeStructBegin(STRUCT_DESC);
-        if (struct.success != null) {
-          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
-          oprot.writeString(struct.success);
-          oprot.writeFieldEnd();
-        }
-        oprot.writeFieldStop();
-        oprot.writeStructEnd();
-      }
-
-    }
-
-    private static class getCSServiceVersion_resultTupleSchemeFactory implements SchemeFactory {
-      public getCSServiceVersion_resultTupleScheme getScheme() {
-        return new getCSServiceVersion_resultTupleScheme();
-      }
-    }
-
-    private static class getCSServiceVersion_resultTupleScheme extends TupleScheme<getCSServiceVersion_result> {
-
-      @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
-        TTupleProtocol oprot = (TTupleProtocol) prot;
-        BitSet optionals = new BitSet();
-        if (struct.isSetSuccess()) {
-          optionals.set(0);
-        }
-        oprot.writeBitSet(optionals, 1);
-        if (struct.isSetSuccess()) {
-          oprot.writeString(struct.success);
-        }
-      }
-
-      @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
-        TTupleProtocol iprot = (TTupleProtocol) prot;
-        BitSet incoming = iprot.readBitSet(1);
-        if (incoming.get(0)) {
-          struct.success = iprot.readString();
-          struct.setSuccessIsSet(true);
-        }
-      }
-    }
-
-  }
-
-  public static class addSSHCredential_args implements org.apache.thrift.TBase<addSSHCredential_args, addSSHCredential_args._Fields>, java.io.Serializable, Cloneable, Comparable<addSSHCredential_args>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("addSSHCredential_args");
-
-    private static final org.apache.thrift.protocol.TField SSH_CREDENTIAL_FIELD_DESC = new org.apache.thrift.protocol.TField("sshCredential", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
-    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-    static {
-      schemes.put(StandardScheme.class, new addSSHCredential_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new addSSHCredential_argsTupleSchemeFactory());
-    }
-
-    public org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential; // required
-
-    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-      SSH_CREDENTIAL((short)1, "sshCredential");
-
-      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-      static {
-        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-          byName.put(field.getFieldName(), field);
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, or null if its not found.
-       */
-      public static _Fields findByThriftId(int fieldId) {
-        switch(fieldId) {
-          case 1: // SSH_CREDENTIAL
-            return SSH_CREDENTIAL;
-          default:
-            return null;
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, throwing an exception
-       * if it is not found.
-       */
-      public static _Fields findByThriftIdOrThrow(int fieldId) {
-        _Fields fields = findByThriftId(fieldId);
-        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-        return fields;
-      }
-
-      /**
-       * Find the _Fields constant that matches name, or null if its not found.
-       */
-      public static _Fields findByName(String name) {
-        return byName.get(name);
-      }
-
-      private final short _thriftId;
-      private final String _fieldName;
-
-      _Fields(short thriftId, String fieldName) {
-        _thriftId = thriftId;
-        _fieldName = fieldName;
-      }
-
-      public short getThriftFieldId() {
-        return _thriftId;
-      }
-
-      public String getFieldName() {
-        return _fieldName;
-      }
-    }
-
-    // isset id assignments
-    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-    static {
-      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-      tmpMap.put(_Fields.SSH_CREDENTIAL, new org.apache.thrift.meta_data.FieldMetaData("sshCredential", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.credential.store.datamodel.SSHCredential.class)));
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(addSSHCredential_args.class, metaDataMap);
-    }
-
-    public addSSHCredential_args() {
-    }
-
-    public addSSHCredential_args(
-      org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential)
-    {
-      this();
-      this.sshCredential = sshCredential;
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public addSSHCredential_args(addSSHCredential_args other) {
-      if (other.isSetSshCredential()) {
-        this.sshCredential = new org.apache.airavata.credential.store.datamodel.SSHCredential(other.sshCredential);
-      }
-    }
-
-    public addSSHCredential_args deepCopy() {
-      return new addSSHCredential_args(this);
-    }
-
-    @Override
-    public void clear() {
-      this.sshCredential = null;
-    }
-
-    public org.apache.airavata.credential.store.datamodel.SSHCredential getSshCredential() {
-      return this.sshCredential;
-    }
-
-    public addSSHCredential_args setSshCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) {
-      this.sshCredential = sshCredential;
-      return this;
-    }
-
-    public void unsetSshCredential() {
-      this.sshCredential = null;
-    }
-
-    /** Returns true if field sshCredential is set (has been assigned a value) and false otherwise */
-    public boolean isSetSshCredential() {
-      return this.sshCredential != null;
-    }
-
-    public void setSshCredentialIsSet(boolean value) {
-      if (!value) {
-        this.sshCredential = null;
-      }
-    }
-
-    public void setFieldValue(_Fields field, Object value) {
-      switch (field) {
-      case SSH_CREDENTIAL:
-        if (value == null) {
-          unsetSshCredential();
-        } else {
-          setSshCredential((org.apache.airavata.credential.store.datamodel.SSHCredential)value);
-        }
-        break;
-
-      }
-    }
-
-    public Object getFieldValue(_Fields field) {
-      switch (field) {
-      case SSH_CREDENTIAL:
-        return getSshCredential();
-
-      }
-      throw new IllegalStateException();
-    }
-
-    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-    public boolean isSet(_Fields field) {
-      if (field == null) {
-        throw new IllegalArgumentException();
-      }
-
-      switch (field) {
-      case SSH_CREDENTIAL:
-        return isSetSshCredential();
-      }
-      throw new IllegalStateException();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-      if (that == null)
-        return false;
-      if (that instanceof addSSHCredential_args)
-        return this.equals((addSSHCredential_args)that);
-      return false;
-    }
-
-    public boolean equals(addSSHCredential_args that) {
-      if (that == null)
-        return false;
-
-      boolean this_present_sshCredential = true && this.isSetSshCredential();
-      boolean that_present_sshCredential = true && that.isSetSshCredential();
-      if (this_present_sshCredential || that_present_sshCredential) {
-        if (!(this_present_sshCredential && that_present_sshCredential))
-          return false;
-        if (!this.sshCredential.equals(that.sshCredential))
-          return false;
-      }
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      return 0;
-    }
-
-    @Override
-    public int compareTo(addSSHCredential_args other) {
-      if (!getClass().equals(other.getClass())) {
-        return getClass().getName().compareTo(other.getClass().getName());
-      }
-
-      int lastComparison = 0;
-
-      lastComparison = Boolean.valueOf(isSetSshCredential()).compareTo(other.isSetSshCredential());
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-      if (isSetSshCredential()) {
-        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sshCredential, other.sshCredential);
-        if (lastComparison != 0) {
-          return lastComparison;
-        }
-      }
-      return 0;
-    }
-
-    public _Fields fieldForId(int fieldId) {
-      return _Fields.findByThriftId(fieldId);
-    }
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-    }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("addSSHCredential_args(");
-      boolean first = true;
-
-      sb.append("sshCredential:");
-      if (this.sshCredential == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.sshCredential);
-      }
-      first = false;
-      sb.append(")");
-      return sb.toString();
-    }
-
-    public void validate() throws org.apache.thrift.TException {
-      // check for required fields
-      if (sshCredential == null) {
-        throw new org.apache.thrift.protocol.TProtocolException("Required field 'sshCredential' was not present! Struct: " + toString());
-      }
-      // check for sub-struct validity
-      if (sshCredential != null) {
-        sshCredential.validate();
-      }
-    }
-
-    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-      try {
-        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    p

<TRUNCATED>

[02/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
new file mode 100644
index 0000000..9fc373a
--- /dev/null
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
@@ -0,0 +1,998 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class SSHCredential implements org.apache.thrift.TBase<SSHCredential, SSHCredential._Fields>, java.io.Serializable, Cloneable, Comparable<SSHCredential> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SSHCredential");
+
+  private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField PASSPHRASE_FIELD_DESC = new org.apache.thrift.protocol.TField("passphrase", org.apache.thrift.protocol.TType.STRING, (short)3);
+  private static final org.apache.thrift.protocol.TField PUBLIC_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("publicKey", org.apache.thrift.protocol.TType.STRING, (short)4);
+  private static final org.apache.thrift.protocol.TField PRIVATE_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("privateKey", org.apache.thrift.protocol.TType.STRING, (short)5);
+  private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)6);
+  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)7);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new SSHCredentialStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new SSHCredentialTupleSchemeFactory());
+  }
+
+  public String gatewayId; // required
+  public String username; // required
+  public String passphrase; // required
+  public String publicKey; // optional
+  public String privateKey; // optional
+  public long persistedTime; // optional
+  public String token; // optional
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    GATEWAY_ID((short)1, "gatewayId"),
+    USERNAME((short)2, "username"),
+    PASSPHRASE((short)3, "passphrase"),
+    PUBLIC_KEY((short)4, "publicKey"),
+    PRIVATE_KEY((short)5, "privateKey"),
+    PERSISTED_TIME((short)6, "persistedTime"),
+    TOKEN((short)7, "token");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // GATEWAY_ID
+          return GATEWAY_ID;
+        case 2: // USERNAME
+          return USERNAME;
+        case 3: // PASSPHRASE
+          return PASSPHRASE;
+        case 4: // PUBLIC_KEY
+          return PUBLIC_KEY;
+        case 5: // PRIVATE_KEY
+          return PRIVATE_KEY;
+        case 6: // PERSISTED_TIME
+          return PERSISTED_TIME;
+        case 7: // TOKEN
+          return TOKEN;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __PERSISTEDTIME_ISSET_ID = 0;
+  private byte __isset_bitfield = 0;
+  private _Fields optionals[] = {_Fields.PUBLIC_KEY,_Fields.PRIVATE_KEY,_Fields.PERSISTED_TIME,_Fields.TOKEN};
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PASSPHRASE, new org.apache.thrift.meta_data.FieldMetaData("passphrase", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PUBLIC_KEY, new org.apache.thrift.meta_data.FieldMetaData("publicKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PRIVATE_KEY, new org.apache.thrift.meta_data.FieldMetaData("privateKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SSHCredential.class, metaDataMap);
+  }
+
+  public SSHCredential() {
+  }
+
+  public SSHCredential(
+    String gatewayId,
+    String username,
+    String passphrase)
+  {
+    this();
+    this.gatewayId = gatewayId;
+    this.username = username;
+    this.passphrase = passphrase;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public SSHCredential(SSHCredential other) {
+    __isset_bitfield = other.__isset_bitfield;
+    if (other.isSetGatewayId()) {
+      this.gatewayId = other.gatewayId;
+    }
+    if (other.isSetUsername()) {
+      this.username = other.username;
+    }
+    if (other.isSetPassphrase()) {
+      this.passphrase = other.passphrase;
+    }
+    if (other.isSetPublicKey()) {
+      this.publicKey = other.publicKey;
+    }
+    if (other.isSetPrivateKey()) {
+      this.privateKey = other.privateKey;
+    }
+    this.persistedTime = other.persistedTime;
+    if (other.isSetToken()) {
+      this.token = other.token;
+    }
+  }
+
+  public SSHCredential deepCopy() {
+    return new SSHCredential(this);
+  }
+
+  @Override
+  public void clear() {
+    this.gatewayId = null;
+    this.username = null;
+    this.passphrase = null;
+    this.publicKey = null;
+    this.privateKey = null;
+    setPersistedTimeIsSet(false);
+    this.persistedTime = 0;
+    this.token = null;
+  }
+
+  public String getGatewayId() {
+    return this.gatewayId;
+  }
+
+  public SSHCredential setGatewayId(String gatewayId) {
+    this.gatewayId = gatewayId;
+    return this;
+  }
+
+  public void unsetGatewayId() {
+    this.gatewayId = null;
+  }
+
+  /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */
+  public boolean isSetGatewayId() {
+    return this.gatewayId != null;
+  }
+
+  public void setGatewayIdIsSet(boolean value) {
+    if (!value) {
+      this.gatewayId = null;
+    }
+  }
+
+  public String getUsername() {
+    return this.username;
+  }
+
+  public SSHCredential setUsername(String username) {
+    this.username = username;
+    return this;
+  }
+
+  public void unsetUsername() {
+    this.username = null;
+  }
+
+  /** Returns true if field username is set (has been assigned a value) and false otherwise */
+  public boolean isSetUsername() {
+    return this.username != null;
+  }
+
+  public void setUsernameIsSet(boolean value) {
+    if (!value) {
+      this.username = null;
+    }
+  }
+
+  public String getPassphrase() {
+    return this.passphrase;
+  }
+
+  public SSHCredential setPassphrase(String passphrase) {
+    this.passphrase = passphrase;
+    return this;
+  }
+
+  public void unsetPassphrase() {
+    this.passphrase = null;
+  }
+
+  /** Returns true if field passphrase is set (has been assigned a value) and false otherwise */
+  public boolean isSetPassphrase() {
+    return this.passphrase != null;
+  }
+
+  public void setPassphraseIsSet(boolean value) {
+    if (!value) {
+      this.passphrase = null;
+    }
+  }
+
+  public String getPublicKey() {
+    return this.publicKey;
+  }
+
+  public SSHCredential setPublicKey(String publicKey) {
+    this.publicKey = publicKey;
+    return this;
+  }
+
+  public void unsetPublicKey() {
+    this.publicKey = null;
+  }
+
+  /** Returns true if field publicKey is set (has been assigned a value) and false otherwise */
+  public boolean isSetPublicKey() {
+    return this.publicKey != null;
+  }
+
+  public void setPublicKeyIsSet(boolean value) {
+    if (!value) {
+      this.publicKey = null;
+    }
+  }
+
+  public String getPrivateKey() {
+    return this.privateKey;
+  }
+
+  public SSHCredential setPrivateKey(String privateKey) {
+    this.privateKey = privateKey;
+    return this;
+  }
+
+  public void unsetPrivateKey() {
+    this.privateKey = null;
+  }
+
+  /** Returns true if field privateKey is set (has been assigned a value) and false otherwise */
+  public boolean isSetPrivateKey() {
+    return this.privateKey != null;
+  }
+
+  public void setPrivateKeyIsSet(boolean value) {
+    if (!value) {
+      this.privateKey = null;
+    }
+  }
+
+  public long getPersistedTime() {
+    return this.persistedTime;
+  }
+
+  public SSHCredential setPersistedTime(long persistedTime) {
+    this.persistedTime = persistedTime;
+    setPersistedTimeIsSet(true);
+    return this;
+  }
+
+  public void unsetPersistedTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */
+  public boolean isSetPersistedTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
+  }
+
+  public void setPersistedTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value);
+  }
+
+  public String getToken() {
+    return this.token;
+  }
+
+  public SSHCredential setToken(String token) {
+    this.token = token;
+    return this;
+  }
+
+  public void unsetToken() {
+    this.token = null;
+  }
+
+  /** Returns true if field token is set (has been assigned a value) and false otherwise */
+  public boolean isSetToken() {
+    return this.token != null;
+  }
+
+  public void setTokenIsSet(boolean value) {
+    if (!value) {
+      this.token = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case GATEWAY_ID:
+      if (value == null) {
+        unsetGatewayId();
+      } else {
+        setGatewayId((String)value);
+      }
+      break;
+
+    case USERNAME:
+      if (value == null) {
+        unsetUsername();
+      } else {
+        setUsername((String)value);
+      }
+      break;
+
+    case PASSPHRASE:
+      if (value == null) {
+        unsetPassphrase();
+      } else {
+        setPassphrase((String)value);
+      }
+      break;
+
+    case PUBLIC_KEY:
+      if (value == null) {
+        unsetPublicKey();
+      } else {
+        setPublicKey((String)value);
+      }
+      break;
+
+    case PRIVATE_KEY:
+      if (value == null) {
+        unsetPrivateKey();
+      } else {
+        setPrivateKey((String)value);
+      }
+      break;
+
+    case PERSISTED_TIME:
+      if (value == null) {
+        unsetPersistedTime();
+      } else {
+        setPersistedTime((Long)value);
+      }
+      break;
+
+    case TOKEN:
+      if (value == null) {
+        unsetToken();
+      } else {
+        setToken((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case GATEWAY_ID:
+      return getGatewayId();
+
+    case USERNAME:
+      return getUsername();
+
+    case PASSPHRASE:
+      return getPassphrase();
+
+    case PUBLIC_KEY:
+      return getPublicKey();
+
+    case PRIVATE_KEY:
+      return getPrivateKey();
+
+    case PERSISTED_TIME:
+      return Long.valueOf(getPersistedTime());
+
+    case TOKEN:
+      return getToken();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case GATEWAY_ID:
+      return isSetGatewayId();
+    case USERNAME:
+      return isSetUsername();
+    case PASSPHRASE:
+      return isSetPassphrase();
+    case PUBLIC_KEY:
+      return isSetPublicKey();
+    case PRIVATE_KEY:
+      return isSetPrivateKey();
+    case PERSISTED_TIME:
+      return isSetPersistedTime();
+    case TOKEN:
+      return isSetToken();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof SSHCredential)
+      return this.equals((SSHCredential)that);
+    return false;
+  }
+
+  public boolean equals(SSHCredential that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_gatewayId = true && this.isSetGatewayId();
+    boolean that_present_gatewayId = true && that.isSetGatewayId();
+    if (this_present_gatewayId || that_present_gatewayId) {
+      if (!(this_present_gatewayId && that_present_gatewayId))
+        return false;
+      if (!this.gatewayId.equals(that.gatewayId))
+        return false;
+    }
+
+    boolean this_present_username = true && this.isSetUsername();
+    boolean that_present_username = true && that.isSetUsername();
+    if (this_present_username || that_present_username) {
+      if (!(this_present_username && that_present_username))
+        return false;
+      if (!this.username.equals(that.username))
+        return false;
+    }
+
+    boolean this_present_passphrase = true && this.isSetPassphrase();
+    boolean that_present_passphrase = true && that.isSetPassphrase();
+    if (this_present_passphrase || that_present_passphrase) {
+      if (!(this_present_passphrase && that_present_passphrase))
+        return false;
+      if (!this.passphrase.equals(that.passphrase))
+        return false;
+    }
+
+    boolean this_present_publicKey = true && this.isSetPublicKey();
+    boolean that_present_publicKey = true && that.isSetPublicKey();
+    if (this_present_publicKey || that_present_publicKey) {
+      if (!(this_present_publicKey && that_present_publicKey))
+        return false;
+      if (!this.publicKey.equals(that.publicKey))
+        return false;
+    }
+
+    boolean this_present_privateKey = true && this.isSetPrivateKey();
+    boolean that_present_privateKey = true && that.isSetPrivateKey();
+    if (this_present_privateKey || that_present_privateKey) {
+      if (!(this_present_privateKey && that_present_privateKey))
+        return false;
+      if (!this.privateKey.equals(that.privateKey))
+        return false;
+    }
+
+    boolean this_present_persistedTime = true && this.isSetPersistedTime();
+    boolean that_present_persistedTime = true && that.isSetPersistedTime();
+    if (this_present_persistedTime || that_present_persistedTime) {
+      if (!(this_present_persistedTime && that_present_persistedTime))
+        return false;
+      if (this.persistedTime != that.persistedTime)
+        return false;
+    }
+
+    boolean this_present_token = true && this.isSetToken();
+    boolean that_present_token = true && that.isSetToken();
+    if (this_present_token || that_present_token) {
+      if (!(this_present_token && that_present_token))
+        return false;
+      if (!this.token.equals(that.token))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(SSHCredential other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(other.isSetGatewayId());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetGatewayId()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, other.gatewayId);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUsername()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPassphrase()).compareTo(other.isSetPassphrase());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPassphrase()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.passphrase, other.passphrase);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPublicKey()).compareTo(other.isSetPublicKey());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPublicKey()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.publicKey, other.publicKey);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPrivateKey()).compareTo(other.isSetPrivateKey());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPrivateKey()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privateKey, other.privateKey);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPersistedTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetToken()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("SSHCredential(");
+    boolean first = true;
+
+    sb.append("gatewayId:");
+    if (this.gatewayId == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.gatewayId);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("username:");
+    if (this.username == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.username);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("passphrase:");
+    if (this.passphrase == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.passphrase);
+    }
+    first = false;
+    if (isSetPublicKey()) {
+      if (!first) sb.append(", ");
+      sb.append("publicKey:");
+      if (this.publicKey == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.publicKey);
+      }
+      first = false;
+    }
+    if (isSetPrivateKey()) {
+      if (!first) sb.append(", ");
+      sb.append("privateKey:");
+      if (this.privateKey == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.privateKey);
+      }
+      first = false;
+    }
+    if (isSetPersistedTime()) {
+      if (!first) sb.append(", ");
+      sb.append("persistedTime:");
+      sb.append(this.persistedTime);
+      first = false;
+    }
+    if (isSetToken()) {
+      if (!first) sb.append(", ");
+      sb.append("token:");
+      if (this.token == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.token);
+      }
+      first = false;
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (gatewayId == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString());
+    }
+    if (username == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
+    }
+    if (passphrase == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'passphrase' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class SSHCredentialStandardSchemeFactory implements SchemeFactory {
+    public SSHCredentialStandardScheme getScheme() {
+      return new SSHCredentialStandardScheme();
+    }
+  }
+
+  private static class SSHCredentialStandardScheme extends StandardScheme<SSHCredential> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, SSHCredential struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // GATEWAY_ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.gatewayId = iprot.readString();
+              struct.setGatewayIdIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // USERNAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.username = iprot.readString();
+              struct.setUsernameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // PASSPHRASE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.passphrase = iprot.readString();
+              struct.setPassphraseIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // PUBLIC_KEY
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.publicKey = iprot.readString();
+              struct.setPublicKeyIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 5: // PRIVATE_KEY
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.privateKey = iprot.readString();
+              struct.setPrivateKeyIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 6: // PERSISTED_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.persistedTime = iprot.readI64();
+              struct.setPersistedTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 7: // TOKEN
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.token = iprot.readString();
+              struct.setTokenIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, SSHCredential struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.gatewayId != null) {
+        oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
+        oprot.writeString(struct.gatewayId);
+        oprot.writeFieldEnd();
+      }
+      if (struct.username != null) {
+        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+        oprot.writeString(struct.username);
+        oprot.writeFieldEnd();
+      }
+      if (struct.passphrase != null) {
+        oprot.writeFieldBegin(PASSPHRASE_FIELD_DESC);
+        oprot.writeString(struct.passphrase);
+        oprot.writeFieldEnd();
+      }
+      if (struct.publicKey != null) {
+        if (struct.isSetPublicKey()) {
+          oprot.writeFieldBegin(PUBLIC_KEY_FIELD_DESC);
+          oprot.writeString(struct.publicKey);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.privateKey != null) {
+        if (struct.isSetPrivateKey()) {
+          oprot.writeFieldBegin(PRIVATE_KEY_FIELD_DESC);
+          oprot.writeString(struct.privateKey);
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC);
+        oprot.writeI64(struct.persistedTime);
+        oprot.writeFieldEnd();
+      }
+      if (struct.token != null) {
+        if (struct.isSetToken()) {
+          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
+          oprot.writeString(struct.token);
+          oprot.writeFieldEnd();
+        }
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class SSHCredentialTupleSchemeFactory implements SchemeFactory {
+    public SSHCredentialTupleScheme getScheme() {
+      return new SSHCredentialTupleScheme();
+    }
+  }
+
+  private static class SSHCredentialTupleScheme extends TupleScheme<SSHCredential> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, SSHCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeString(struct.gatewayId);
+      oprot.writeString(struct.username);
+      oprot.writeString(struct.passphrase);
+      BitSet optionals = new BitSet();
+      if (struct.isSetPublicKey()) {
+        optionals.set(0);
+      }
+      if (struct.isSetPrivateKey()) {
+        optionals.set(1);
+      }
+      if (struct.isSetPersistedTime()) {
+        optionals.set(2);
+      }
+      if (struct.isSetToken()) {
+        optionals.set(3);
+      }
+      oprot.writeBitSet(optionals, 4);
+      if (struct.isSetPublicKey()) {
+        oprot.writeString(struct.publicKey);
+      }
+      if (struct.isSetPrivateKey()) {
+        oprot.writeString(struct.privateKey);
+      }
+      if (struct.isSetPersistedTime()) {
+        oprot.writeI64(struct.persistedTime);
+      }
+      if (struct.isSetToken()) {
+        oprot.writeString(struct.token);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, SSHCredential struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.gatewayId = iprot.readString();
+      struct.setGatewayIdIsSet(true);
+      struct.username = iprot.readString();
+      struct.setUsernameIsSet(true);
+      struct.passphrase = iprot.readString();
+      struct.setPassphraseIsSet(true);
+      BitSet incoming = iprot.readBitSet(4);
+      if (incoming.get(0)) {
+        struct.publicKey = iprot.readString();
+        struct.setPublicKeyIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.privateKey = iprot.readString();
+        struct.setPrivateKeyIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.persistedTime = iprot.readI64();
+        struct.setPersistedTimeIsSet(true);
+      }
+      if (incoming.get(3)) {
+        struct.token = iprot.readString();
+        struct.setTokenIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/credentialStoreDataModelConstants.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/credentialStoreDataModelConstants.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/credentialStoreDataModelConstants.java
new file mode 100644
index 0000000..975210d
--- /dev/null
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/credentialStoreDataModelConstants.java
@@ -0,0 +1,55 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class credentialStoreDataModelConstants {
+
+  public static final String DEFAULT_ID = "DO_NOT_SET_AT_CLIENTS";
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
new file mode 100644
index 0000000..7be01da
--- /dev/null
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
@@ -0,0 +1,397 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.exception;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class CredentialStoreException extends TException implements org.apache.thrift.TBase<CredentialStoreException, CredentialStoreException._Fields>, java.io.Serializable, Cloneable, Comparable<CredentialStoreException> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CredentialStoreException");
+
+  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CredentialStoreExceptionStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CredentialStoreExceptionTupleSchemeFactory());
+  }
+
+  public String message; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    MESSAGE((short)1, "message");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // MESSAGE
+          return MESSAGE;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CredentialStoreException.class, metaDataMap);
+  }
+
+  public CredentialStoreException() {
+  }
+
+  public CredentialStoreException(
+    String message)
+  {
+    this();
+    this.message = message;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CredentialStoreException(CredentialStoreException other) {
+    if (other.isSetMessage()) {
+      this.message = other.message;
+    }
+  }
+
+  public CredentialStoreException deepCopy() {
+    return new CredentialStoreException(this);
+  }
+
+  @Override
+  public void clear() {
+    this.message = null;
+  }
+
+  public String getMessage() {
+    return this.message;
+  }
+
+  public CredentialStoreException setMessage(String message) {
+    this.message = message;
+    return this;
+  }
+
+  public void unsetMessage() {
+    this.message = null;
+  }
+
+  /** Returns true if field message is set (has been assigned a value) and false otherwise */
+  public boolean isSetMessage() {
+    return this.message != null;
+  }
+
+  public void setMessageIsSet(boolean value) {
+    if (!value) {
+      this.message = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case MESSAGE:
+      if (value == null) {
+        unsetMessage();
+      } else {
+        setMessage((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case MESSAGE:
+      return getMessage();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case MESSAGE:
+      return isSetMessage();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CredentialStoreException)
+      return this.equals((CredentialStoreException)that);
+    return false;
+  }
+
+  public boolean equals(CredentialStoreException that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_message = true && this.isSetMessage();
+    boolean that_present_message = true && that.isSetMessage();
+    if (this_present_message || that_present_message) {
+      if (!(this_present_message && that_present_message))
+        return false;
+      if (!this.message.equals(that.message))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CredentialStoreException other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetMessage()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("CredentialStoreException(");
+    boolean first = true;
+
+    sb.append("message:");
+    if (this.message == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.message);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (message == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'message' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class CredentialStoreExceptionStandardSchemeFactory implements SchemeFactory {
+    public CredentialStoreExceptionStandardScheme getScheme() {
+      return new CredentialStoreExceptionStandardScheme();
+    }
+  }
+
+  private static class CredentialStoreExceptionStandardScheme extends StandardScheme<CredentialStoreException> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CredentialStoreException struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // MESSAGE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.message = iprot.readString();
+              struct.setMessageIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, CredentialStoreException struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.message != null) {
+        oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+        oprot.writeString(struct.message);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CredentialStoreExceptionTupleSchemeFactory implements SchemeFactory {
+    public CredentialStoreExceptionTupleScheme getScheme() {
+      return new CredentialStoreExceptionTupleScheme();
+    }
+  }
+
+  private static class CredentialStoreExceptionTupleScheme extends TupleScheme<CredentialStoreException> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CredentialStoreException struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeString(struct.message);
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CredentialStoreException struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.message = iprot.readString();
+      struct.setMessageIsSet(true);
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/pom.xml b/modules/credential-store/credential-store-webapp/pom.xml
new file mode 100644
index 0000000..e326fe8
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/pom.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor
+	license agreements. See the NOTICE file distributed with this work for additional
+	information regarding copyright ownership. The ASF licenses this file to
+	you under the Apache License, Version 2.0 (theƃĀ "License"); you may not use
+	this file except in compliance with the License. You may obtain a copy of
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+	by applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+	OF ANY ~ KIND, either express or implied. See the License for the specific
+	language governing permissions and limitations under the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>credential-store</artifactId>
+        <version>0.15-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>airavata-credential-store-webapp</artifactId>
+    <packaging>war</packaging>
+    <name>airavata-credential-store-webapp</name>
+    <build>
+        <finalName>credential-store</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.cargo</groupId>
+                <artifactId>cargo-maven2-plugin</artifactId>
+                <version>${cargo.version}</version>
+                <configuration>
+                    <wait>true</wait>
+                    <configuration>
+                        <properties>
+                            <cargo.servlet.port>8443</cargo.servlet.port>
+                            <cargo.protocol>https</cargo.protocol>
+                            <cargo.tomcat.connector.clientAuth>false</cargo.tomcat.connector.clientAuth>
+                            <cargo.tomcat.connector.sslProtocol>TLS</cargo.tomcat.connector.sslProtocol>
+                            <cargo.tomcat.connector.keystoreFile>/Users/chathuri/dev/airavata/credential-store/oa4mp/airavata_sym.jks</cargo.tomcat.connector.keystoreFile>
+                            <cargo.tomcat.connector.keystorePass>airavata</cargo.tomcat.connector.keystorePass>
+                            <cargo.tomcat.ajp.port>9009</cargo.tomcat.ajp.port>
+                            <cargo.rmi.port>9099</cargo.rmi.port>
+                            <cargo.jvmargs>
+                                <![CDATA[-Xdebug -Xrunjdwp:transport=dt_socket,address=${cargo.debug.address},server=y,suspend=${cargo.debug.suspend} -noverify ${javaagent}]]>
+                            </cargo.jvmargs>
+                            <cargo.tomcat.context.reloadable>true</cargo.tomcat.context.reloadable>
+                        </properties>
+                        <home>${project.build.directory}/tomcat6x</home>
+                        <deployables>
+                            <deployable>
+                                <groupId>org.apache.airavata</groupId>
+                                <artifactId>airavata-credential-store-webapp</artifactId>
+                                <type>war</type>
+                                <properties>
+                                    <context>/acs</context>
+                                </properties>
+                            </deployable>
+                        </deployables>
+                    </configuration>
+                    <container>
+                        <containerId>tomcat6x</containerId>
+                        <timeout>180000</timeout>
+                        <zipUrlInstaller>
+                            <url>
+                                http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz
+                            </url>
+                        </zipUrlInstaller>
+                        <systemProperties>
+
+                        </systemProperties>
+                    </container>
+                </configuration>
+            </plugin>
+        </plugins>
+
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbyclient</artifactId>
+            <version>${derby.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-credential-store</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>net.oauth.core</groupId>
+            <artifactId>oauth-httpclient4</artifactId>
+            <version>20090617</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-security</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-common-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.6</version>
+        </dependency>
+        <!-- <dependency>
+            <groupId>edu.uiuc.ncsa.myproxy</groupId>
+            <artifactId>oa4mp-client-oauth1</artifactId>
+            <version>${oa4mp.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>mysql</groupId>
+                    <artifactId>mysql-connector-java</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>postgresql</groupId>
+                    <artifactId>postgresql</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency> -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>${org.slf4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>${org.slf4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <version>${org.slf4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>${org.slf4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.ebaysf.web</groupId>
+            <artifactId>cors-filter</artifactId>
+            <version>${ebay.cors.filter}</version>
+        </dependency>
+    </dependencies>
+    <properties>
+        <cargo.version>1.2.1</cargo.version>
+        <cargo.debug.address>8000</cargo.debug.address>
+        <cargo.debug.suspend>y</cargo.debug.suspend>
+        <javaagent />
+    </properties>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/basic/BasicAccessAuthenticator.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/basic/BasicAccessAuthenticator.java b/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/basic/BasicAccessAuthenticator.java
new file mode 100644
index 0000000..c34cb1b
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/basic/BasicAccessAuthenticator.java
@@ -0,0 +1,226 @@
+/*
+ * 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.credentialstore.basic;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.credentialstore.session.ServletRequestHelper;
+import org.apache.airavata.security.AbstractAuthenticator;
+import org.apache.airavata.security.AuthenticationException;
+import org.apache.airavata.security.UserStoreException;
+import org.w3c.dom.Node;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+/**
+ * This authenticator handles basic access authentication requests. In basic access authentication
+ * we get user name and password as HTTP headers. The password is encoded with base64.
+ * More information @link{http://en.wikipedia.org/wiki/Basic_access_authentication}
+ */
+public class BasicAccessAuthenticator extends AbstractAuthenticator {
+
+
+    private static final String AUTHENTICATOR_NAME = "BasicAccessAuthenticator";
+
+    private ServletRequestHelper servletRequestHelper = new ServletRequestHelper();
+
+    public BasicAccessAuthenticator() {
+        super(AUTHENTICATOR_NAME);
+    }
+
+
+    /**
+     * Returns user name and password as an array. The first element is user name and second is password.
+     *
+     * @param httpServletRequest The servlet request.
+     * @return User name password pair as an array.
+     * @throws AuthenticationException If an error occurred while extracting user name and password.
+     */
+    private String[] getUserNamePassword(HttpServletRequest httpServletRequest) throws AuthenticationException {
+
+        String basicHeader = httpServletRequest.getHeader(ServletRequestHelper.AUTHORISATION_HEADER_NAME);
+
+        if (basicHeader == null) {
+            throw new AuthenticationException("Authorization Required");
+        }
+
+        String[] userNamePasswordArray = basicHeader.split(" ");
+
+        if (userNamePasswordArray == null || userNamePasswordArray.length != 2) {
+            throw new AuthenticationException("Authorization Required");
+        }
+
+        String decodedString = servletRequestHelper.decode(userNamePasswordArray[1]);
+
+        String[] array = decodedString.split(":");
+
+        if (array == null || array.length != 2) {
+            throw new AuthenticationException("Authorization Required");
+        }
+
+        return array;
+
+    }
+
+    @Override
+    protected boolean doAuthentication(Object credentials) throws AuthenticationException {
+        if (this.getUserStore() == null) {
+            throw new AuthenticationException("Authenticator is not initialized. Error processing request.");
+        }
+
+        if (credentials == null)
+            return false;
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
+
+        String[] array = getUserNamePassword(httpServletRequest);
+
+        String userName = array[0];
+        String password = array[1];
+
+        try {
+            return this.getUserStore().authenticate(userName, password);
+
+        } catch (UserStoreException e) {
+            throw new AuthenticationException("Error querying database for session information.", e);
+        }
+    }
+
+
+
+    @Override
+    public void onSuccessfulAuthentication(Object authenticationInfo) {
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) authenticationInfo;
+
+        try {
+            String[] array = getUserNamePassword(httpServletRequest);
+
+            StringBuilder stringBuilder = new StringBuilder("User : ");
+
+            if (array != null) {
+
+                servletRequestHelper.addUserToSession(array[0], httpServletRequest);
+
+                stringBuilder.append(array[0]).append(" successfully logged into system at ").append(getCurrentTime());
+                log.debug(stringBuilder.toString());
+
+            } else {
+                log.error("System error occurred while extracting user name after authentication. " +
+                        "Couldn't extract user name from the request.");
+            }
+        } catch (AuthenticationException e) {
+            log.error("System error occurred while extracting user name after authentication.", e);
+        }
+
+    }
+
+    @Override
+    public void onFailedAuthentication(Object authenticationInfo) {
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) authenticationInfo;
+
+        try {
+            String[] array = getUserNamePassword(httpServletRequest);
+
+            StringBuilder stringBuilder = new StringBuilder("User : ");
+
+            if (array != null) {
+
+                stringBuilder.append(array[0]).append(" Failed login attempt to system at ").append(getCurrentTime());
+                log.warn(stringBuilder.toString());
+
+            } else {
+                stringBuilder.append("Failed login attempt to system at ").append(getCurrentTime()).append( ". User unknown.");
+                log.warn(stringBuilder.toString());
+            }
+        } catch (AuthenticationException e) {
+            log.error("System error occurred while extracting user name after authentication.", e);
+        }
+    }
+
+    @Override
+    public boolean isAuthenticated(Object credentials) {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
+
+        HttpSession httpSession = httpServletRequest.getSession();
+
+        boolean seenInSession = false;
+
+        if (httpSession != null) {
+        	 String user = null;
+        	 String gateway = null;
+        	try{
+             user = (String)httpSession.getAttribute(Constants.USER_IN_SESSION);
+             gateway = (String)httpSession.getAttribute(ServerSettings.getDefaultUserGateway());
+             }
+            catch (ApplicationSettingsException e1) {
+    			// TODO Auto-generated catch block
+    			e1.printStackTrace();
+    		}
+            if (user != null && gateway != null) {
+                servletRequestHelper.addToContext(user, gateway);
+                seenInSession = true;
+            }
+        }
+
+        return seenInSession;
+
+    }
+
+    @Override
+    public boolean canProcess(Object credentials) {
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
+
+        return (httpServletRequest.getHeader(ServletRequestHelper.AUTHORISATION_HEADER_NAME) != null);
+    }
+
+
+
+    @Override
+    public void configure(Node node) throws RuntimeException {
+
+        /**
+         <specificConfigurations>
+         <database>
+         <jdbcUrl></jdbcUrl>
+         <databaseDriver></databaseDriver>
+         <userName></userName>
+         <password></password>
+         <userTableName></userTableName>
+         <userNameColumnName></userNameColumnName>
+         <passwordColumnName></passwordColumnName>
+         </database>
+         </specificConfigurations>
+         */
+
+        try {
+            this.getUserStore().configure(node);
+        } catch (UserStoreException e) {
+            throw new RuntimeException("Error while configuring authenticator user store", e);
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/local/LocalUserStore.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/local/LocalUserStore.java b/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/local/LocalUserStore.java
new file mode 100644
index 0000000..0a2ca83
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/local/LocalUserStore.java
@@ -0,0 +1,339 @@
+/*
+ *
+ * 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.credentialstore.local;
+
+import java.security.NoSuchAlgorithmException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.common.utils.SecurityUtil;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * User store to maintain internal DB database.
+ */
+public class LocalUserStore {
+
+    protected static Logger log = LoggerFactory.getLogger(LocalUserStore.class);
+
+    private DBUtil dbUtil;
+
+    private String hashMethod;
+
+    public LocalUserStore(ServletContext servletContext) throws Exception {
+        // Properties properties = WebAppUtil.getAiravataProperties(servletContext);
+
+        hashMethod = ServerSettings.getSetting("default.registry.password.hash.method");
+
+        dbUtil = new DBUtil(ServerSettings.getSetting("registry.jdbc.url"),
+                ServerSettings.getSetting("registry.jdbc.user"),
+                ServerSettings.getSetting("registry.jdbc.password"),
+                ServerSettings.getSetting("registry.jdbc.driver"));
+
+    }
+
+    public LocalUserStore(DBUtil db) {
+        dbUtil = db;
+    }
+
+    public void addUser(String userName, String password) {
+
+        String sql = "insert into Users values (?, ?)";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, userName);
+            preparedStatement.setString(2, SecurityUtil.digestString(password, hashMethod));
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+            log.debug("User " + userName + " successfully added.");
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error persisting user information.");
+            stringBuilder.append(" user - ").append(userName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new RuntimeException(stringBuilder.toString(), e);
+        } catch (NoSuchAlgorithmException e) {
+            String stringBuilder = "Error creating hash value for password.";
+            log.error(stringBuilder, e);
+
+            throw new RuntimeException(stringBuilder, e);
+        } finally {
+
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+
+    }
+
+    protected String getPassword(String userName, Connection connection) {
+
+        String sql = "select password from Users where user_name = ?";
+
+        PreparedStatement preparedStatement = null;
+        ResultSet resultSet = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, userName);
+
+            resultSet = preparedStatement.executeQuery();
+
+            if (resultSet.next()) {
+                return resultSet.getString("password");
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for user.");
+            stringBuilder.append("name - ").append(userName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new RuntimeException(stringBuilder.toString(), e);
+        } finally {
+
+            if (resultSet != null) {
+                try {
+                    resultSet.close();
+                } catch (SQLException e) {
+                    log.error("Error closing result set", e);
+                }
+            }
+
+            if (preparedStatement != null) {
+                try {
+                    preparedStatement.close();
+                } catch (SQLException e) {
+                    log.error("Error closing prepared statement", e);
+                }
+            }
+        }
+
+        return null;
+    }
+
+    public void changePassword(String userName, String oldPassword, String newPassword) {
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+
+            String storedPassword = getPassword(userName, connection);
+
+            String oldDigestedPassword = SecurityUtil.digestString(oldPassword, hashMethod);
+
+            if (storedPassword != null) {
+                if (!storedPassword.equals(oldDigestedPassword)) {
+                    throw new RuntimeException("Previous password did not match correctly. Please specify old password"
+                            + " correctly.");
+                }
+            }
+
+            String sql = "update Users set password = ? where user_name = ?";
+
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, SecurityUtil.digestString(newPassword, hashMethod));
+            preparedStatement.setString(2, userName);
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+            log.debug("Password changed for user " + userName);
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error updating credentials.");
+            stringBuilder.append(" user - ").append(userName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new RuntimeException(stringBuilder.toString(), e);
+        } catch (NoSuchAlgorithmException e) {
+            String stringBuilder = "Error creating hash value for password.";
+            log.error(stringBuilder, e);
+
+            throw new RuntimeException(stringBuilder, e);
+        } finally {
+
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+
+    }
+
+    public void changePasswordByAdmin(String userName, String newPassword) {
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+
+            String sql = "update Users set password = ? where user_name = ?";
+
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, SecurityUtil.digestString(newPassword, hashMethod));
+            preparedStatement.setString(2, userName);
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+            log.debug("Admin changed password of user " + userName);
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error updating credentials.");
+            stringBuilder.append(" user - ").append(userName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new RuntimeException(stringBuilder.toString(), e);
+        } catch (NoSuchAlgorithmException e) {
+            String stringBuilder = "Error creating hash value for password.";
+            log.error(stringBuilder, e);
+
+            throw new RuntimeException(stringBuilder, e);
+        } finally {
+
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+
+    }
+
+    public void deleteUser(String userName) {
+
+        String sql = "delete from Users where user_name=?";
+
+        Connection connection = null;
+        PreparedStatement preparedStatement = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, userName);
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+            log.debug("User " + userName + " deleted.");
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error deleting user.");
+            stringBuilder.append("user - ").append(userName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new RuntimeException(stringBuilder.toString(), e);
+        } finally {
+            dbUtil.cleanup(preparedStatement, connection);
+        }
+
+    }
+
+    public List<String> getUsers() {
+
+        List<String> userList = new ArrayList<String>();
+
+        String sql = "select user_name from Users";
+
+        PreparedStatement preparedStatement = null;
+        ResultSet resultSet = null;
+        Connection connection = null;
+
+        try {
+
+            connection = dbUtil.getConnection();
+            preparedStatement = connection.prepareStatement(sql);
+
+            resultSet = preparedStatement.executeQuery();
+
+            while (resultSet.next()) {
+                userList.add(resultSet.getString("user_name"));
+            }
+
+        } catch (SQLException e) {
+            String errorString = "Error retrieving Users.";
+            log.error(errorString, e);
+
+            throw new RuntimeException(errorString, e);
+        } finally {
+
+            if (resultSet != null) {
+                try {
+                    resultSet.close();
+                } catch (SQLException e) {
+                    log.error("Error closing result set", e);
+                }
+            }
+
+            if (preparedStatement != null) {
+                try {
+                    preparedStatement.close();
+                } catch (SQLException e) {
+                    log.error("Error closing prepared statement", e);
+                }
+            }
+
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (SQLException e) {
+                    log.error("Error closing connection", e);
+                }
+            }
+        }
+
+        Collections.sort(userList);
+
+        return userList;
+
+    }
+
+    public static String getPasswordRegularExpression() {
+        return "'^[a-zA-Z0-9_-]{6,15}$'";
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/HttpAuthenticatorFilter.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/HttpAuthenticatorFilter.java b/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/HttpAuthenticatorFilter.java
new file mode 100644
index 0000000..0847d54
--- /dev/null
+++ b/modules/credential-store/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/HttpAuthenticatorFilter.java
@@ -0,0 +1,191 @@
+/*
+ * 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.credentialstore.session;
+
+import org.apache.airavata.security.AuthenticationException;
+import org.apache.airavata.security.Authenticator;
+import org.apache.airavata.security.configurations.AuthenticatorConfigurationReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Calendar;
+import java.util.List;
+
+/**
+ * A servlet filter class which intercepts the request and do authentication.
+ */
+public class HttpAuthenticatorFilter implements Filter {
+
+    private List<Authenticator> authenticatorList;
+
+    private static Logger log = LoggerFactory.getLogger(HttpAuthenticatorFilter.class);
+
+    private ServletRequestHelper servletRequestHelper = new ServletRequestHelper();
+
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+        String authenticatorConfiguration = filterConfig.getInitParameter("authenticatorConfigurations");
+
+        //TODO make this able to read from a file as well
+
+
+        InputStream configurationFileStream = HttpAuthenticatorFilter.class.getClassLoader().
+                getResourceAsStream(authenticatorConfiguration);
+
+        if (configurationFileStream == null) {
+            String msg = "Invalid authenticator configuration. Cannot read file - ".concat(authenticatorConfiguration);
+            log.error(msg);
+            throw new ServletException(msg);
+        }
+
+        AuthenticatorConfigurationReader authenticatorConfigurationReader
+                = new AuthenticatorConfigurationReader();
+        try {
+            authenticatorConfigurationReader.init(configurationFileStream);
+        } catch (IOException e) {
+            String msg = "Error reading authenticator configurations.";
+
+            log.error(msg, e);
+            throw new ServletException(msg, e);
+        } catch (ParserConfigurationException e) {
+            String msg = "Error parsing authenticator configurations.";
+
+            log.error(msg, e);
+            throw new ServletException(msg, e);
+        } catch (SAXException e) {
+            String msg = "Error parsing authenticator configurations.";
+
+            log.error(msg, e);
+            throw new ServletException(msg, e);
+        } finally {
+            try {
+                configurationFileStream.close();
+            } catch (IOException e) {
+                log.error("Error closing authenticator file stream.", e);
+            }
+        }
+
+        this.authenticatorList = authenticatorConfigurationReader.getAuthenticatorList();
+
+        if (this.authenticatorList.isEmpty()) {
+            String msg = "No authenticators registered in the system. System cannot function without authenticators";
+            log.error(msg);
+            throw new ServletException(msg);
+        }
+
+    }
+
+    @Override
+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+
+        // Firs check whether authenticators are disabled
+        if (! AuthenticatorConfigurationReader.isAuthenticationEnabled()) {
+
+            // Extract user id and gateway id
+            try {
+                servletRequestHelper.addIdentityInformationToSession((HttpServletRequest) servletRequest);
+            } catch (AuthenticationException e) {
+                log.warn("Error adding identity information to session.", e);
+                populateUnauthorisedData(servletResponse, "Error adding identity information to session.");
+
+            }
+
+            filterChain.doFilter(servletRequest, servletResponse);
+            return;
+        }
+
+        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
+
+        Authenticator authenticator = getAuthenticator(httpServletRequest);
+
+        if (authenticator == null) {
+            //sendUnauthorisedError(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
+            populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
+        } else {
+            if (authenticator.isAuthenticated(httpServletRequest)) {
+                // Allow request to flow
+                filterChain.doFilter(servletRequest, servletResponse);
+            } else {
+                try {
+                    if (!authenticator.authenticate(httpServletRequest)) {
+                        //sendUnauthorisedError(servletResponse, "Unauthorised : Provided credentials are not valid.");
+                        populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
+                    } else {
+                        // Allow request to flow
+                        filterChain.doFilter(servletRequest, servletResponse);
+                    }
+                } catch (AuthenticationException e) {
+                    String msg = "An error occurred while authenticating request.";
+                    log.error(msg, e);
+                    //sendUnauthorisedError(servletResponse, e.getMessage());
+                    populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
+                }
+            }
+        }
+    }
+
+    public static void sendUnauthorisedError(ServletResponse servletResponse, String message) throws IOException {
+        HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
+        httpServletResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, message);
+    }
+
+    @Override
+    public void destroy() {
+
+        this.authenticatorList = null;
+    }
+
+    private Authenticator getAuthenticator(HttpServletRequest httpServletRequest) {
+
+        for (Authenticator authenticator : authenticatorList) {
+            if (authenticator.canProcess(httpServletRequest)) {
+                return authenticator;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * This method will create a 401 unauthorized response to be sent.
+     *
+     * @param servletResponse The HTTP response.
+     */
+    public static void populateUnauthorisedData(ServletResponse servletResponse, String message) {
+
+        HttpServletResponse httpServletResponse = (HttpServletResponse)servletResponse;
+
+        httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+        httpServletResponse.addHeader("Server", "Airavata Server");
+        httpServletResponse.addHeader("Description", message);
+        httpServletResponse.addDateHeader("Date", Calendar.getInstance().getTimeInMillis());
+        httpServletResponse.addHeader("WWW-Authenticate", "Basic realm=Airavata");
+        httpServletResponse.setContentType("text/html");
+
+    }
+}


[05/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
new file mode 100644
index 0000000..b9dc2ef
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
@@ -0,0 +1,458 @@
+/*
+ *
+ * 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;
+import org.apache.airavata.common.utils.KeyStorePasswordCallback;
+import org.apache.airavata.common.utils.SecurityUtil;
+import org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+
+import java.io.*;
+import java.security.GeneralSecurityException;
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Data access class for credential store.
+ */
+public class CredentialsDAO extends ParentDAO {
+
+    private String keyStorePath = null;
+    private String secretKeyAlias = null;
+    private KeyStorePasswordCallback keyStorePasswordCallback = null;
+
+    public CredentialsDAO() {
+    }
+
+    public CredentialsDAO(String keyStore, String alias, KeyStorePasswordCallback passwordCallback) {
+        this.keyStorePath = keyStore;
+        this.secretKeyAlias = alias;
+        this.keyStorePasswordCallback = passwordCallback;
+    }
+
+    public String getKeyStorePath() {
+        return keyStorePath;
+    }
+
+    public void setKeyStorePath(String keyStorePath) {
+        this.keyStorePath = keyStorePath;
+    }
+
+    public String getSecretKeyAlias() {
+        return secretKeyAlias;
+    }
+
+    public void setSecretKeyAlias(String secretKeyAlias) {
+        this.secretKeyAlias = secretKeyAlias;
+    }
+
+    public KeyStorePasswordCallback getKeyStorePasswordCallback() {
+        return keyStorePasswordCallback;
+    }
+
+    public void setKeyStorePasswordCallback(KeyStorePasswordCallback keyStorePasswordCallback) {
+        this.keyStorePasswordCallback = keyStorePasswordCallback;
+    }
+
+    /**
+     * 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 {
+
+        String sql = "INSERT INTO CREDENTIALS VALUES (?, ?, ?, ?, ?)";
+
+        PreparedStatement preparedStatement = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayId);
+            preparedStatement.setString(2, credential.getToken());
+
+            InputStream isCert = new ByteArrayInputStream(convertObjectToByteArray(credential));
+            preparedStatement.setBinaryStream(3, isCert);
+
+            preparedStatement.setString(4, credential.getPortalUserName());
+
+            java.util.Date date = new java.util.Date();
+            Timestamp timestamp = new Timestamp(date.getTime());
+
+            preparedStatement.setTimestamp(5, timestamp);
+
+            preparedStatement.executeUpdate();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error persisting credentials.");
+            stringBuilder.append(" gateway - ").append(gatewayId);
+            stringBuilder.append(" token id - ").append(credential.getToken());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+
+            DBUtil.cleanup(preparedStatement);
+        }
+    }
+
+    public void deleteCredentials(String gatewayName, String tokenId, Connection connection)
+            throws CredentialStoreException {
+
+        String sql = "DELETE FROM CREDENTIALS WHERE GATEWAY_ID=? AND TOKEN_ID=?";
+
+        PreparedStatement preparedStatement = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+            preparedStatement.setString(2, tokenId);
+
+            preparedStatement.executeUpdate();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error deleting credentials for .");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("token id - ").append(tokenId);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            DBUtil.cleanup(preparedStatement);
+        }
+    }
+
+    /**
+     * 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 = ?, PORTAL_USER_ID = ?, TIME_PERSISTED = ? where GATEWAY_ID = ? and TOKEN_ID = ?";
+
+        PreparedStatement preparedStatement = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            InputStream isCert = new ByteArrayInputStream(convertObjectToByteArray(credential));
+            preparedStatement.setBinaryStream(1, isCert);
+
+            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();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error updating credentials.");
+            stringBuilder.append(" gateway - ").append(gatewayId);
+            stringBuilder.append(" token id - ").append(credential.getToken());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+
+            DBUtil.cleanup(preparedStatement);
+        }
+
+    }
+
+    /**
+     * 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_ID=? AND TOKEN_ID=?";
+
+        PreparedStatement preparedStatement = null;
+        ResultSet resultSet = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+            preparedStatement.setString(2, tokenId);
+
+            resultSet = preparedStatement.executeQuery();
+
+            if (resultSet.next()) {
+                // CertificateCredential certificateCredential = new CertificateCredential();
+
+                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
+                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());
+
+                Credential certificateCredential = (Credential) convertByteArrayToObject(certificate);
+
+                certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
+                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
+
+                return certificateCredential;
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for user.");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("token id - ").append(tokenId);
+
+            log.debug(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            DBUtil.cleanup(preparedStatement, resultSet);
+        }
+
+        return null;
+    }
+    /**
+     * 
+     */
+    public String getGatewayID(String tokenId, Connection connection)
+            throws CredentialStoreException {
+
+        String sql = "SELECT GATEWAY_ID FROM CREDENTIALS WHERE TOKEN_ID=?";
+
+        PreparedStatement preparedStatement = null;
+        ResultSet resultSet = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, tokenId);
+         
+            resultSet = preparedStatement.executeQuery();
+
+            if (resultSet.next()) {
+            	return resultSet.getString("GATEWAY_ID");
+              }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for user.");
+            stringBuilder.append("token id - ").append(tokenId);
+
+            log.debug(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            DBUtil.cleanup(preparedStatement, resultSet);
+        }
+
+        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"
+     * + ")";
+     */
+    public List<Credential> getCredentials(String gatewayName, Connection connection) throws CredentialStoreException {
+
+        List<Credential> credentialList = new ArrayList<Credential>();
+
+        String sql = "SELECT * FROM CREDENTIALS WHERE GATEWAY_ID=?";
+
+        PreparedStatement preparedStatement = null;
+        ResultSet resultSet = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+
+            resultSet = preparedStatement.executeQuery();
+
+            Credential certificateCredential;
+
+            while (resultSet.next()) {
+
+                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
+                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());
+
+                certificateCredential = (Credential) convertByteArrayToObject(certificate);
+
+                certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
+                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
+
+                credentialList.add(certificateCredential);
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving credential list for ");
+            stringBuilder.append("gateway - ").append(gatewayName);
+
+            log.debug(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            DBUtil.cleanup(preparedStatement, resultSet);
+        }
+
+        return credentialList;
+    }
+
+    /**
+     * Gets all credentials.
+     * @param connection The database connection
+     * @return All credentials as a list
+     * @throws CredentialStoreException If an error occurred while rerieving credentials.
+     */
+    public List<Credential> getCredentials(Connection connection) throws CredentialStoreException {
+
+        List<Credential> credentialList = new ArrayList<Credential>();
+
+        String sql = "SELECT * FROM CREDENTIALS";
+
+        PreparedStatement preparedStatement = null;
+        ResultSet resultSet = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            resultSet = preparedStatement.executeQuery();
+
+            Credential certificateCredential;
+
+            while (resultSet.next()) {
+
+                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
+                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());
+
+                certificateCredential = (Credential) convertByteArrayToObject(certificate);
+
+                certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
+                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
+
+                credentialList.add(certificateCredential);
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving all credentials");
+
+            log.debug(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            DBUtil.cleanup(preparedStatement, resultSet);
+        }
+
+        return credentialList;
+    }
+
+    public Object convertByteArrayToObject(byte[] data) throws CredentialStoreException {
+        ObjectInputStream objectInputStream = null;
+        Object o = null;
+        try {
+            try {
+                //decrypt the data first
+                if (encrypt()) {
+                    data = SecurityUtil.decrypt(this.keyStorePath, this.secretKeyAlias, this.keyStorePasswordCallback, data);
+                }
+
+                objectInputStream = new ObjectInputStream(new ByteArrayInputStream(data));
+                o = objectInputStream.readObject();
+
+            } catch (IOException e) {
+                throw new CredentialStoreException("Error de-serializing object.", e);
+            } catch (ClassNotFoundException e) {
+                throw new CredentialStoreException("Error de-serializing object.", e);
+            } catch (GeneralSecurityException e) {
+                throw new CredentialStoreException("Error decrypting data.", e);
+            }
+        } finally {
+            if (objectInputStream != null) {
+                try {
+                    objectInputStream.close();
+                } catch (IOException e) {
+                    log.error("Error occurred while closing the stream", e);
+                }
+            }
+        }
+        return o;
+    }
+
+    public byte[] convertObjectToByteArray(Serializable o) throws CredentialStoreException {
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+
+        ObjectOutputStream objectOutputStream = null;
+        try {
+            objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
+            objectOutputStream.writeObject(o);
+            objectOutputStream.flush();
+        } catch (IOException e) {
+            throw new CredentialStoreException("Error serializing object.", e);
+        } finally {
+            if (objectOutputStream != null) {
+                try {
+                    objectOutputStream.close();
+                } catch (IOException e) {
+                    log.error("Error occurred while closing object output stream", e);
+                }
+            }
+        }
+
+        // encrypt the byte array
+        if (encrypt()) {
+            byte[] array = byteArrayOutputStream.toByteArray();
+            try {
+                return SecurityUtil.encrypt(this.keyStorePath, this.secretKeyAlias, this.keyStorePasswordCallback, array);
+            } catch (GeneralSecurityException e) {
+                throw new CredentialStoreException("Error encrypting data", e);
+            } catch (IOException e) {
+                throw new CredentialStoreException("Error encrypting data. IO exception.", e);
+            }
+        } else {
+            return byteArrayOutputStream.toByteArray();
+        }
+    }
+
+    /**
+     * Says whether to encrypt data or not. if alias, keystore is set
+     * we treat encryption true.
+     * @return true if data should encrypt else false.
+     */
+    private boolean encrypt() {
+        return this.keyStorePath != null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java
new file mode 100644
index 0000000..8ef0d69
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Super class to abstract out Data access classes.
+ */
+public class ParentDAO {
+    protected static Logger log = LoggerFactory.getLogger(ParentDAO.class);
+
+    public ParentDAO() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/ConfigurationReader.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/ConfigurationReader.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/ConfigurationReader.java
new file mode 100644
index 0000000..e44d4d8
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/ConfigurationReader.java
@@ -0,0 +1,121 @@
+/*
+ *
+ * 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.util;
+
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 8/25/13
+ * Time: 6:40 AM
+ */
+
+/**
+ * Reads credential store specific configurations from the client.xml file.
+ */
+public class ConfigurationReader {
+
+    private String successUrl;
+
+    private String errorUrl;
+
+    private String portalRedirectUrl;
+
+    public String getPortalRedirectUrl() {
+        return portalRedirectUrl;
+    }
+
+    public void setPortalRedirectUrl(String portalRedirectUrl) {
+        this.portalRedirectUrl = portalRedirectUrl;
+    }
+
+    public ConfigurationReader() throws CredentialStoreException {
+
+        try {
+            loadConfigurations();
+        } catch (Exception e) {
+            throw new CredentialStoreException("Unable to read credential store specific configurations." , e);
+        }
+
+
+    }
+
+    private void loadConfigurations() throws ParserConfigurationException,
+            IOException, SAXException {
+        InputStream inputStream
+                = this.getClass().getClassLoader().getResourceAsStream("credential-store/client.xml");
+
+        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+        Document doc = dBuilder.parse(inputStream);
+
+        doc.getDocumentElement().normalize();
+
+        NodeList nodeList = doc.getElementsByTagName("credential-store");
+
+        readElementValue(nodeList);
+
+    }
+
+    private void readElementValue(NodeList nodeList) {
+        for (int temp = 0; temp < nodeList.getLength(); temp++) {
+
+            Node nNode = nodeList.item(temp);
+
+            if (nNode.getNodeType() == Node.ELEMENT_NODE) {
+
+                Element eElement = (Element) nNode;
+
+                this.successUrl = eElement.getElementsByTagName("successUri").item(0).getTextContent();
+                this.errorUrl =  eElement.getElementsByTagName("errorUri").item(0).getTextContent();
+                this.portalRedirectUrl = eElement.getElementsByTagName("redirectUri").item(0).getTextContent();
+            }
+        }
+    }
+
+    public String getSuccessUrl() {
+        return successUrl;
+    }
+
+    public void setSuccessUrl(String successUrl) {
+        this.successUrl = successUrl;
+    }
+
+    public String getErrorUrl() {
+        return errorUrl;
+    }
+
+    public void setErrorUrl(String errorUrl) {
+        this.errorUrl = errorUrl;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/CredentialStoreConstants.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/CredentialStoreConstants.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/CredentialStoreConstants.java
new file mode 100644
index 0000000..de3c59c
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/CredentialStoreConstants.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.util;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 8/25/13
+ * Time: 4:34 PM
+ */
+
+public class CredentialStoreConstants {
+
+    public static final String GATEWAY_NAME_QUERY_PARAMETER = "gatewayName";
+    public static final String PORTAL_USER_QUERY_PARAMETER = "portalUserName";
+    public static final String PORTAL_USER_EMAIL_QUERY_PARAMETER = "email";
+    public static final String PORTAL_TOKEN_ID_ASSIGNED = "associatedToken";
+    public static final String DURATION_QUERY_PARAMETER = "duration";
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/PrivateKeyStore.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/PrivateKeyStore.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/PrivateKeyStore.java
new file mode 100644
index 0000000..cd6db7e
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/PrivateKeyStore.java
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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.util;
+
+import java.security.PrivateKey;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 9/5/13
+ * Time: 6:47 PM
+ */
+
+public class PrivateKeyStore {
+
+    private Map<String, PrivateKey> privateKeyMap;
+
+    private static PrivateKeyStore privateKeyStore = null;
+
+    private PrivateKeyStore() {
+        privateKeyMap = new HashMap<String, PrivateKey>();
+    }
+
+    public static PrivateKeyStore getPrivateKeyStore() {
+
+        if (privateKeyStore == null) {
+            privateKeyStore = new PrivateKeyStore();
+        }
+
+        return privateKeyStore;
+    }
+
+    public synchronized void addKey(String tokenId, PrivateKey privateKey) {
+
+        privateKeyMap.put(tokenId, privateKey);
+    }
+
+    public synchronized PrivateKey getKey(String tokenId) {
+
+        PrivateKey privateKey = privateKeyMap.get(tokenId);
+
+        if (privateKey != null) {
+            privateKeyMap.remove(tokenId);
+        }
+
+        return privateKey;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/TokenGenerator.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/TokenGenerator.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/TokenGenerator.java
new file mode 100644
index 0000000..1c36f8d
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/TokenGenerator.java
@@ -0,0 +1,57 @@
+/*
+ *
+ * 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.util;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 5/21/13
+ * Time: 3:07 PM
+ */
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.util.UUID;
+
+/**
+ * Generates tokens for users.
+ */
+public class TokenGenerator {
+
+    protected static Logger log = LoggerFactory.getLogger(TokenGenerator.class);
+
+
+    public TokenGenerator() {
+
+    }
+
+    public static String generateToken(String gatewayId, String metadata) {
+
+        return UUID.randomUUID().toString();
+    }
+
+    public String encryptToken(String token) {
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/Utility.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/Utility.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/Utility.java
new file mode 100644
index 0000000..0ea7bc1
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/util/Utility.java
@@ -0,0 +1,110 @@
+/*
+ *
+ * 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.util;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.KeyPair;
+import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
+import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.security.KeyStore;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Contains some utility methods.
+ */
+public class Utility {
+
+    protected static Logger log = LoggerFactory.getLogger(Utility.class);
+
+    private static final String DATE_FORMAT = "MM/dd/yyyy HH:mm:ss";
+
+    public static String convertDateToString(Date date) {
+
+        DateFormat df = new SimpleDateFormat(DATE_FORMAT);
+        return df.format(date);
+    }
+
+    public static Date convertStringToDate(String date) throws ParseException {
+
+        DateFormat df = new SimpleDateFormat(DATE_FORMAT);
+        return df.parse(date);
+    }
+
+    public static String encrypt(String stringToEncrypt) {
+        return null;
+
+    }
+
+    public static KeyStore loadKeyStore(String keyStoreFile) throws Exception {
+        KeyStore ks = KeyStore.getInstance("JKS");
+        // get user password and file input stream
+        char[] password = getPassword();
+
+        java.io.FileInputStream fis = null;
+        try {
+            fis = new FileInputStream(keyStoreFile);
+            ks.load(fis, password);
+
+            return ks;
+        } finally {
+            if (fis != null) {
+                fis.close();
+            }
+        }
+    }
+
+    public static char[] getPassword() {
+        return new char[0];
+    }
+
+    public static org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential generateKeyPair(SSHCredential credential) throws Exception{
+        JSch jsch=new JSch();
+        try{
+            KeyPair kpair=KeyPair.genKeyPair(jsch, KeyPair.RSA);
+            File file = File.createTempFile("id_rsa", "");
+            String fileName = file.getAbsolutePath();
+
+            kpair.writePrivateKey(fileName,credential.getPassphrase().getBytes());
+            kpair.writePublicKey(fileName + ".pub"  , "");
+            kpair.dispose();
+            byte[] priKey = FileUtils.readFileToByteArray(new File(fileName));
+
+            byte[] pubKey = FileUtils.readFileToByteArray(new File(fileName + ".pub"));
+            credential.setPrivateKey(priKey);
+            credential.setPublicKey(pubKey);
+            return credential;
+        }
+        catch(Exception e){
+            log.error("Error while creating key pair", e);
+            throw new Exception("Error while creating key pair", e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierTest.java b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierTest.java
new file mode 100644
index 0000000..05d7a10
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierTest.java
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.notifier.impl;
+
+import junit.framework.TestCase;
+import org.apache.airavata.credential.store.notifier.NotificationMessage;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 12/27/13
+ * Time: 1:54 PM
+ */
+
+public class EmailNotifierTest extends TestCase {
+    public void setUp() throws Exception {
+        super.setUp();
+
+    }
+
+    // Test is disabled. Need to fill in parameters to send mails
+    public void xtestNotifyMessage() throws Exception {
+
+        EmailNotifierConfiguration emailNotifierConfiguration = new EmailNotifierConfiguration("smtp.googlemail.com",
+                465, "yyy", "xxx", true, "yyy@gmail.com");
+
+        EmailNotifier notifier = new EmailNotifier(emailNotifierConfiguration);
+        EmailNotificationMessage emailNotificationMessage = new EmailNotificationMessage("Test",
+                "ggg@gmail.com", "Testing credential store");
+        notifier.notifyMessage(emailNotificationMessage);
+
+    }
+
+    // Just to ignore test failures.
+    public void testIgnore() {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
new file mode 100644
index 0000000..8ed8a6a
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
@@ -0,0 +1,207 @@
+/*
+ *
+ * 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;
+import org.apache.airavata.common.utils.DatabaseTestCases;
+import org.apache.airavata.common.utils.DerbyUtil;
+import org.apache.airavata.credential.store.credential.CommunityUser;
+import org.junit.*;
+
+import java.sql.Connection;
+import java.util.List;
+
+/**
+ * Test for community user DAO.
+ */
+public class CommunityUserDAOTest extends DatabaseTestCases {
+
+    private CommunityUserDAO communityUserDAO;
+
+    @BeforeClass
+    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 dropTable = "drop table COMMUNITY_USER";
+
+        try {
+            executeSQL(dropTable);
+        } catch (Exception e) {
+        }
+
+        executeSQL(createTable);
+
+    }
+
+    @AfterClass
+    public static void shutDownDatabase() throws Exception {
+        DerbyUtil.stopDerbyServer();
+    }
+
+    @Before
+    public void setUp() throws Exception {
+
+        communityUserDAO = new CommunityUserDAO();
+
+        Connection connection = getDbUtil().getConnection();
+
+        try {
+            DBUtil.truncate("community_user", connection);
+        } finally {
+            connection.close();
+        }
+
+    }
+
+    @Test
+    public void testAddCommunityUser() throws Exception {
+
+        Connection connection = getConnection();
+
+        try {
+
+            CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
+            communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
+
+            communityUser = new CommunityUser("gw1", "ogce2", "ogce@sciencegateway.org");
+            communityUserDAO.addCommunityUser(communityUser, "Token2", connection);
+
+            CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
+            Assert.assertNotNull(user);
+            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
+
+            user = communityUserDAO.getCommunityUser("gw1", "ogce2", connection);
+            Assert.assertNotNull(user);
+            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
+
+            user = communityUserDAO.getCommunityUserByToken("gw1", "Token1", connection);
+            Assert.assertNotNull(user);
+            Assert.assertEquals("ogce", user.getUserName());
+            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
+
+            user = communityUserDAO.getCommunityUserByToken("gw1", "Token2", connection);
+            Assert.assertNotNull(user);
+            Assert.assertEquals("ogce2", user.getUserName());
+            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
+
+        } finally {
+            connection.close();
+        }
+
+    }
+
+    @Test
+    public void testDeleteCommunityUser() throws Exception {
+
+        Connection connection = getConnection();
+
+        try {
+            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");
+            communityUserDAO.deleteCommunityUser(communityUser, connection);
+
+            user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
+            Assert.assertNull(user);
+
+        } finally {
+            connection.close();
+        }
+    }
+
+    @Test
+    public void testDeleteCommunityUserByToken() throws Exception {
+
+        Connection connection = getConnection();
+
+        try {
+            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");
+            communityUserDAO.deleteCommunityUserByToken(communityUser, "Token1", connection);
+
+            user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
+            Assert.assertNull(user);
+
+        } finally {
+            connection.close();
+        }
+
+    }
+
+    @Test
+    public void testGetCommunityUsers() throws Exception {
+
+        Connection connection = getConnection();
+
+        try {
+            CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
+            communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
+
+            CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
+            Assert.assertNotNull(user);
+            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
+
+        } finally {
+            connection.close();
+        }
+
+    }
+
+    @Test
+    public void testGetCommunityUsersForGateway() throws Exception {
+
+        Connection connection = getConnection();
+
+        CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
+        communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
+
+        communityUser = new CommunityUser("gw1", "ogce2", "ogce@sciencegateway.org");
+        communityUserDAO.addCommunityUser(communityUser, "Token2", connection);
+
+        List<CommunityUser> users = communityUserDAO.getCommunityUsers("gw1", connection);
+        Assert.assertNotNull(users);
+        Assert.assertEquals(2, users.size());
+
+        Assert.assertEquals(users.get(0).getUserName(), "ogce");
+        Assert.assertEquals(users.get(1).getUserName(), "ogce2");
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
new file mode 100644
index 0000000..c175454
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
@@ -0,0 +1,421 @@
+/*
+ *
+ * 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;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.common.utils.DatabaseTestCases;
+import org.apache.airavata.common.utils.DerbyUtil;
+import org.apache.airavata.common.utils.KeyStorePasswordCallback;
+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.CredentialStoreException;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.net.URL;
+import java.security.*;
+import java.security.cert.X509Certificate;
+import java.sql.Connection;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Test class for credential class
+ */
+public class CredentialsDAOTest extends DatabaseTestCases {
+
+    private static final Logger logger = LoggerFactory.getLogger(CredentialsDAOTest.class);
+
+    private CredentialsDAO credentialsDAO;
+
+    private X509Certificate[] x509Certificates;
+    private PrivateKey privateKey;
+
+    @BeforeClass
+    public static void setUpDatabase() throws Exception {
+        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
+
+        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 dropTable = "drop table CREDENTIALS";
+
+        try {
+            executeSQL(dropTable);
+        } catch (Exception e) {
+        }
+
+        executeSQL(createTable);
+
+    }
+
+    @AfterClass
+    public static void shutDownDatabase() throws Exception {
+        DerbyUtil.stopDerbyServer();
+    }
+
+    @Before
+    public void setUp() throws Exception {
+
+        credentialsDAO = new CredentialsDAO();
+
+        x509Certificates = new X509Certificate[1];
+
+        // Cleanup tables;
+        Connection connection = getConnection();
+
+        try {
+            DBUtil.truncate("credentials", connection);
+        } finally {
+            connection.close();
+        }
+
+        initializeKeys();
+    }
+
+    private void initializeKeys() throws Exception {
+        KeyStore ks = KeyStore.getInstance("JKS");
+        char[] password = "password".toCharArray();
+
+        String baseDirectory = System.getProperty("credential.module.directory");
+
+        String keyStorePath = "src" + File.separator + "test" + File.separator + "resources" + File.separator
+                + "keystore.jks";
+
+        if (baseDirectory != null) {
+            keyStorePath = baseDirectory + File.separator + keyStorePath;
+        } else {
+            keyStorePath = "modules" + File.separator + "credential-store" + File.separator + keyStorePath;
+        }
+
+        File keyStoreFile = new File(keyStorePath);
+        if (!keyStoreFile.exists()) {
+            logger.error("Unable to read keystore file " + keyStoreFile);
+            throw new RuntimeException("Unable to read keystore file " + keyStoreFile);
+
+        }
+
+        java.io.FileInputStream fis = null;
+        try {
+            fis = new java.io.FileInputStream(keyStorePath);
+            ks.load(fis, password);
+        } finally {
+            if (fis != null) {
+                fis.close();
+            }
+        }
+
+        fis.close();
+
+        privateKey = (PrivateKey) ks.getKey("selfsigned", password);
+        x509Certificates[0] = (X509Certificate) ks.getCertificate("selfsigned");
+
+    }
+
+    @Test
+    public void testKeyReading() throws Exception {
+        initializeKeys();
+        System.out.println(privateKey.getAlgorithm());
+        System.out.println(x509Certificates[0].getIssuerDN());
+
+        Assert.assertNotNull(privateKey);
+        Assert.assertNotNull(x509Certificates);
+    }
+
+    private CommunityUser getCommunityUser(String gateway, String name) {
+        return new CommunityUser(gateway, name, "amila@sciencegateway.org");
+    }
+
+    private void addTestCredentials() throws Exception {
+
+        Connection connection = getConnection();
+
+        try {
+            CertificateCredential certificateCredential = getTestCredentialObject();
+            credentialsDAO.addCredentials(certificateCredential.getCommunityUser().getGatewayName(),
+                    certificateCredential, connection);
+
+        } finally {
+            connection.close();
+        }
+    }
+
+    public CertificateCredential getTestCredentialObject() {
+
+        CertificateCredential certificateCredential = new CertificateCredential();
+        certificateCredential.setToken("tom");
+        certificateCredential.setCertificates(x509Certificates);
+        certificateCredential.setPrivateKey(privateKey);
+        certificateCredential.setCommunityUser(getCommunityUser("gw1", "tom"));
+        certificateCredential.setLifeTime(1000);
+        certificateCredential.setPortalUserName("jerry");
+        certificateCredential.setNotBefore("13 OCT 2012 5:34:23");
+        certificateCredential.setNotAfter("14 OCT 2012 5:34:23");
+
+        return certificateCredential;
+
+    }
+
+    @Test
+    public void testSerialization() throws CredentialStoreException {
+
+        CertificateCredential certificateCredential = getTestCredentialObject();
+
+        CredentialsDAO credentialsDAO1 = new CredentialsDAO();
+
+        byte[] array = credentialsDAO1.convertObjectToByteArray(certificateCredential);
+        CertificateCredential readCertificateCredential = (CertificateCredential) credentialsDAO1
+                .convertByteArrayToObject(array);
+
+        checkEquality(certificateCredential.getCertificates(), readCertificateCredential.getCertificates());
+        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());
+        Assert.assertEquals(certificateCredential.getPortalUserName(), readCertificateCredential.getPortalUserName());
+
+        PrivateKey newKey = readCertificateCredential.getPrivateKey();
+
+        Assert.assertNotNull(newKey);
+        Assert.assertEquals(privateKey.getClass(), newKey.getClass());
+
+        Assert.assertEquals(privateKey.getFormat(), newKey.getFormat());
+        Assert.assertEquals(privateKey.getAlgorithm(), newKey.getAlgorithm());
+        Assert.assertTrue(Arrays.equals(privateKey.getEncoded(), newKey.getEncoded()));
+    }
+
+    @Test
+    public void testSerializationWithEncryption() throws CredentialStoreException {
+
+        URL url = this.getClass().getClassLoader().getResource("mykeystore.jks");
+        String secretKeyAlias = "mykey";
+
+        assert url != null;
+
+        CertificateCredential certificateCredential = getTestCredentialObject();
+
+        CredentialsDAO credentialsDAO1 = new CredentialsDAO(url.getPath(), secretKeyAlias,
+                new TestACSKeyStoreCallback());
+
+        byte[] array = credentialsDAO1.convertObjectToByteArray(certificateCredential);
+        CertificateCredential readCertificateCredential = (CertificateCredential) credentialsDAO1
+                .convertByteArrayToObject(array);
+
+        checkEquality(certificateCredential.getCertificates(), readCertificateCredential.getCertificates());
+        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());
+        Assert.assertEquals(certificateCredential.getPortalUserName(), readCertificateCredential.getPortalUserName());
+
+        PrivateKey newKey = readCertificateCredential.getPrivateKey();
+
+        Assert.assertNotNull(newKey);
+        Assert.assertEquals(privateKey.getClass(), newKey.getClass());
+
+        Assert.assertEquals(privateKey.getFormat(), newKey.getFormat());
+        Assert.assertEquals(privateKey.getAlgorithm(), newKey.getAlgorithm());
+        Assert.assertTrue(Arrays.equals(privateKey.getEncoded(), newKey.getEncoded()));
+    }
+
+    private class TestACSKeyStoreCallback implements KeyStorePasswordCallback {
+
+        @Override
+        public char[] getStorePassword() {
+            return "airavata".toCharArray();
+        }
+
+        @Override
+        public char[] getSecretKeyPassPhrase(String keyAlias) {
+            if (keyAlias.equals("mykey")) {
+                return "airavatasecretkey".toCharArray();
+            }
+
+            return null;
+        }
+    }
+
+    private void checkEquality(X509Certificate[] certificates1, X509Certificate[] certificates2) {
+
+        int i = 0;
+
+        for (X509Certificate certificate : certificates1) {
+            Assert.assertEquals(certificate, certificates2[i]);
+        }
+
+        Assert.assertEquals(certificates1.length, certificates2.length);
+
+    }
+
+    @Test
+    public void testAddCredentials() throws Exception {
+
+        addTestCredentials();
+
+        Connection connection = getConnection();
+
+        try {
+            CertificateCredential certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1",
+                    "tom", connection);
+            //Test get gateway name
+            String gateway = credentialsDAO.getGatewayID("tom", connection);
+            Assert.assertNotNull(certificateCredential);
+            Assert.assertEquals("jerry", certificateCredential.getPortalUserName());
+            Assert.assertEquals("gw1", gateway);
+            checkEquality(x509Certificates, certificateCredential.getCertificates());
+            Assert.assertEquals(privateKey.getFormat(), certificateCredential.getPrivateKey().getFormat());
+        } finally {
+            connection.close();
+        }
+    }
+    
+    @Test
+    public void testDeleteCredentials() throws Exception {
+
+        addTestCredentials();
+
+        Connection connection = getConnection();
+
+        try {
+            CertificateCredential certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1",
+                    "tom", connection);
+            Assert.assertNotNull(certificateCredential);
+
+            credentialsDAO.deleteCredentials("gw1", "tom", connection);
+
+            certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
+            Assert.assertNull(certificateCredential);
+
+        } finally {
+            connection.close();
+        }
+    }
+
+    @Test
+    public void testUpdateCredentials() throws Exception {
+
+        addTestCredentials();
+
+        Connection connection = getConnection();
+
+        try {
+            CommunityUser communityUser = getCommunityUser("gw1", "tom");
+            CertificateCredential certificateCredential = new CertificateCredential();
+            certificateCredential.setToken("tom");
+            certificateCredential.setCommunityUser(communityUser);
+            certificateCredential.setCertificates(x509Certificates);
+            // certificateCredential.setPrivateKey(privateKey);
+            certificateCredential.setPortalUserName("test2");
+            certificateCredential.setLifeTime(50);
+            certificateCredential.setNotBefore("15 OCT 2012 5:34:23");
+            certificateCredential.setNotAfter("16 OCT 2012 5:34:23");
+
+            credentialsDAO.updateCredentials(communityUser.getGatewayName(), certificateCredential, 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.getCertificates()[0].getIssuerDN().toString());
+            // Assert.assertNotNull(certificateCredential.getPrivateKey());
+            Assert.assertEquals("test2", certificateCredential.getPortalUserName());
+
+        } finally {
+            connection.close();
+        }
+
+    }
+
+    @Test
+    public void testGetCredentials() throws Exception {
+
+        addTestCredentials();
+
+        Connection connection = getConnection();
+
+        try {
+
+            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.getCertificates()[0].getIssuerDN().toString());
+            // Assert.assertNotNull(certificateCredential.getPrivateKey());
+
+        } finally {
+            connection.close();
+        }
+    }
+
+    @Test
+    public void testGetGatewayCredentials() throws Exception {
+
+        addTestCredentials();
+
+        Connection connection = getConnection();
+
+        try {
+            List<Credential> list = credentialsDAO.getCredentials("gw1", connection);
+
+            Assert.assertEquals(1, list.size());
+        } finally {
+            connection.close();
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/util/ConfigurationReaderTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/util/ConfigurationReaderTest.java b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/util/ConfigurationReaderTest.java
new file mode 100644
index 0000000..7a95e3e
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/util/ConfigurationReaderTest.java
@@ -0,0 +1,58 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.credential.store.util;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 8/25/13
+ * Time: 10:28 AM
+ */
+
+public class ConfigurationReaderTest extends TestCase {
+    public void setUp() throws Exception {
+        super.setUp();
+
+    }
+
+    public void testGetSuccessUrl() throws Exception {
+
+        ConfigurationReader configurationReader = new ConfigurationReader();
+        System.out.println(configurationReader.getSuccessUrl());
+        Assert.assertEquals("/credential-store/success.jsp", configurationReader.getSuccessUrl());
+    }
+
+    public void testGetErrorUrl() throws Exception {
+
+        ConfigurationReader configurationReader = new ConfigurationReader();
+        Assert.assertEquals("/credential-store/error.jsp", configurationReader.getErrorUrl());
+
+    }
+
+    public void testRedirectUrl() throws Exception {
+
+        ConfigurationReader configurationReader = new ConfigurationReader();
+        Assert.assertEquals("/credential-store/show-redirect.jsp", configurationReader.getPortalRedirectUrl());
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/util/TokenGeneratorTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/util/TokenGeneratorTest.java b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/util/TokenGeneratorTest.java
new file mode 100644
index 0000000..57b52ae
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/util/TokenGeneratorTest.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.util;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 8/5/13
+ * Time: 4:20 PM
+ */
+
+public class    TokenGeneratorTest extends TestCase {
+
+    public void testGenerateToken() throws Exception {
+
+        String token = TokenGenerator.generateToken("gw1", "admin");
+        Assert.assertNotNull(token);
+        System.out.println(token);
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/test/resources/credential-store/client.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/test/resources/credential-store/client.xml b/modules/credential-store/credential-store-service/src/test/resources/credential-store/client.xml
new file mode 100644
index 0000000..8b934e6
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/test/resources/credential-store/client.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Licensed to the Apache Software
+	Foundation (ASF) under one or more contributor license agreements. See the
+	NOTICE file distributed with this work for additional information regarding
+	copyright ownership. The ASF licenses this file to you under the Apache License,
+	Version 2.0 (theƏ "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+	Unless required by applicable law or agreed to in writing, software distributed
+	under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
+	OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the License. -->
+
+<config>
+    <client name="acs">
+        <logging
+                logFileName="../logs/oa4mp.log"
+                logName="oa4mp"
+                logSize="1000000"
+                logFileCount="2"
+                debug="true"/>
+        <id>myproxy:oa4mp,2012:/client/24c45c2eb65d93231d02d423e94d0362</id>
+        <serviceUri>https://oa4mp.xsede.org/oauth</serviceUri>
+        <callbackUri>https://localhost:8443/airavata/callback</callbackUri>
+        <lifetime>864000</lifetime>
+        <publicKeyFile>../webapps/airavata/WEB-INF/classes/credential-store/oauth-pubkey.pem</publicKeyFile>
+        <privateKeyFile>../webapps/airavata/WEB-INF/classes/credential-store/oauth-privkey.pk8</privateKeyFile>
+    </client>
+
+    <credential-store>
+        <successUri>/credential-store/success.jsp</successUri>
+        <errorUri>/credential-store/error.jsp</errorUri>
+        <redirectUri>/credential-store/show-redirect.jsp</redirectUri>
+    </credential-store>
+
+</config>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/test/resources/keystore.jks
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/test/resources/keystore.jks b/modules/credential-store/credential-store-service/src/test/resources/keystore.jks
new file mode 100644
index 0000000..14cf022
Binary files /dev/null and b/modules/credential-store/credential-store-service/src/test/resources/keystore.jks differ

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/test/resources/mykeystore.jks
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/test/resources/mykeystore.jks b/modules/credential-store/credential-store-service/src/test/resources/mykeystore.jks
new file mode 100644
index 0000000..335ebf8
Binary files /dev/null and b/modules/credential-store/credential-store-service/src/test/resources/mykeystore.jks differ

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-stubs/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/pom.xml b/modules/credential-store/credential-store-stubs/pom.xml
new file mode 100644
index 0000000..2a1c431
--- /dev/null
+++ b/modules/credential-store/credential-store-stubs/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+    the Apache License, Version 2.0 (theƏ "License"); you may not use this file except in compliance with the License. You may
+    obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+    in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+    ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+    the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>credential-store</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <version>0.15-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <name>Credential Store CPI Stubs</name>
+    <artifactId>airavata-credential-store-stubs</artifactId>
+    <packaging>jar</packaging>
+    <url>http://airavata.apache.org/</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.thrift</groupId>
+            <artifactId>libthrift</artifactId>
+            <version>${thrift.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>${org.slf4j.version}</version>
+        </dependency>
+    </dependencies>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    </properties>
+
+</project>
\ No newline at end of file


[06/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java
new file mode 100644
index 0000000..e52b211
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifier.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.notifier.impl;
+
+import org.apache.airavata.credential.store.notifier.CredentialStoreNotifier;
+import org.apache.airavata.credential.store.notifier.NotificationMessage;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.apache.commons.mail.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 12/3/13
+ * Time: 4:25 PM
+ */
+
+public class EmailNotifier implements CredentialStoreNotifier {
+
+    protected static Logger log = LoggerFactory.getLogger(EmailNotifier.class);
+
+    private EmailNotifierConfiguration emailNotifierConfiguration;
+
+    public EmailNotifier(EmailNotifierConfiguration notifierConfiguration) {
+        this.emailNotifierConfiguration = notifierConfiguration;
+    }
+
+    public void notifyMessage(NotificationMessage message) throws CredentialStoreException {
+        try {
+            Email email = new SimpleEmail();
+            email.setHostName(this.emailNotifierConfiguration.getEmailServer());
+            email.setSmtpPort(this.emailNotifierConfiguration.getEmailServerPort());
+            email.setAuthenticator(new DefaultAuthenticator(this.emailNotifierConfiguration.getEmailUserName(),
+                    this.emailNotifierConfiguration.getEmailPassword()));
+            email.setSSLOnConnect(this.emailNotifierConfiguration.isSslConnect());
+            email.setFrom(this.emailNotifierConfiguration.getFromAddress());
+
+            EmailNotificationMessage emailMessage = (EmailNotificationMessage)message;
+
+            email.setSubject(emailMessage.getSubject());
+            email.setMsg(emailMessage.getMessage());
+            email.addTo(emailMessage.getSenderEmail());
+            email.send();
+
+        } catch (EmailException e) {
+            log.error("[CredentialStore]Error sending email notification message.");
+            throw new CredentialStoreException("Error sending email notification message", e);
+        }
+
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java
new file mode 100644
index 0000000..b1a204f
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierConfiguration.java
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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.notifier.impl;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ApplicationSettings;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 12/3/13
+ * Time: 5:06 PM
+ */
+
+public class EmailNotifierConfiguration {
+    private String emailServer;
+    private int emailServerPort;
+    private String emailUserName;
+    private String emailPassword;
+    private boolean sslConnect;
+    private String fromAddress;
+
+    public EmailNotifierConfiguration(String emailServer, int emailServerPort, String emailUserName,
+                                      String emailPassword, boolean sslConnect, String fromAddress) {
+        this.emailServer = emailServer;
+        this.emailServerPort = emailServerPort;
+        this.emailUserName = emailUserName;
+        this.emailPassword = emailPassword;
+        this.sslConnect = sslConnect;
+        this.fromAddress = fromAddress;
+    }
+
+    public String getEmailServer() {
+        return emailServer;
+    }
+
+    public int getEmailServerPort() {
+        return emailServerPort;
+    }
+
+    public String getEmailUserName() {
+        return emailUserName;
+    }
+
+    public String getEmailPassword() {
+        return emailPassword;
+    }
+
+    public boolean isSslConnect() {
+        return sslConnect;
+    }
+
+    public String getFromAddress() {
+        return fromAddress;
+    }
+
+    public static EmailNotifierConfiguration getEmailNotifierConfigurations() throws ApplicationSettingsException {
+        return new EmailNotifierConfiguration(ApplicationSettings.getCredentialStoreEmailServer(),
+                Integer.parseInt(ApplicationSettings.getCredentialStoreEmailServerPort()),
+                ApplicationSettings.getCredentialStoreEmailUser(),
+                ApplicationSettings.getCredentialStoreEmailPassword(),
+                Boolean.parseBoolean(ApplicationSettings.getCredentialStoreEmailSSLConnect()),
+                ApplicationSettings.getCredentialStoreEmailFromEmail());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
new file mode 100644
index 0000000..f0e14d5
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
@@ -0,0 +1,158 @@
+/*
+ *
+ * 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.server;
+
+
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.common.utils.IServer;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.credential.store.cpi.CredentialStoreService;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TSSLTransportFactory;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+
+public class CredentialStoreServer  implements IServer {
+    private final static Logger logger = LoggerFactory.getLogger(CredentialStoreServer.class);
+    private static final String SERVER_NAME = "Credential Store Server";
+    private static final String SERVER_VERSION = "1.0";
+
+    private IServer.ServerStatus status;
+    private TServer server;
+
+    public CredentialStoreServer() {
+        setStatus(IServer.ServerStatus.STOPPED);
+    }
+
+    @Override
+    public String getName() {
+        return SERVER_NAME;
+    }
+
+    @Override
+    public String getVersion() {
+        return SERVER_VERSION;
+    }
+
+    @Override
+    public void start() throws Exception {
+        if(ServerSettings.isCredentialStoreStartEnabled()) {
+            try {
+                setStatus(ServerStatus.STARTING);
+                TSSLTransportFactory.TSSLTransportParameters params =
+                        new TSSLTransportFactory.TSSLTransportParameters();
+                String keystorePath = ServerSettings.getCredentialStoreThriftServerKeyStorePath();
+                String keystorePWD = ServerSettings.getCredentialStoreThriftServerKeyStorePassword();
+                final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_PORT, "8960"));
+                final String serverHost = ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_HOST, null);
+                params.setKeyStore(keystorePath, keystorePWD);
+
+                TServerSocket serverTransport = TSSLTransportFactory.getServerSocket(serverPort, 100, InetAddress.getByName(serverHost), params);
+
+
+                CredentialStoreService.Processor processor = new CredentialStoreService.Processor(new CredentialStoreServerHandler());
+
+                server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).
+                        processor(processor));
+                new Thread() {
+                    public void run() {
+                        server.serve();
+                        setStatus(ServerStatus.STOPPED);
+                        logger.info("Credential Store Server Stopped.");
+                    }
+                }.start();
+                new Thread() {
+                    public void run() {
+                        while (!server.isServing()) {
+                            try {
+                                Thread.sleep(500);
+                            } catch (InterruptedException e) {
+                                break;
+                            }
+                        }
+                        if (server.isServing()) {
+                            setStatus(ServerStatus.STARTED);
+                            logger.info("Starting Credential Store Server on Port " + serverPort);
+                            logger.info("Listening to Credential Store Clients ....");
+                        }
+                    }
+                }.start();
+            } catch (TTransportException e) {
+                setStatus(ServerStatus.FAILED);
+                logger.error("Error while starting the credential store service", e);
+                throw new Exception("Error while starting the credential store service", e);
+            }
+        }
+    }
+
+    public static void main(String[] args) {
+        try {
+            new CredentialStoreServer().start();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    public void stop() throws Exception {
+        if (server!=null && server.isServing()){
+            setStatus(ServerStatus.STOPING);
+            server.stop();
+        }
+    }
+
+    @Override
+    public void restart() throws Exception {
+        stop();
+        start();
+    }
+
+    @Override
+    public void configure() throws Exception {
+
+    }
+
+    @Override
+    public ServerStatus getStatus() throws Exception {
+        return null;
+    }
+
+    private void setStatus(IServer.ServerStatus stat){
+        status=stat;
+        status.updateTime();
+    }
+
+    public TServer getServer() {
+        return server;
+    }
+
+    public void setServer(TServer server) {
+        this.server = server;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
new file mode 100644
index 0000000..b5b1ac0
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
@@ -0,0 +1,202 @@
+/*
+ *
+ * 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.server;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.credential.store.cpi.CredentialStoreService;
+import org.apache.airavata.credential.store.cpi.cs_cpi_serviceConstants;
+import org.apache.airavata.credential.store.credential.CommunityUser;
+import org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.datamodel.CertificateCredential;
+import org.apache.airavata.credential.store.datamodel.PasswordCredential;
+import org.apache.airavata.credential.store.datamodel.SSHCredential;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.apache.airavata.credential.store.store.impl.CertificateCredentialWriter;
+import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
+import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter;
+import org.apache.airavata.credential.store.util.TokenGenerator;
+import org.apache.airavata.credential.store.util.Utility;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import sun.security.provider.X509Factory;
+
+import java.io.ByteArrayInputStream;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.UUID;
+
+public class CredentialStoreServerHandler implements CredentialStoreService.Iface {
+    protected static Logger log = LoggerFactory.getLogger(CredentialStoreServerHandler.class);
+    private DBUtil dbUtil;
+    private SSHCredentialWriter sshCredentialWriter;
+    private CertificateCredentialWriter certificateCredentialWriter;
+    private CredentialReaderImpl credentialReader;
+
+    public CredentialStoreServerHandler() throws ApplicationSettingsException, IllegalAccessException, ClassNotFoundException, InstantiationException {
+        String jdbcUrl = ServerSettings.getCredentialStoreDBURL();
+        String userName = ServerSettings.getCredentialStoreDBUser();
+        String password = ServerSettings.getCredentialStoreDBPassword();
+        String driverName = ServerSettings.getCredentialStoreDBDriver();
+
+        log.debug("Starting credential store, connecting to database - " + jdbcUrl + " DB user - " + userName + " driver name - " + driverName);
+        dbUtil = new DBUtil(jdbcUrl, userName, password, driverName);
+        sshCredentialWriter = new SSHCredentialWriter(dbUtil);
+        certificateCredentialWriter = new CertificateCredentialWriter(dbUtil);
+        credentialReader = new CredentialReaderImpl(dbUtil);
+    }
+
+    @Override
+    public String getCSServiceVersion() throws TException {
+        return cs_cpi_serviceConstants.CS_CPI_VERSION;
+    }
+
+    @Override
+    public String addSSHCredential(SSHCredential sshCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
+        try {
+            org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential credential = new org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential();
+            credential.setGateway(sshCredential.getGatewayId());
+            credential.setPortalUserName(sshCredential.getUsername());
+            // only username and gateway id will be sent by client.
+            String token = TokenGenerator.generateToken(sshCredential.getGatewayId(), null);
+            credential.setToken(token);
+            credential.setPassphrase(String.valueOf(UUID.randomUUID()));
+            if (sshCredential.getPrivateKey() != null) {
+                credential.setPrivateKey(sshCredential.getPrivateKey().getBytes());
+            }
+            if (sshCredential.getPublicKey() != null) {
+                credential.setPublicKey(sshCredential.getPublicKey().getBytes());
+            }
+            if (sshCredential.getPublicKey() == null || sshCredential.getPrivateKey() == null) {
+                credential = Utility.generateKeyPair(credential);
+            }
+            sshCredentialWriter.writeCredentials(credential);
+            return token;
+        } catch (CredentialStoreException e) {
+            log.error("Error occurred while saving SSH Credentials.", e);
+            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while saving SSH Credentials.");
+        } catch (Exception e) {
+            log.error("Error occurred while generating key pair.", e);
+            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while generating key pair..");
+        }
+    }
+
+    @Override
+    public String addCertificateCredential(CertificateCredential certificateCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
+        try {
+            org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential credential = new org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential();
+            credential.setPortalUserName(certificateCredential.getCommunityUser().getUsername());
+            credential.setCommunityUser(new CommunityUser(certificateCredential.getCommunityUser().getGatewayNmae(),
+                    certificateCredential.getCommunityUser().getUsername(), certificateCredential.getCommunityUser().getUserEmail()));
+            String token = TokenGenerator.generateToken(certificateCredential.getCommunityUser().getGatewayNmae(), null);
+            credential.setToken(token);
+            Base64 encoder = new Base64(64);
+            byte [] decoded = encoder.decode(certificateCredential.getX509Cert().replaceAll(X509Factory.BEGIN_CERT, "").replaceAll(X509Factory.END_CERT, ""));
+            CertificateFactory cf = CertificateFactory.getInstance("X.509");
+            X509Certificate certificate = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(decoded));
+            X509Certificate[] certificates = new X509Certificate[1];
+            certificates[0] = certificate;
+            credential.setCertificates(certificates);
+            certificateCredentialWriter.writeCredentials(credential);
+            return token;
+        } catch (CredentialStoreException e) {
+            log.error("Error occurred while saving Certificate Credentials.", e);
+            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while saving Certificate Credentials.");
+        } catch (Exception e) {
+            log.error("Error occurred while converting to X509 certificate.", e);
+            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while converting to X509 certificate..");
+        }
+    }
+
+    @Override
+    public String addPasswordCredential(PasswordCredential passwordCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
+        return null;
+    }
+
+    @Override
+    public SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
+        try {
+            Credential credential = credentialReader.getCredential(gatewayId, tokenId);
+            if (credential instanceof org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) {
+                org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential credential1 = (org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) credential;
+                SSHCredential sshCredential = new SSHCredential();
+                sshCredential.setUsername(credential1.getPortalUserName());
+                sshCredential.setGatewayId(credential1.getGateway());
+                sshCredential.setPublicKey(new String(credential1.getPublicKey()));
+                sshCredential.setPrivateKey(new String(credential1.getPrivateKey()));
+                sshCredential.setPassphrase(credential1.getPassphrase());
+                sshCredential.setToken(credential1.getToken());
+                sshCredential.setPersistedTime(credential1.getCertificateRequestedTime().getTime());
+                return sshCredential;
+            } else {
+                log.info("Could not find SSH credentials for token - " + tokenId + " and "
+                        + "gateway id - " + gatewayId);
+                return null;
+            }
+        } catch (CredentialStoreException e) {
+            log.error("Error occurred while retrieving SSH credentialfor token - " +  tokenId + " and gateway id - " + gatewayId, e);
+            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while retrieving SSH credential for token - " +  tokenId + " and gateway id - " + gatewayId);
+        }
+    }
+
+    @Override
+    public CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
+        try {
+            Credential credential = credentialReader.getCredential(gatewayId, tokenId);
+            if (credential instanceof org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential) {
+                org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential credential1 = (org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential) credential;
+                CertificateCredential certificateCredential = new CertificateCredential();
+                org.apache.airavata.credential.store.datamodel.CommunityUser communityUser = new org.apache.airavata.credential.store.datamodel.CommunityUser();
+                communityUser.setGatewayNmae(credential1.getCommunityUser().getGatewayName());
+                communityUser.setUsername(credential1.getCommunityUser().getUserName());
+                communityUser.setUserEmail(credential1.getCommunityUser().getUserEmail());
+                certificateCredential.setCommunityUser(communityUser);
+                certificateCredential.setToken(credential1.getToken());
+                certificateCredential.setLifeTime(credential1.getLifeTime());
+                certificateCredential.setNotAfter(credential1.getNotAfter());
+                certificateCredential.setNotBefore(credential1.getNotBefore());
+                certificateCredential.setPersistedTime(credential1.getCertificateRequestedTime().getTime());
+                if (credential1.getPrivateKey() != null){
+                    certificateCredential.setPrivateKey(credential1.getPrivateKey().toString());
+                }
+                certificateCredential.setX509Cert(credential1.getCertificates()[0].toString());
+                return certificateCredential;
+            } else {
+                log.info("Could not find Certificate credentials for token - " + tokenId + " and "
+                        + "gateway id - " + gatewayId);
+                return null;
+            }
+        } catch (CredentialStoreException e) {
+            log.error("Error occurred while retrieving Certificate credential for token - " +  tokenId + " and gateway id - " + gatewayId, e);
+            throw new org.apache.airavata.credential.store.exception.CredentialStoreException("Error occurred while retrieving Certificate credential for token - " +  tokenId + " and gateway id - " + gatewayId);
+        }
+    }
+
+    @Override
+    public PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, TException {
+        return null;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java
new file mode 100644
index 0000000..b2e8786
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialBootstrapper.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * 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.servlet;
+
+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;
+
+/**
+ * Bootstrapper class for credential-store.
+ */
+public class CredentialBootstrapper extends ClientBootstrapper {
+
+    protected static Logger log = LoggerFactory.getLogger(CredentialBootstrapper.class);
+
+    public ConfigurationLoader getConfigurationLoader(ServletContext servletContext) throws Exception {
+
+        File currentDirectory = new File(".");
+
+        log.info("Current directory is - " + currentDirectory.getAbsolutePath());
+
+        return super.getConfigurationLoader(servletContext);
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
new file mode 100644
index 0000000..66d4be7
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
@@ -0,0 +1,272 @@
+/*
+ *
+ * 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.servlet;
+
+import edu.uiuc.ncsa.myproxy.oa4mp.client.AssetResponse;
+import edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment;
+import edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPService;
+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 org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ApplicationSettings;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.credential.store.credential.CommunityUser;
+import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
+import org.apache.airavata.credential.store.notifier.NotifierBootstrap;
+import org.apache.airavata.credential.store.notifier.impl.EmailNotifierConfiguration;
+import org.apache.airavata.credential.store.store.impl.CertificateCredentialWriter;
+import org.apache.airavata.credential.store.util.ConfigurationReader;
+import org.apache.airavata.credential.store.util.CredentialStoreConstants;
+import org.apache.airavata.credential.store.util.PrivateKeyStore;
+import org.apache.airavata.credential.store.util.Utility;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+import java.util.HashMap;
+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.
+ */
+public class CredentialStoreCallbackServlet extends ClientServlet {
+
+    private OA4MPService oa4mpService;
+
+    private CertificateCredentialWriter certificateCredentialWriter;
+
+    private static ConfigurationReader configurationReader;
+
+    private NotifierBootstrap notifierBootstrap;
+
+    public void init() throws ServletException {
+
+        DBUtil dbUtil;
+
+        try {
+            AiravataUtils.setExecutionAsServer();
+            dbUtil = DBUtil.getCredentialStoreDBUtil();
+        } catch (Exception e) {
+            throw new ServletException("Error initializing database operations.", e);
+        }
+
+        try {
+            configurationReader = new ConfigurationReader();
+            super.init();
+            certificateCredentialWriter = new CertificateCredentialWriter(dbUtil);
+        } catch (Exception e) {
+            throw new ServletException("Error initializing configuration reader.", e);
+        }
+
+
+        // initialize notifier
+        try {
+            boolean enabled = Boolean.parseBoolean(ApplicationSettings.getCredentialStoreNotifierEnabled());
+
+            if (enabled) {
+                EmailNotifierConfiguration notifierConfiguration
+                        = EmailNotifierConfiguration.getEmailNotifierConfigurations();
+                long duration = Long.parseLong(ApplicationSettings.getCredentialStoreNotifierDuration());
+
+                notifierBootstrap = new NotifierBootstrap(duration, dbUtil, notifierConfiguration);
+            }
+
+        } catch (ApplicationSettingsException e) {
+            throw new ServletException("Error initializing notifier.", e);
+        }
+
+
+        info("Credential store callback initialized successfully.");
+    }
+
+    @Override
+    public OA4MPService getOA4MPService() {
+        return oa4mpService;
+    }
+
+    @Override
+    public void loadEnvironment() throws IOException {
+        environment = getConfigurationLoader().load();
+        oa4mpService = new OA4MPService((ClientEnvironment) environment);
+    }
+
+    @Override
+    protected void doIt(HttpServletRequest request, HttpServletResponse response) throws Throwable {
+
+        String gatewayName = request.getParameter(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER);
+        String portalUserName = request.getParameter(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER);
+        String durationParameter = request.getParameter(CredentialStoreConstants.DURATION_QUERY_PARAMETER);
+        String contactEmail = request.getParameter(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER);
+        String portalTokenId = request.getParameter(CredentialStoreConstants.PORTAL_TOKEN_ID_ASSIGNED);
+
+        // TODO remove hard coded values, once passing query parameters is
+        // fixed in OA4MP client api
+        long duration = 864000;
+
+        if (durationParameter != null) {
+            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, configurationReader.getErrorUrl());
+            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(CONST(ClientEnvironment.TOKEN));
+        String verifier = request.getParameter(CONST(ClientEnvironment.VERIFIER));
+        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.");
+            request.setAttribute("exception", ge);
+            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
+            return;
+        }
+        info("2.a Token and verifier found.");
+        X509Certificate[] certificates;
+        AssetResponse assetResponse = null;
+
+        PrivateKey privateKey;
+
+        try {
+
+            PrivateKeyStore privateKeyStore = PrivateKeyStore.getPrivateKeyStore();
+            privateKey = privateKeyStore.getKey(portalTokenId);
+
+            if (privateKey != null) {
+                info("Found private key for token " + portalTokenId);
+            } else {
+                info("Could not find private key for token " + portalTokenId);
+            }
+
+            info("2.a. Getting the cert(s) from the service");
+            assetResponse = getOA4MPService().getCert(token, verifier);
+
+            certificates = assetResponse.getX509Certificates();
+
+        } catch (Throwable t) {
+            warn("2.a. Exception from the server: " + t.getCause().getMessage());
+            error("Exception while trying to get cert. message:" + t.getMessage());
+            request.setAttribute("exception", t);
+            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
+            return;
+        }
+
+        info("2.b. Done! Displaying success page.");
+
+        CertificateCredential certificateCredential = new CertificateCredential();
+
+        certificateCredential.setNotBefore(Utility.convertDateToString(certificates[0].getNotBefore())); //TODO check this is correct
+        certificateCredential.setNotAfter(Utility.convertDateToString(certificates[0].getNotAfter()));
+        certificateCredential.setCertificates(certificates);
+        certificateCredential.setPrivateKey(privateKey);
+        certificateCredential
+                .setCommunityUser(new CommunityUser(gatewayName, assetResponse.getUsername(), contactEmail));
+        certificateCredential.setPortalUserName(portalUserName);
+        certificateCredential.setLifeTime(duration);
+        certificateCredential.setToken(portalTokenId);
+
+
+        certificateCredentialWriter.writeCredentials(certificateCredential);
+
+        StringBuilder stringBuilder = new StringBuilder("Certificate for community user ");
+        stringBuilder.append(assetResponse.getUsername()).append(" successfully persisted.");
+        stringBuilder.append(" Certificate DN - ").append(certificates[0].getSubjectDN());
+
+        info(stringBuilder.toString());
+
+        if (isUrlInSameServer(configurationReader.getSuccessUrl())) {
+
+            String contextPath = request.getContextPath();
+            if (!contextPath.endsWith("/")) {
+                contextPath = contextPath + "/";
+            }
+            request.setAttribute("action", contextPath);
+            request.setAttribute("tokenId", portalTokenId);
+            JSPUtil.fwd(request, response, configurationReader.getSuccessUrl());
+        } else {
+
+            String urlToRedirect = decorateUrlWithToken(configurationReader.getSuccessUrl(), portalTokenId);
+
+            info("Redirecting to url - " + urlToRedirect);
+
+            response.sendRedirect(urlToRedirect);
+        }
+
+        info("2.a. Completely finished with delegation.");
+
+    }
+
+    private boolean isUrlInSameServer(String url) {
+
+        return !(url.toLowerCase().startsWith("http") || url.toLowerCase().startsWith("https"));
+
+    }
+
+    private String decorateUrlWithToken(String url, String tokenId) {
+
+        StringBuilder stringBuilder = new StringBuilder(url);
+        stringBuilder.append("?tokenId=").append(tokenId);
+        return stringBuilder.toString();
+    }
+
+    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();
+
+        String callbackUri = clientEnvironment.getCallback().toString();
+
+        StringBuilder stringBuilder = new StringBuilder(callbackUri);
+
+        stringBuilder.append("?").append(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER).append("=").append(gatewayName).append("&")
+                .append(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER).append("=").append(portalUserName).append("&")
+                .append(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER).append("=").append(portalEmail).append("&")
+                .append(CredentialStoreConstants.PORTAL_TOKEN_ID_ASSIGNED).append("=").append(tokenId);
+
+        info("Callback URI is set to - " + stringBuilder.toString());
+
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put(callbackUriKey, stringBuilder.toString());
+
+        return parameters;
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java
new file mode 100644
index 0000000..3b70242
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreStartServlet.java
@@ -0,0 +1,183 @@
+/*
+ *
+ * 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.servlet;
+
+import edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment;
+import edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPResponse;
+import edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPService;
+import edu.uiuc.ncsa.myproxy.oa4mp.client.servlet.ClientServlet;
+import edu.uiuc.ncsa.security.servlet.JSPUtil;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.apache.airavata.credential.store.util.ConfigurationReader;
+import org.apache.airavata.credential.store.util.CredentialStoreConstants;
+import org.apache.airavata.credential.store.util.PrivateKeyStore;
+import org.apache.airavata.credential.store.util.TokenGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import static edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment.CALLBACK_URI_KEY;
+
+/**
+ * When portal initiate a request to get credentials it will hit this servlet.
+ */
+public class CredentialStoreStartServlet extends ClientServlet {
+
+    private static ConfigurationReader configurationReader = null;
+
+    private static Logger log = LoggerFactory.getLogger(CredentialStoreStartServlet.class);
+    private OA4MPService oa4mpService;
+
+    protected String decorateURI(URI inputURI, Map<String, String> parameters) {
+
+        if (parameters.isEmpty()) {
+            return inputURI.toString();
+        }
+
+        String stringUri = inputURI.toString();
+        StringBuilder stringBuilder = new StringBuilder(stringUri);
+
+        boolean isFirst = true;
+
+        for (Map.Entry<String, String> entry : parameters.entrySet()) {
+            if (isFirst) {
+                stringBuilder.append("?");
+                isFirst = false;
+            } else {
+                stringBuilder.append("&");
+            }
+
+            stringBuilder.append(entry.getKey()).append("=").append(entry.getValue());
+        }
+
+        return stringBuilder.toString();
+
+    }
+
+    public void init() throws ServletException {
+
+        super.init();
+
+        try {
+            if (configurationReader == null) {
+                configurationReader = new ConfigurationReader();
+            }
+        } catch (CredentialStoreException e) {
+            throw new ServletException(e);
+        }
+
+    }
+
+    @Override
+    public OA4MPService getOA4MPService() {
+        return oa4mpService;
+    }
+
+    @Override
+    public void loadEnvironment() throws IOException {
+        environment = getConfigurationLoader().load();
+        oa4mpService = new OA4MPService((ClientEnvironment) environment);
+    }
+
+    @Override
+    protected void doIt(HttpServletRequest request, HttpServletResponse response) throws Throwable {
+
+        String gatewayName
+                = request.getParameter(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER);
+        String portalUserName
+                = request.getParameter(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER);
+        String contactEmail
+                = request.getParameter(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER);
+        String associatedToken = TokenGenerator.generateToken(gatewayName, portalUserName);
+
+        if (gatewayName == null) {
+            JSPUtil.handleException(new RuntimeException("Please specify a gateway name."), request, response,
+                    configurationReader.getErrorUrl());
+            return;
+        }
+
+        if (portalUserName == null) {
+            JSPUtil.handleException(new RuntimeException("Please specify a portal user name."), request, response,
+                    configurationReader.getErrorUrl());
+            return;
+        }
+
+        if (contactEmail == null) {
+            JSPUtil.handleException(new RuntimeException("Please specify a contact email address for community"
+                    + " user account."), request, response, configurationReader.getErrorUrl());
+            return;
+        }
+
+        log.info("1.a. Starting transaction");
+        OA4MPResponse gtwResp;
+
+        Map<String, String> queryParameters = new HashMap<String, String>();
+        queryParameters.put(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER, gatewayName);
+        queryParameters.put(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER, portalUserName);
+        queryParameters.put(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER, contactEmail);
+        queryParameters.put(CredentialStoreConstants.PORTAL_TOKEN_ID_ASSIGNED, associatedToken);
+
+        Map<String, String> additionalParameters = new HashMap<String, String>();
+
+        if (getOA4MPService() == null) {
+            loadEnvironment();
+        }
+
+        String modifiedCallbackUri = decorateURI(getOA4MPService().getEnvironment().getCallback(), queryParameters);
+
+        info("The modified callback URI - " + modifiedCallbackUri);
+
+        additionalParameters.put(getEnvironment().getConstants().get(CALLBACK_URI_KEY), modifiedCallbackUri);
+
+        try {
+            gtwResp = getOA4MPService().requestCert(additionalParameters);
+
+            // Private key in store
+            PrivateKeyStore privateKeyStore = PrivateKeyStore.getPrivateKeyStore();
+            privateKeyStore.addKey(associatedToken, gtwResp.getPrivateKey());
+
+        } catch (Throwable t) {
+            JSPUtil.handleException(t, request, response, configurationReader.getErrorUrl());
+            return;
+        }
+        log.info("1.b. Got response. Creating page with redirect for " + gtwResp.getRedirect().getHost());
+        // Normally, we'd just do a redirect, but we will put up a page and show the redirect to the user.
+        // The client response contains the generated private key as well
+        // In a real application, the private key would be stored. This, however, exceeds the scope of this
+        // sample application -- all we need to do to complete the process is send along the redirect url.
+
+        request.setAttribute(REDIR, REDIR);
+        request.setAttribute("redirectUrl", gtwResp.getRedirect().toString());
+        request.setAttribute(ACTION_KEY, ACTION_KEY);
+        request.setAttribute("action", ACTION_REDIRECT_VALUE);
+        log.info("1.b. Showing redirect page.");
+        JSPUtil.fwd(request, response, configurationReader.getPortalRedirectUrl());
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
new file mode 100644
index 0000000..fe54b8e
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
@@ -0,0 +1,112 @@
+/*
+ *
+ * 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;
+
+import java.util.List;
+
+/**
+ * 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
+     * @return The Credential object associated with the token.
+     * @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.
+     * @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.
+     * @return CertificateAuditInfo object.
+     */
+    AuditInfo getAuditInfo(String gatewayName, String tokenId) throws CredentialStoreException;
+
+    /**
+     * Gets all the credential records.
+     * @return All credential records as a list
+     * @throws CredentialStoreException If an error occurred while retrieving credentials.
+     */
+    public List<Credential> getAllCredentials() throws CredentialStoreException;
+
+    /**
+     * Updates the community user contact email address.
+     *
+     * @param gatewayName
+     *            The gateway name.
+     * @param communityUser
+     *            The community user name.
+     * @param email
+     *            The new email address.
+     */
+    void updateCommunityUserEmail(String gatewayName, String communityUser, String email)
+            throws CredentialStoreException;
+
+    /**
+     * Will remove credentials for the given gateway id and community user.
+     * 
+     * @param gatewayName
+     *            The gateway Id
+     * @param tokenId
+     *            The issued token id.
+     * @throws CredentialStoreException
+     *             If an error occurred while retrieving data.
+     */
+    void removeCredentials(String gatewayName, String tokenId) throws CredentialStoreException;
+    
+    /**
+     * Retrieves gatewayID from the credential store.
+     * 
+     * @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.
+     */
+    String getGatewayID(String tokenId) throws CredentialStoreException;
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java
new file mode 100644
index 0000000..f4b5e21
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReaderFactory.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.credential.store.store;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
+
+/**
+ * Factory class to create credential store readers.
+ */
+public class CredentialReaderFactory {
+
+    /**
+     * Creates a credential reader using supplied database configurations.
+     * @param dbUti The database configurations.
+     * @return CredentialReader object.
+     */
+    public static CredentialReader createCredentialStoreReader(DBUtil dbUti) throws ApplicationSettingsException {
+        return new CredentialReaderImpl(dbUti);
+    }
+
+    /**
+     * Creates credential reader using default configurations for credential store database.
+     * @return The credential reader.
+     * @throws ClassNotFoundException If an error occurred while instantiating jdbc driver
+     * @throws ApplicationSettingsException If an error occurred while reading database configurations.
+     * @throws InstantiationException If an error occurred while instantiating jdbc driver
+     * @throws IllegalAccessException A security exception accessing jdbc driver.
+     */
+    public static CredentialReader createCredentialStoreReader() throws ClassNotFoundException,
+            ApplicationSettingsException, InstantiationException, IllegalAccessException {
+        return new CredentialReaderImpl(DBUtil.getCredentialStoreDBUtil());
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java
new file mode 100644
index 0000000..07bed10
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialStoreException.java
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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;
+
+/**
+ * An exception class for credential store.
+ */
+public class CredentialStoreException extends Exception {
+
+    public CredentialStoreException() {
+        super();
+    }
+
+    public CredentialStoreException(String s) {
+        super(s);
+    }
+
+    public CredentialStoreException(String s, Throwable throwable) {
+        super(s, throwable);
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java
new file mode 100644
index 0000000..05ae9fe
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialWriter.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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;
+
+/**
+ * The entity who's writing credentials to DB will use this interface.
+ */
+public interface CredentialWriter {
+
+    /**
+     * Writes given credentials to a persistent storage.
+     * 
+     * @param credential
+     *            The credentials implementation.
+     */
+    void writeCredentials(Credential credential) throws CredentialStoreException;
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java
new file mode 100644
index 0000000..8b96187
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CertificateCredentialWriter.java
@@ -0,0 +1,121 @@
+/*
+ *
+ * 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.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ApplicationSettings;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.common.utils.DefaultKeyStorePasswordCallback;
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Writes certificate credentials to database.
+ */
+public class CertificateCredentialWriter implements CredentialWriter {
+
+    private CredentialsDAO credentialsDAO;
+    private CommunityUserDAO communityUserDAO;
+
+    protected static Logger log = LoggerFactory.getLogger(CertificateCredentialWriter.class);
+
+    private DBUtil dbUtil;
+
+    public CertificateCredentialWriter(DBUtil dbUtil) throws ApplicationSettingsException {
+
+        this.dbUtil = dbUtil;
+
+        this.credentialsDAO = new CredentialsDAO(ApplicationSettings.getCredentialStoreKeyStorePath(),
+                ApplicationSettings.getCredentialStoreKeyAlias(), new DefaultKeyStorePasswordCallback());
+
+        communityUserDAO = new CommunityUserDAO();
+    }
+
+    public void writeCredentials(Credential credential) throws CredentialStoreException {
+
+        CertificateCredential certificateCredential = (CertificateCredential) credential;
+
+        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);
+
+            if (!connection.getAutoCommit()) {
+                connection.commit();
+            }
+
+        } catch (SQLException e) {
+            if (connection != null) {
+                try {
+                    connection.rollback();
+                } catch (SQLException e1) {
+                    log.error("Unable to rollback transaction", e1);
+                }
+            }
+            throw new CredentialStoreException("Unable to retrieve database connection.", e);
+        } finally {
+            DBUtil.cleanup(connection);
+        }
+
+    }
+
+    public void writeCommunityUser(CommunityUser communityUser, String token, Connection connection)
+            throws CredentialStoreException {
+
+        // First delete existing community user
+        communityUserDAO.deleteCommunityUserByToken(communityUser, token, connection);
+
+        // Persist new community user
+        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); } }
+     */
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
new file mode 100644
index 0000000..dc2fd60
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
@@ -0,0 +1,162 @@
+/*
+ *
+ * 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.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ApplicationSettings;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.common.utils.DefaultKeyStorePasswordCallback;
+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;
+import java.util.List;
+
+/**
+ * Credential store API implementation.
+ */
+public class CredentialReaderImpl implements CredentialReader, Serializable {
+
+    private CredentialsDAO credentialsDAO;
+
+    private DBUtil dbUtil;
+
+    public CredentialReaderImpl(DBUtil dbUtil) throws ApplicationSettingsException {
+
+        this.credentialsDAO = new CredentialsDAO(ApplicationSettings.getCredentialStoreKeyStorePath(),
+                ApplicationSettings.getCredentialStoreKeyAlias(), new DefaultKeyStorePasswordCallback());
+
+        this.dbUtil = dbUtil;
+    }
+
+    private Connection getConnection() throws CredentialStoreException {
+        try {
+            return this.dbUtil.getConnection();
+        } catch (SQLException e) {
+            throw new CredentialStoreException("Unable to retrieve database connection.", e);
+        }
+    }
+
+    @Override
+    public Credential getCredential(String gatewayId, String tokenId) throws CredentialStoreException {
+
+        Connection connection = getConnection();
+
+        try {
+            return this.credentialsDAO.getCredential(gatewayId, tokenId, connection);
+        } finally {
+            DBUtil.cleanup(connection);
+        }
+    }
+
+    public List<Credential> getAllCredentials() throws CredentialStoreException {
+
+        Connection connection = getConnection();
+
+        try {
+            return this.credentialsDAO.getCredentials(connection);
+        } finally {
+            DBUtil.cleanup(connection);
+        }
+
+    }
+
+    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();
+    }
+
+    public CertificateAuditInfo getAuditInfo(String gatewayName, String tokenId) throws CredentialStoreException {
+
+        Connection connection = getConnection();
+
+        CertificateAuditInfo certificateAuditInfo;
+
+        try {
+
+            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;
+    }
+
+    public void updateCommunityUserEmail(String gatewayName, String communityUser, String email)
+            throws CredentialStoreException {
+        // TODO
+    }
+
+    public void removeCredentials(String gatewayName, String tokenId) throws CredentialStoreException {
+
+        Connection connection = getConnection();
+
+        try {
+            credentialsDAO.deleteCredentials(gatewayName, tokenId, connection);
+        } finally {
+            DBUtil.cleanup(connection);
+        }
+
+    }
+
+	@Override
+	public String getGatewayID(String tokenId) throws CredentialStoreException {
+		 Connection connection = getConnection();
+	        try {
+	            return this.credentialsDAO.getGatewayID(tokenId, connection);
+	        } finally {
+	            DBUtil.cleanup(connection);
+	        }
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/SSHCredentialWriter.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/SSHCredentialWriter.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/SSHCredentialWriter.java
new file mode 100644
index 0000000..ad4f6b3
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/SSHCredentialWriter.java
@@ -0,0 +1,87 @@
+/*
+ *
+ * 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 java.sql.Connection;
+import java.sql.SQLException;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ApplicationSettings;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.common.utils.DefaultKeyStorePasswordCallback;
+import org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.apache.airavata.credential.store.store.CredentialWriter;
+import org.apache.airavata.credential.store.store.impl.db.CredentialsDAO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Writes SSH credentials to database.
+ */
+public class SSHCredentialWriter implements CredentialWriter {
+
+    private CredentialsDAO credentialsDAO;
+    private DBUtil dbUtil;
+    
+    protected static Logger logger = LoggerFactory.getLogger(SSHCredentialWriter.class);
+
+    public SSHCredentialWriter(DBUtil dbUtil) throws ApplicationSettingsException {
+        this.dbUtil = dbUtil;
+        this.credentialsDAO = new CredentialsDAO(ApplicationSettings.getCredentialStoreKeyStorePath(),
+                ApplicationSettings.getCredentialStoreKeyAlias(), new DefaultKeyStorePasswordCallback());
+
+    }
+
+    public void writeCredentials(Credential credential) throws CredentialStoreException {
+
+        SSHCredential sshCredential = (SSHCredential) credential;
+        Connection connection = null;
+
+        try {
+            connection = dbUtil.getConnection();
+            // First delete existing credentials
+            credentialsDAO.deleteCredentials(sshCredential.getGateway(), sshCredential.getToken(), connection);
+            // Add the new certificate
+            credentialsDAO.addCredentials(sshCredential.getGateway(), credential, connection);
+
+            if (!connection.getAutoCommit()) {
+                connection.commit();
+            }
+
+        } catch (SQLException e) {
+            if (connection != null) {
+                try {
+                    connection.rollback();
+                } catch (SQLException e1) {
+                    logger.error("Unable to rollback transaction", e1);
+                }
+            }
+            throw new CredentialStoreException("Unable to retrieve database connection.", e);
+        } finally {
+            DBUtil.cleanup(connection);
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java
new file mode 100644
index 0000000..f55cd55
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAO.java
@@ -0,0 +1,257 @@
+/*
+ *
+ * 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;
+import org.apache.airavata.credential.store.credential.CommunityUser;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Data access class for community_user table.
+ */
+public class CommunityUserDAO extends ParentDAO {
+
+    public CommunityUserDAO() {
+        super();
+    }
+
+    public void addCommunityUser(CommunityUser user, String token, Connection connection)
+            throws CredentialStoreException {
+
+        String sql = "INSERT INTO COMMUNITY_USER VALUES (?, ?, ?, ?)";
+
+        PreparedStatement preparedStatement = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, user.getGatewayName());
+            preparedStatement.setString(2, user.getUserName());
+            preparedStatement.setString(3, token);
+            preparedStatement.setString(4, user.getUserEmail());
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error persisting community user.");
+            stringBuilder.append("gateway - ").append(user.getGatewayName());
+            stringBuilder.append("community user name - ").append(user.getUserName());
+            stringBuilder.append("community user email - ").append(user.getUserEmail());
+            stringBuilder.append("token id - ").append(token);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+
+            DBUtil.cleanup(preparedStatement);
+        }
+    }
+
+    public void deleteCommunityUser(CommunityUser user, Connection connection) throws CredentialStoreException {
+
+        String sql = "DELETE FROM COMMUNITY_USER WHERE GATEWAY_NAME=? AND COMMUNITY_USER_NAME=?";
+
+        PreparedStatement preparedStatement = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, user.getGatewayName());
+            preparedStatement.setString(2, user.getUserName());
+
+            preparedStatement.executeUpdate();
+
+            connection.commit();
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error deleting community user.");
+            stringBuilder.append("gateway - ").append(user.getGatewayName());
+            stringBuilder.append("community user name - ").append(user.getUserName());
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            DBUtil.cleanup(preparedStatement);
+        }
+    }
+
+    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);
+        }
+    }
+
+    public void updateCommunityUser(CommunityUser user) throws CredentialStoreException {
+
+        // TODO
+    }
+
+    public CommunityUser getCommunityUser(String gatewayName, String communityUserName, Connection connection)
+            throws CredentialStoreException {
+
+        String sql = "SELECT * FROM COMMUNITY_USER WHERE GATEWAY_NAME=? AND COMMUNITY_USER_NAME=?";
+
+        PreparedStatement preparedStatement = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+            preparedStatement.setString(2, communityUserName);
+
+            ResultSet resultSet = preparedStatement.executeQuery();
+
+            if (resultSet.next()) {
+                String email = resultSet.getString("COMMUNITY_USER_EMAIL"); // TODO fix typo
+
+                return new CommunityUser(gatewayName, communityUserName, email);
+
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving community user.");
+            stringBuilder.append("gateway - ").append(gatewayName);
+            stringBuilder.append("community user name - ").append(communityUserName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            DBUtil.cleanup(preparedStatement);
+        }
+
+        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, Connection connection)
+            throws CredentialStoreException {
+
+        List<CommunityUser> userList = new ArrayList<CommunityUser>();
+
+        String sql = "SELECT * FROM COMMUNITY_USER WHERE GATEWAY_NAME=?";
+
+        PreparedStatement preparedStatement = null;
+
+        try {
+            preparedStatement = connection.prepareStatement(sql);
+
+            preparedStatement.setString(1, gatewayName);
+
+            ResultSet resultSet = preparedStatement.executeQuery();
+
+            while (resultSet.next()) {
+                String userName = resultSet.getString("COMMUNITY_USER_NAME");
+                String email = resultSet.getString("COMMUNITY_USER_EMAIL"); // TODO fix typo
+
+                userList.add(new CommunityUser(gatewayName, userName, email));
+
+            }
+
+        } catch (SQLException e) {
+            StringBuilder stringBuilder = new StringBuilder("Error retrieving community users for ");
+            stringBuilder.append("gateway - ").append(gatewayName);
+
+            log.error(stringBuilder.toString(), e);
+
+            throw new CredentialStoreException(stringBuilder.toString(), e);
+        } finally {
+            DBUtil.cleanup(preparedStatement);
+        }
+
+        return userList;
+    }
+
+}


[16/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/acs.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/acs.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/acs.jsp
deleted file mode 100644
index 94bc6d9..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/acs.jsp
+++ /dev/null
@@ -1,62 +0,0 @@
-<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %>
-<%--
-  Created by IntelliJ IDEA.
-  User: thejaka
-  Date: 8/5/13
-  Time: 4:48 PM
-  To change this template use File | Settings | File Templates.
---%>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%--
-  ~ 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.
-  --%>
-
-
-<html>
-<body>
-
-<table width="100%" border="0">
-    <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr>
-</table>
-
-<h2>Sample Gateway</h2>
-
-
-
-<p>This demonstrates how portal can use Credential Store to obtain community credentials ...</p>
-<form name="input" action="https://localhost:8443/airavata/acs-start-servlet" method="post">
-
-    <table border="0">
-        <tr>
-            <td>Gateway Name</td>
-            <td><input type="text" name="gatewayName" value="default" readonly="readonly"></td>
-        </tr>
-        <tr>
-            <td>Portal Username</td>
-            <td><input type="text" name="portalUserName"></td>
-        </tr>
-        <tr>
-            <td>Contact Email</td>
-            <td><input type="text" name="email"></td>
-        </tr>
-    </table>
-
-    <input type="submit" value="Submit">
-</form>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/callback.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/callback.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/callback.jsp
deleted file mode 100644
index 560f64f..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/callback.jsp
+++ /dev/null
@@ -1,78 +0,0 @@
-<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %>
-<%--
-  Created by IntelliJ IDEA.
-  User: thejaka
-  Date: 8/5/13
-  Time: 4:48 PM
-  To change this template use File | Settings | File Templates.
---%>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%--
-  ~ 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.
-  --%>
-
-<%
-    SampleGateway sampleGateway = (SampleGateway)session.getAttribute(SampleGateway.GATEWAY_SESSION);
-
-    boolean success = false;
-
-    String tokenId = request.getParameter("tokenId");
-
-    if (tokenId != null) {
-        sampleGateway.updateTokenId(tokenId);
-        success = true;
-    }
-%>
-
-<html>
-<body>
-
-<table width="100%" border="0">
-    <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr>
-</table>
-
-<h2>Sample Gateway</h2>
-<%
-    out.println("The received token id - ");
-    out.println(tokenId);
-
-    if (success) {
-%>
-<p>Token id successfully updated.</p>
-
-<p>
-    View users who obtained token id.
-<ol>
-    <li><a href="list_users.jsp">List Users</a></li>
-</ol>
-</p>
-
-<%
-    } else {
-
-%>
-<p> Error updating token id.</p>
-<%
-
-    }
-
-%>
-
-
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/list_users.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/list_users.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/list_users.jsp
deleted file mode 100644
index 36883b7..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/list_users.jsp
+++ /dev/null
@@ -1,78 +0,0 @@
-<%--
-  ~ 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.
-  --%>
-
-<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %>
-<%@ page import="java.util.List" %>
-<%@ page import="org.apache.airavata.sample.gateway.userstore.User" %>
-<%--
-  Created by IntelliJ IDEA.
-  User: thejaka
-  Date: 8/5/13
-  Time: 12:30 PM
-  To change this template use File | Settings | File Templates.
---%>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%
-    SampleGateway sampleGateway = (SampleGateway)session.getAttribute(SampleGateway.GATEWAY_SESSION);
-%>
-
-<html>
-<head>
-    <title>List Users</title>
-</head>
-<body>
-
-<table width="100%" border="0">
-    <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr>
-</table>
-
-<h1>Sample Gateway</h1>
-
-
-<p> This page lists all users and their attributes. </p>
-
-<table>
-    <tr>
-        <td>UserName</td>
-        <td>E-Mail</td>
-        <td>TokenId</td>
-    </tr>
-<%
-    List<User> userList = sampleGateway.getAllUsers();
-    for (User u : userList) {
-%>
-    <tr>
-        <td>
-            <%=u.getUserName() %>
-        </td>
-        <td>
-            <%=u.getEmail() %>
-        </td>
-        <td>
-            <%=u.getToken() %>
-        </td>
-
-    </tr>
-    <%
-        }
-    %>
-</table>
-
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/logout.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/logout.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/logout.jsp
deleted file mode 100644
index 63d90be..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/logout.jsp
+++ /dev/null
@@ -1,35 +0,0 @@
-<%--
-  ~ 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.
-  --%>
-<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %><%
-    session.removeAttribute("userName");
-    session.removeAttribute(SampleGateway.GATEWAY_SESSION);
-    session.invalidate();
-%>
-
-<html>
-<head>
-    <script language=javascript>
-        function redirect(){
-            window.location = "../index.jsp";
-        }
-    </script>
-</head>
-<body onload="redirect()">
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/user.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/user.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/user.jsp
deleted file mode 100644
index 1fd1957..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/gateway/user.jsp
+++ /dev/null
@@ -1,102 +0,0 @@
-<%--
-  ~ 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.
-  --%>
-
-<%@ page import="org.apache.airavata.sample.gateway.SampleGateway" %>
-<%--
-  Created by IntelliJ IDEA.
-  User: thejaka
-  Date: 7/31/13
-  Time: 5:08 PM
-  To change this template use File | Settings | File Templates.
---%>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%
-    String loginScreen = request.getParameter("loginScreen");
-
-    String user = (String)session.getAttribute("userName");
-    boolean authenticate = false;
-
-    if (loginScreen != null && loginScreen.equals("true")) {
-        SampleGateway sampleGateway = null;
-        sampleGateway = (SampleGateway) session.getAttribute(SampleGateway.GATEWAY_SESSION);
-
-        if (sampleGateway == null) {
-            sampleGateway = new SampleGateway(session.getServletContext());
-        }
-
-        session.setAttribute(SampleGateway.GATEWAY_SESSION, sampleGateway);
-
-        user = request.getParameter("username");
-        String password = request.getParameter("password");
-
-        authenticate = sampleGateway.authenticate(user, password);
-    } else {
-        authenticate = true;
-    }
-
-%>
-<html>
-
-<head>
-    <title>Manage</title>
-</head>
-<body>
-
-<table width="100%" border="0">
-    <tr bgcolor="#999999"><td align="right"><a href="user.jsp"><font color="#f5f5f5">Home</font> </a> <a href="logout.jsp"><font color="#f5f5f5">Logout</font></a></td></tr>
-</table>
-
-<h1>Sample Gateway</h1>
-
-<%
-    if (authenticate) {
-
-        session.setAttribute("userName", user);
-
-        if (SampleGateway.isAdmin(user)) {
-%>
-<h1>Administration</h1>
-<p>
-    This page allows administration functionality.
-<ol>
-    <li><a href="acs.jsp">Retrieve Credentials</a></li>
-    <li><a href="list_users.jsp">List Users</a></li>
-</ol>
-</p>
-
-
-<%
-     } else {
-%>
-
-<p> You are a normal user. Click <a href="job.jsp">here</a> to configure and run "Echo" workflow on a GRID machine.</p>
-
-<%
-     }
-    } else {
-%>
-
-<h1>Authentication failed</h1>
-
-<%
-    }
-%>
-
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png b/modules/credential-store-service/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png
deleted file mode 100644
index 4baf51b..0000000
Binary files a/modules/credential-store-service/credential-store-webapp/src/main/webapp/images/airavata-logo-2.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/index.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/index.jsp
deleted file mode 100644
index 1bf0ed6..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/index.jsp
+++ /dev/null
@@ -1,26 +0,0 @@
-<%--
-  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.
---%>
-
-<html>
-<body>
-<img src="images/airavata-logo-2.png">
-<h2>Airavata Credential Store</h2>
-<p>Welcome to Airavata Credential Store Web Application</p>
-
-<p><a href="user-store/add.jsp"><b>Manage Local User Store</b></a></p>
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/add.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/add.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/add.jsp
deleted file mode 100644
index f37684d..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/add.jsp
+++ /dev/null
@@ -1,142 +0,0 @@
-<%--
-  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.
---%>
-<%@ page import="org.apache.airavata.credentialstore.local.LocalUserStore" %>
-
-<html>
-
-<head>
-    <script language="javascript" type="text/javascript">
-        function validatePassword(fld1name, regString) {
-            var stringValue = document.getElementsByName(fld1name)[0].value;
-            var errorMessage = "";
-            if(regString != "null" && !stringValue.match(new RegExp(regString))){
-                errorMessage = "Password does not meet minimum requirements. Password length must be at least 6 " +
-                        "characters.";
-                return errorMessage;
-            }else if(regString != "null" && stringValue == ''){
-                return errorMessage;
-            }
-
-            if (stringValue == '') {
-                errorMessage = "Empty passwords are not allowed. Please enter a valid password";
-                return errorMessage;
-            }
-
-            return errorMessage;
-        }
-
-        function validateUsername(fld1name) {
-            var stringValue = document.getElementsByName(fld1name)[0].value;
-            var errorMessage = "";
-
-            if (stringValue == '') {
-                errorMessage = "Empty user names are not allowed. Please enter a valid user name.";
-                return errorMessage;
-            }
-
-            return errorMessage;
-        }
-
-        function checkPasswordsMatching(fld1name, fld2name) {
-
-            var stringValue1 = document.getElementsByName(fld1name)[0].value;
-            var stringValue2 = document.getElementsByName(fld2name)[0].value;
-            var errorMessage = "";
-
-            if (stringValue1 != stringValue2) {
-                errorMessage = "Confirm password does not match with the password. Please re-enter passwords.";
-                return errorMessage;
-            }
-
-            return errorMessage;
-
-        }
-
-        function validate() {
-            var reason = "";
-
-            reason = validateUsername("username");
-
-            if (reason != "") {
-                alert(reason);
-                return false;
-            }
-
-            reason = validatePassword("newPassword", <%=LocalUserStore.getPasswordRegularExpression()%>);
-
-            if (reason != "") {
-                alert(reason);
-                document.getElementsByName("newPassword")[0].clear();
-                return false;
-            }
-
-            reason = checkPasswordsMatching("newPassword", "confirmPassword");
-
-            if (reason != "") {
-                alert(reason);
-                document.getElementsByName("newPassword")[0].clear();
-                document.getElementsByName("confirmPassword")[0].clear();
-                return false;
-            }
-
-            return true;
-        }
-
-        function doProcess() {
-            if (validate() == true) {
-                document.registration.submit();
-            }
-        }
-
-
-    </script>
-</head>
-
-<body>
-<img src="../images/airavata-logo-2.png">
-<h2>Airavata Credential Store - Local User Store</h2>
-<p><b>Manage Local User Store - Add New User</b></p>
-
-<form action="index.jsp" name="registration" method="POST">
-
-    <input type="hidden" name="operation" value="addUser">
-    <table>
-        <tr>
-            <td>User Name</td>
-            <td><input type="text" name="username" maxlength="150"></td>
-        </tr>
-        <tr>
-            <td>Password</td>
-            <td><input type="password" name="newPassword"/></td>
-        </tr>
-        <tr>
-            <td>Re-Type Password</td>
-            <td><input type="password" name="confirmPassword"/></td>
-        </tr>
-    </table>
-
-    <table>
-        <tr>
-            <td><input type="button" value="Add" onclick= 'doProcess()'></td>
-            <td><a href="index.jsp"><input type="button" value="Cancel" name="Cancel"/> </a> </td>
-        </tr>
-    </table>
-
-</form>
-
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/index.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/index.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/index.jsp
deleted file mode 100644
index 732c0c7..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/index.jsp
+++ /dev/null
@@ -1,138 +0,0 @@
-<%--
-  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.
---%>
-
-<%@ page import = "org.apache.airavata.credentialstore.local.LocalUserStore" %>
-<%@ page import="org.apache.airavata.credentialstore.basic.BasicAccessAuthenticator" %>
-<%@ page import="org.apache.airavata.credentialstore.session.HttpAuthenticatorFilter" %>
-<%@ page import="java.util.List" %>
-<%@ page import="org.apache.airavata.common.utils.Constants" %>
-<%
-
-    LocalUserStore localUserStore = (LocalUserStore)session.getAttribute("LocalUserStore");
-
-    if (localUserStore == null) {
-
-        String operatingUser = (String) session.getAttribute(Constants.USER_IN_SESSION);
-
-        if (operatingUser == null || !operatingUser.equals("admin")) {
-            HttpAuthenticatorFilter.sendUnauthorisedError(response, "Insufficient privileges to perform user operations." +
-                    " Only admin user is allowed to perform user operations.");
-
-            return;
-        }
-
-        localUserStore = new LocalUserStore(application);
-
-        session.setAttribute("LocalUserStore", localUserStore);
-    }
-
-    String operation = request.getParameter("operation");
-    if (operation != null) {
-        if (operation.equals("addUser")) {
-            String userName = request.getParameter("username");
-            String password = request.getParameter("newPassword");
-
-            localUserStore.addUser(userName, password);
-        } else if (operation.equals("deleteUser")) {
-            String[] usersToDelete = request.getParameterValues("user-id");
-
-            for (String deleteUser : usersToDelete) {
-                localUserStore.deleteUser(deleteUser);
-            }
-        }
-    }
-
-    List<String> allUsers = localUserStore.getUsers();
-
-%>
-
-<html>
-<head>
-    <script language="javascript" type="text/javascript">
-
-        function validate() {
-            var checkSelected = false;
-            for (var i = 0; i < <%=allUsers.size()%>; i++) {
-                if (document.main["user-id"][i].checked) {
-                    checkSelected = true;
-                }
-            }
-            if (checkSelected) {
-                var answer = confirm("Are you sure you want to delete selected users from the system ?");
-                if (answer) {
-                    return true;
-                }
-            } else {
-                alert("Select at least one user to delete.");
-            }
-            return false;
-        }
-
-        function doProcess() {
-            if (validate() == true) {
-                document.main.submit();
-            }
-        }
-
-    </script>
-</head>
-<body>
-<img src="../images/airavata-logo-2.png">
-<h2>Airavata REST API - Local User Store</h2>
-<p><b>Manage Local User Store</b></p>
-
-
-<form action="index.jsp" name="main" method="POST">
-    <table>
-        <tr>
-            <td>&nbsp;</td>
-            <td>All Users</td>
-        </tr>
-        <%
-            for (String user : allUsers) {
-        %>
-
-        <tr>
-            <td><input type="checkbox" name="user-id" value="<%=user%>"></td>
-            <td><%=user%>
-            </td>
-            <td><a href="password.jsp?username=<%=user%>">Change Password</a></td>
-        </tr>
-
-        <%
-            }
-        %>
-    </table>
-
-    <br>
-
-    <table width="100">
-        <tr>
-            <td>
-                <a href="add.jsp"><input type="button" value="Add" name="Add"/></a>
-            </td>
-            <td>&nbsp;</td>
-            <input type="hidden" name="operation" value="deleteUser">
-            <td><input type="button" value="Delete" onclick="doProcess()"></td>
-        </tr>
-    </table>
-
-</form>
-
-
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/password.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/password.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/password.jsp
deleted file mode 100644
index 9a316ee..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/user-store/password.jsp
+++ /dev/null
@@ -1,157 +0,0 @@
-<%--
-  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.
---%>
-
-<%@ page import="org.apache.airavata.credentialstore.local.LocalUserStore" %>
-
-<%
-    String userName = request.getParameter("username");
-    if (userName == null) {
-        response.sendRedirect("index.jsp");
-    }
-
-    String password = request.getParameter("newPassword");
-    String confirmPassword = request.getParameter("confirmPassword");
-
-    if (password != null && confirmPassword != null && password.equals(confirmPassword)) {
-        LocalUserStore localUserStore = (LocalUserStore)session.getAttribute("LocalUserStore");
-        localUserStore.changePasswordByAdmin(userName, password);
-
-        response.sendRedirect("password.jsp?message=\"Password successfully change for user "
-                + userName + "\"&username=" + userName);
-    }
-
-%>
-
-<html>
-<head>
-    <script language="javascript" type="text/javascript">
-        function validatePassword(fld1name, regString) {
-            var stringValue = document.getElementsByName(fld1name)[0].value;
-            var errorMessage = "";
-            if(regString != "null" && !stringValue.match(new RegExp(regString))){
-                errorMessage = "Password does not meet minimum requirements. Password length must be at least 6 " +
-                        "characters.";
-                return errorMessage;
-            }else if(regString != "null" && stringValue == ''){
-                return errorMessage;
-            }
-
-            if (stringValue == '') {
-                errorMessage = "Empty passwords are not allowed. Please enter a valid password";
-                return errorMessage;
-            }
-
-            return errorMessage;
-        }
-
-        function validateUsername(fld1name) {
-            var stringValue = document.getElementsByName(fld1name)[0].value;
-            var errorMessage = "";
-
-            if (stringValue == '') {
-                errorMessage = "Empty user names are not allowed. Please enter a valid user name.";
-                return errorMessage;
-            }
-
-            return errorMessage;
-        }
-
-        function checkPasswordsMatching(fld1name, fld2name) {
-
-            var stringValue1 = document.getElementsByName(fld1name)[0].value;
-            var stringValue2 = document.getElementsByName(fld2name)[0].value;
-            var errorMessage = "";
-
-            if (stringValue1 != stringValue2) {
-                errorMessage = "Confirm password does not match with the password. Please re-enter passwords.";
-                return errorMessage;
-            }
-
-            return errorMessage;
-
-        }
-
-        function validate() {
-            var reason = "";
-
-            reason = validatePassword("newPassword", <%=LocalUserStore.getPasswordRegularExpression()%>);
-
-            if (reason != "") {
-                alert(reason);
-                document.getElementsByName("newPassword")[0].clear();
-                return false;
-            }
-
-            reason = checkPasswordsMatching("newPassword", "confirmPassword");
-
-            if (reason != "") {
-                alert(reason);
-                document.getElementsByName("newPassword")[0].clear();
-                document.getElementsByName("confirmPassword")[0].clear();
-                return false;
-            }
-
-            return true;
-        }
-
-        function doProcess() {
-            if (validate() == true) {
-                document.passwordForm.submit();
-            }
-        }
-
-        function displayMessage() {
-            var msg = <%=request.getParameter("message")%>;
-            if (msg != null) {
-                alert(msg);
-            }
-        }
-
-
-    </script>
-</head>
-
-<body onload="displayMessage()">
-<img src="../images/airavata-logo-2.png">
-<h2>Airavata REST API - Local User Store</h2>
-<p><b>Manage Local User Store - Change Password of user - <%=userName%></b></p>
-
-<form action="password.jsp" name="passwordForm" method="POST">
-
-    <input type="hidden" name="username" value="<%=userName%>">
-    <table>
-        <tr>
-            <td>New Password</td>
-            <td><input type="password" name="newPassword"/></td>
-        </tr>
-        <tr>
-            <td>Re-Type Password</td>
-            <td><input type="password" name="confirmPassword"/></td>
-        </tr>
-    </table>
-
-    <table>
-        <tr>
-            <td><input type="button" value="Change" onclick= 'doProcess()'></td>
-            <td><a href="index.jsp"><input type="button" value="Cancel" name="Cancel"/> </a> </td>
-        </tr>
-    </table>
-
-</form>
-
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/pom.xml b/modules/credential-store-service/credential-store/pom.xml
deleted file mode 100644
index d8af25f..0000000
--- a/modules/credential-store-service/credential-store/pom.xml
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-	license agreements. See the NOTICE file distributed with this work for additional 
-	information regarding copyright ownership. The ASF licenses this file to 
-	you under the Apache License, Version 2.0 (theƏ "License"); you may not use 
-	this file except in compliance with the License. You may obtain a copy of 
-	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
-	by applicable law or agreed to in writing, software distributed under the 
-	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
-	OF ANY ~ KIND, either express or implied. See the License for the specific 
-	language governing permissions and limitations under the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<parent>
-		<groupId>org.apache.airavata</groupId>
-		<artifactId>airavata</artifactId>
-		<version>0.15-SNAPSHOT</version>
-		<relativePath>../../../pom.xml</relativePath>
-	</parent>
-
-	<modelVersion>4.0.0</modelVersion>
-	<artifactId>airavata-credential-store</artifactId>
-	<name>Airavata Credential Store</name>
-	<description>Module to manage credentials</description>
-
-	<dependencies>
-		<dependency>
-			<groupId>edu.uiuc.ncsa.myproxy</groupId>
-			<artifactId>oa4mp-client-api</artifactId>
-			<version>${oa4mp.version}</version>
-		</dependency>
-		<dependency>
-            <groupId>edu.uiuc.ncsa.myproxy</groupId>
-            <artifactId>oa4mp-client-loader-oauth1</artifactId>
-            <version>${oa4mp.version}</version>
-            <exclusions>
-        	<exclusion>
-          		<groupId>net.oauth.core</groupId> 
-          		<artifactId>oauth-httpclient4</artifactId>
-        	</exclusion>
-			<exclusion>
-				<groupId>net.oauth.core</groupId>
-				<artifactId>oauth-consumer</artifactId>
-			</exclusion>
-			<exclusion>
-				<groupId>mysql</groupId>
-				<artifactId>mysql-connector-java</artifactId>
-			</exclusion>
-			<exclusion>
-				<groupId>postgresql</groupId>
-				<artifactId>postgresql</artifactId>
-			</exclusion>
-            </exclusions>
-        </dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-api</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>log4j</groupId>
-			<artifactId>log4j</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>4.7</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.derby</groupId>
-			<artifactId>derby</artifactId>
-			<version>${derby.version}</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.derby</groupId>
-			<artifactId>derbyclient</artifactId>
-			<version>${derby.version}</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.derby</groupId>
-			<artifactId>derbynet</artifactId>
-			<version>${derby.version}</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.derby</groupId>
-			<artifactId>derbytools</artifactId>
-			<version>${derby.version}</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>commons-dbcp</groupId>
-			<artifactId>commons-dbcp</artifactId>
-			<version>1.4</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.airavata</groupId>
-			<artifactId>airavata-common-utils</artifactId>
-			<version>${project.version}</version>
-		</dependency> 
-		<dependency>
-			<groupId>com.jcraft</groupId>
-			<artifactId>jsch</artifactId>
-			<version>0.1.50</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>servlet-api</artifactId>
-			<version>2.5</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.commons</groupId>
-			<artifactId>commons-email</artifactId>
-			<version>1.3.2</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.commons</groupId>
-			<artifactId>commons-io</artifactId>
-			<version>1.3.2</version>
-		</dependency>
-	</dependencies>
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-surefire-plugin</artifactId>
-				<version>${surefire.version}</version>
-				<inherited>true</inherited>
-				<configuration>
-					<systemPropertyVariables>
-						<credential.module.directory>${basedir}</credential.module.directory>
-					</systemPropertyVariables>
-					<excludes>
-						<exclude>**/DAOBaseTestCase.java</exclude>
-						<exclude>**/MappingDAOTest.java</exclude>
-					</excludes>
-					<testSourceDirectory>${basedir}\src\test\java\</testSourceDirectory>
-				</configuration>
-			</plugin>
-
-		</plugins>
-		<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
-		<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
-		<testResources>
-			<testResource>
-				<directory>${project.basedir}/src/test/resources</directory>
-			</testResource>
-		</testResources>
-	</build>
-</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/scripts/credential-store-h2.sql
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/scripts/credential-store-h2.sql b/modules/credential-store-service/credential-store/scripts/credential-store-h2.sql
deleted file mode 100644
index 91915b6..0000000
--- a/modules/credential-store-service/credential-store/scripts/credential-store-h2.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * 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.
- *
- */
-CREATE TABLE COMMUNITY_USER
-(
-	GATEWAY_NAME VARCHAR(256) NOT NULL,
-	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
-	COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
-        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
-);
-
-
-CREATE TABLE CREDENTIALS
-(
-	GATEWAY_NAME VARCHAR(256) NOT NULL,
-	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
-	CREDENTIAL CLOB NOT NULL,
-	PRIVATE_KEY CLOB NOT NULL,
-	NOT_BEFORE VARCHAR(256) NOT NULL,
-	NOT_AFTER VARCHAR(256) NOT NULL,
-	LIFETIME MEDIUMINT NOT NULL,
-	REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,
-	REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/scripts/credential-store-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/scripts/credential-store-mysql.sql b/modules/credential-store-service/credential-store/scripts/credential-store-mysql.sql
deleted file mode 100644
index 50d5e0f..0000000
--- a/modules/credential-store-service/credential-store/scripts/credential-store-mysql.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * 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.
- *
- */
-CREATE TABLE COMMUNITY_USER
-(
-	GATEWAY_NAME VARCHAR(256) NOT NULL,
-	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
-	COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
-        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
-);
-
-
-CREATE TABLE CREDENTIALS
-(
-	GATEWAY_NAME VARCHAR(256) NOT NULL,
-	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
-	CREDENTIAL TEXT NOT NULL,
-	PRIVATE_KEY TEXT NOT NULL,
-	NOT_BEFORE VARCHAR(256) NOT NULL,
-	NOT_AFTER VARCHAR(256) NOT NULL,
-	LIFETIME MEDIUMINT NOT NULL,
-	REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,
-	REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-    PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
-);

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java
deleted file mode 100644
index 12105e2..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *
- * 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.client;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credential.store.cpi.CredentialStoreService;
-import org.apache.airavata.credential.store.datamodel.CertificateCredential;
-import org.apache.airavata.credential.store.datamodel.CommunityUser;
-import org.apache.airavata.credential.store.datamodel.SSHCredential;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.transport.TSSLTransportFactory;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportException;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import org.apache.commons.codec.binary.Base64;
-
-public class TestSSLClient {
-    private void invoke() {
-        TTransport transport;
-        try {
-            AiravataUtils.setExecutionAsServer();
-            TSSLTransportFactory.TSSLTransportParameters params =
-                    new TSSLTransportFactory.TSSLTransportParameters();
-            String keystorePath = ServerSettings.getCredentialStoreThriftServerKeyStorePath();
-            String keystorePWD = ServerSettings.getCredentialStoreThriftServerKeyStorePassword();
-            params.setTrustStore(keystorePath, keystorePWD);
-            final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_PORT, "8960"));
-            final String serverHost = ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_HOST, null);
-
-            transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params);
-            TProtocol protocol = new TBinaryProtocol(transport);
-
-            CredentialStoreService.Client client = new CredentialStoreService.Client(protocol);
-//            testSSHCredential(client);
-            testCertificateCredential(client);
-            transport.close();
-        } catch (TTransportException e) {
-            e.printStackTrace();
-        }catch (ApplicationSettingsException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public static void testSSHCredential (CredentialStoreService.Client client){
-        try {
-            SSHCredential sshCredential = new SSHCredential();
-            sshCredential.setUsername("test");
-            sshCredential.setGatewayId("testGateway");
-            sshCredential.setPassphrase("mypassphrase");
-            String token = client.addSSHCredential(sshCredential);
-            System.out.println("SSH Token :" + token);
-            SSHCredential credential = client.getSSHCredential(token, "testGateway");
-            System.out.println("private key : " + credential.getPrivateKey());
-            System.out.println("public key : " + credential.getPublicKey());
-        }catch (TTransportException e) {
-            e.printStackTrace();
-        } catch (TException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public static void testCertificateCredential (CredentialStoreService.Client client){
-        try {
-            CertificateCredential certificateCredential = new CertificateCredential();
-            CommunityUser communityUser = new CommunityUser("testGateway", "test", "test@ddsd");
-            certificateCredential.setCommunityUser(communityUser);
-            X509Certificate[] x509Certificates = new X509Certificate[1];
-            KeyStore ks = KeyStore.getInstance("JKS");
-            File keyStoreFile = new File("/Users/chathuri/dev/airavata/credential-store/oa4mp/airavata.jks");
-            FileInputStream fis = new FileInputStream(keyStoreFile);
-            char[] password = "airavata".toCharArray();
-            ks.load(fis,password);
-            x509Certificates[0] = (X509Certificate) ks.getCertificate("airavata");
-            Base64 encoder = new Base64(64);
-            String cert_begin = "-----BEGIN CERTIFICATE-----\n";
-            String end_cert = "-----END CERTIFICATE-----";
-            byte[] derCert = x509Certificates[0].getEncoded();
-            String pemCertPre = new String(encoder.encode(derCert));
-            String pemCert = cert_begin + pemCertPre + end_cert;
-            certificateCredential.setX509Cert(pemCert);
-            String token = client.addCertificateCredential(certificateCredential);
-            System.out.println("Certificate Token :" + token);
-            CertificateCredential credential = client.getCertificateCredential(token, "testGateway");
-            System.out.println("certificate : " + credential.getX509Cert());
-            System.out.println("gateway name  : " + credential.getCommunityUser().getGatewayNmae());
-        }catch (TTransportException e) {
-            e.printStackTrace();
-        } catch (TException e) {
-            e.printStackTrace();
-        } catch (KeyStoreException e) {
-            e.printStackTrace();
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        } catch (NoSuchAlgorithmException e) {
-            e.printStackTrace();
-        } catch (CertificateException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public static void main(String[] args) {
-        TestSSLClient c = new TestSSLClient();
-        c.invoke();
-
-    }
-}


[17/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/58c58cf2
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/58c58cf2
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/58c58cf2

Branch: refs/heads/master
Commit: 58c58cf209fbfdd6873aaf718ff6927f07f764e2
Parents: 66de372
Author: Suresh Marru <sm...@apache.org>
Authored: Thu Mar 5 14:36:16 2015 -0500
Committer: Suresh Marru <sm...@apache.org>
Committed: Thu Mar 5 14:36:17 2015 -0500

----------------------------------------------------------------------
 .../credential-store-webapp/pom.xml             |  158 -
 .../basic/BasicAccessAuthenticator.java         |  226 -
 .../credentialstore/local/LocalUserStore.java   |  339 -
 .../session/HttpAuthenticatorFilter.java        |  191 -
 .../session/ServletRequestHelper.java           |  129 -
 .../main/resources/airavata-server.properties   |  234 -
 .../main/resources/credential-store/client.xml  |   36 -
 .../credential-store/oauth-privkey.pk8          |   28 -
 .../resources/credential-store/oauth-pubkey.pem |    9 -
 .../src/main/webapp/WEB-INF/web.xml             |  130 -
 .../src/main/webapp/acs/index.jsp               |   44 -
 .../src/main/webapp/credential-store/error.jsp  |   53 -
 .../credential-store/password-credentials.jsp   |   33 -
 .../webapp/credential-store/show-redirect.jsp   |   44 -
 .../main/webapp/credential-store/success.jsp    |   25 -
 .../src/main/webapp/gateway/acs.jsp             |   62 -
 .../src/main/webapp/gateway/callback.jsp        |   78 -
 .../src/main/webapp/gateway/list_users.jsp      |   78 -
 .../src/main/webapp/gateway/logout.jsp          |   35 -
 .../src/main/webapp/gateway/user.jsp            |  102 -
 .../src/main/webapp/images/airavata-logo-2.png  |  Bin 4314 -> 0 bytes
 .../src/main/webapp/index.jsp                   |   26 -
 .../src/main/webapp/user-store/add.jsp          |  142 -
 .../src/main/webapp/user-store/index.jsp        |  138 -
 .../src/main/webapp/user-store/password.jsp     |  157 -
 .../credential-store/pom.xml                    |  154 -
 .../scripts/credential-store-h2.sql             |   42 -
 .../scripts/credential-store-mysql.sql          |   42 -
 .../credential/store/client/TestSSLClient.java  |  140 -
 .../store/cpi/CredentialStoreService.java       | 6888 ------------------
 .../store/cpi/cs_cpi_serviceConstants.java      |   55 -
 .../credential/store/credential/AuditInfo.java  |   53 -
 .../store/credential/CommunityUser.java         |   71 -
 .../credential/store/credential/Credential.java |   62 -
 .../impl/certificate/CertificateAuditInfo.java  |  101 -
 .../impl/certificate/CertificateCredential.java |  102 -
 .../impl/password/PasswordCredential.java       |   53 -
 .../credential/impl/ssh/SSHCredential.java      |   88 -
 .../impl/ssh/SSHCredentialGenerator.java        |  103 -
 .../store/datamodel/CertificateCredential.java  | 1104 ---
 .../store/datamodel/CommunityUser.java          |  589 --
 .../store/datamodel/PasswordCredential.java     |  698 --
 .../store/datamodel/SSHCredential.java          |  998 ---
 .../store/datamodel/csDataModelConstants.java   |   55 -
 .../exception/CredentialStoreException.java     |  397 -
 .../store/notifier/CredentialStoreNotifier.java |   42 -
 .../store/notifier/NotificationMessage.java     |   46 -
 .../store/notifier/NotifierBootstrap.java       |  144 -
 .../notifier/impl/EmailNotificationMessage.java |   58 -
 .../store/notifier/impl/EmailNotifier.java      |   71 -
 .../impl/EmailNotifierConfiguration.java        |   84 -
 .../store/server/CredentialStoreServer.java     |  158 -
 .../server/CredentialStoreServerHandler.java    |  202 -
 .../store/servlet/CredentialBootstrapper.java   |   49 -
 .../servlet/CredentialStoreCallbackServlet.java |  272 -
 .../servlet/CredentialStoreStartServlet.java    |  183 -
 .../store/store/CredentialReader.java           |  112 -
 .../store/store/CredentialReaderFactory.java    |   54 -
 .../store/store/CredentialStoreException.java   |   40 -
 .../store/store/CredentialWriter.java           |   39 -
 .../store/impl/CertificateCredentialWriter.java |  121 -
 .../store/store/impl/CredentialReaderImpl.java  |  162 -
 .../store/store/impl/SSHCredentialWriter.java   |   87 -
 .../store/store/impl/db/CommunityUserDAO.java   |  257 -
 .../store/store/impl/db/CredentialsDAO.java     |  458 --
 .../store/store/impl/db/ParentDAO.java          |   37 -
 .../store/util/ConfigurationReader.java         |  121 -
 .../store/util/CredentialStoreConstants.java    |   37 -
 .../credential/store/util/PrivateKeyStore.java  |   70 -
 .../credential/store/util/TokenGenerator.java   |   57 -
 .../airavata/credential/store/util/Utility.java |  110 -
 .../store/notifier/impl/EmailNotifierTest.java  |   56 -
 .../store/impl/db/CommunityUserDAOTest.java     |  207 -
 .../store/store/impl/db/CredentialsDAOTest.java |  421 --
 .../store/util/ConfigurationReaderTest.java     |   58 -
 .../store/util/TokenGeneratorTest.java          |   42 -
 .../test/resources/credential-store/client.xml  |   35 -
 .../src/test/resources/keystore.jks             |  Bin 2230 -> 0 bytes
 .../src/test/resources/mykeystore.jks           |  Bin 498 -> 0 bytes
 .../credentialStoreErrors.thrift                |   32 -
 .../cs-thrift-description/cs.cpi.service.thrift |   61 -
 .../cs-thrift-description/csDataModel.thrift    |   61 -
 .../cs-thrift-description/generate-cs-stubs.sh  |  134 -
 modules/credential-store-service/pom.xml        |   42 -
 .../credential-store-service/pom.xml            |  154 +
 .../scripts/credential-store-h2.sql             |   42 +
 .../scripts/credential-store-mysql.sql          |   42 +
 .../credential/store/client/TestSSLClient.java  |  140 +
 .../store/cpi/CredentialStoreService.java       | 6888 ++++++++++++++++++
 .../store/cpi/cs_cpi_serviceConstants.java      |   55 +
 .../credential/store/credential/AuditInfo.java  |   53 +
 .../store/credential/CommunityUser.java         |   71 +
 .../credential/store/credential/Credential.java |   62 +
 .../impl/certificate/CertificateAuditInfo.java  |  101 +
 .../impl/certificate/CertificateCredential.java |  102 +
 .../impl/password/PasswordCredential.java       |   53 +
 .../credential/impl/ssh/SSHCredential.java      |   88 +
 .../impl/ssh/SSHCredentialGenerator.java        |  103 +
 .../store/datamodel/CertificateCredential.java  | 1104 +++
 .../store/datamodel/CommunityUser.java          |  589 ++
 .../store/datamodel/PasswordCredential.java     |  698 ++
 .../store/datamodel/SSHCredential.java          |  998 +++
 .../store/datamodel/csDataModelConstants.java   |   55 +
 .../exception/CredentialStoreException.java     |  397 +
 .../store/notifier/CredentialStoreNotifier.java |   42 +
 .../store/notifier/NotificationMessage.java     |   46 +
 .../store/notifier/NotifierBootstrap.java       |  144 +
 .../notifier/impl/EmailNotificationMessage.java |   58 +
 .../store/notifier/impl/EmailNotifier.java      |   71 +
 .../impl/EmailNotifierConfiguration.java        |   84 +
 .../store/server/CredentialStoreServer.java     |  158 +
 .../server/CredentialStoreServerHandler.java    |  202 +
 .../store/servlet/CredentialBootstrapper.java   |   49 +
 .../servlet/CredentialStoreCallbackServlet.java |  272 +
 .../servlet/CredentialStoreStartServlet.java    |  183 +
 .../store/store/CredentialReader.java           |  112 +
 .../store/store/CredentialReaderFactory.java    |   54 +
 .../store/store/CredentialStoreException.java   |   40 +
 .../store/store/CredentialWriter.java           |   39 +
 .../store/impl/CertificateCredentialWriter.java |  121 +
 .../store/store/impl/CredentialReaderImpl.java  |  162 +
 .../store/store/impl/SSHCredentialWriter.java   |   87 +
 .../store/store/impl/db/CommunityUserDAO.java   |  257 +
 .../store/store/impl/db/CredentialsDAO.java     |  458 ++
 .../store/store/impl/db/ParentDAO.java          |   37 +
 .../store/util/ConfigurationReader.java         |  121 +
 .../store/util/CredentialStoreConstants.java    |   37 +
 .../credential/store/util/PrivateKeyStore.java  |   70 +
 .../credential/store/util/TokenGenerator.java   |   57 +
 .../airavata/credential/store/util/Utility.java |  110 +
 .../store/notifier/impl/EmailNotifierTest.java  |   56 +
 .../store/impl/db/CommunityUserDAOTest.java     |  207 +
 .../store/store/impl/db/CredentialsDAOTest.java |  421 ++
 .../store/util/ConfigurationReaderTest.java     |   58 +
 .../store/util/TokenGeneratorTest.java          |   42 +
 .../test/resources/credential-store/client.xml  |   35 +
 .../src/test/resources/keystore.jks             |  Bin 0 -> 2230 bytes
 .../src/test/resources/mykeystore.jks           |  Bin 0 -> 498 bytes
 .../credential-store-stubs/pom.xml              |   45 +
 .../store/cpi/CredentialStoreService.java       | 6888 ++++++++++++++++++
 .../store/cpi/credentialStoreCPIConstants.java  |   55 +
 .../store/datamodel/CertificateCredential.java  | 1104 +++
 .../store/datamodel/CommunityUser.java          |  589 ++
 .../store/datamodel/PasswordCredential.java     |  698 ++
 .../store/datamodel/SSHCredential.java          |  998 +++
 .../credentialStoreDataModelConstants.java      |   55 +
 .../exception/CredentialStoreException.java     |  397 +
 .../credential-store-webapp/pom.xml             |  158 +
 .../basic/BasicAccessAuthenticator.java         |  226 +
 .../credentialstore/local/LocalUserStore.java   |  339 +
 .../session/HttpAuthenticatorFilter.java        |  191 +
 .../session/ServletRequestHelper.java           |  129 +
 .../main/resources/airavata-server.properties   |  234 +
 .../main/resources/credential-store/client.xml  |   36 +
 .../credential-store/oauth-privkey.pk8          |   28 +
 .../resources/credential-store/oauth-pubkey.pem |    9 +
 .../src/main/webapp/WEB-INF/web.xml             |  130 +
 .../src/main/webapp/acs/index.jsp               |   44 +
 .../src/main/webapp/credential-store/error.jsp  |   53 +
 .../credential-store/password-credentials.jsp   |   33 +
 .../webapp/credential-store/show-redirect.jsp   |   44 +
 .../main/webapp/credential-store/success.jsp    |   25 +
 .../src/main/webapp/gateway/acs.jsp             |   62 +
 .../src/main/webapp/gateway/callback.jsp        |   78 +
 .../src/main/webapp/gateway/list_users.jsp      |   78 +
 .../src/main/webapp/gateway/logout.jsp          |   35 +
 .../src/main/webapp/gateway/user.jsp            |  102 +
 .../src/main/webapp/images/airavata-logo-2.png  |  Bin 0 -> 4314 bytes
 .../src/main/webapp/index.jsp                   |   26 +
 .../src/main/webapp/user-store/add.jsp          |  142 +
 .../src/main/webapp/user-store/index.jsp        |  138 +
 .../src/main/webapp/user-store/password.jsp     |  157 +
 .../credentialStoreCPI.thrift                   |   61 +
 .../credentialStoreDataModel.thrift             |   61 +
 .../credentialStoreErrors.thrift                |   32 +
 .../cs-thrift-descriptions/generate-cs-stubs.sh |  134 +
 modules/credential-store/pom.xml                |   43 +
 pom.xml                                         |    4 +-
 178 files changed, 29344 insertions(+), 18514 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/pom.xml b/modules/credential-store-service/credential-store-webapp/pom.xml
deleted file mode 100644
index 8122f9e..0000000
--- a/modules/credential-store-service/credential-store-webapp/pom.xml
+++ /dev/null
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor
-	license agreements. See the NOTICE file distributed with this work for additional
-	information regarding copyright ownership. The ASF licenses this file to
-	you under the Apache License, Version 2.0 (theƃĀ "License"); you may not use
-	this file except in compliance with the License. You may obtain a copy of
-	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
-	by applicable law or agreed to in writing, software distributed under the
-	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
-	OF ANY ~ KIND, either express or implied. See the License for the specific
-	language governing permissions and limitations under the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <parent>
-        <groupId>org.apache.airavata</groupId>
-        <artifactId>airavata-credential-store-service</artifactId>
-        <version>0.15-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>airavata-credential-store-webapp</artifactId>
-    <packaging>war</packaging>
-    <name>airavata-credential-store-webapp</name>
-    <build>
-        <finalName>credential-store</finalName>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.cargo</groupId>
-                <artifactId>cargo-maven2-plugin</artifactId>
-                <version>${cargo.version}</version>
-                <configuration>
-                    <wait>true</wait>
-                    <configuration>
-                        <properties>
-                            <cargo.servlet.port>8443</cargo.servlet.port>
-                            <cargo.protocol>https</cargo.protocol>
-                            <cargo.tomcat.connector.clientAuth>false</cargo.tomcat.connector.clientAuth>
-                            <cargo.tomcat.connector.sslProtocol>TLS</cargo.tomcat.connector.sslProtocol>
-                            <cargo.tomcat.connector.keystoreFile>/Users/chathuri/dev/airavata/credential-store/oa4mp/airavata_sym.jks</cargo.tomcat.connector.keystoreFile>
-                            <cargo.tomcat.connector.keystorePass>airavata</cargo.tomcat.connector.keystorePass>
-                            <cargo.tomcat.ajp.port>9009</cargo.tomcat.ajp.port>
-                            <cargo.rmi.port>9099</cargo.rmi.port>
-                            <cargo.jvmargs>
-                                <![CDATA[-Xdebug -Xrunjdwp:transport=dt_socket,address=${cargo.debug.address},server=y,suspend=${cargo.debug.suspend} -noverify ${javaagent}]]>
-                            </cargo.jvmargs>
-                            <cargo.tomcat.context.reloadable>true</cargo.tomcat.context.reloadable>
-                        </properties>
-                        <home>${project.build.directory}/tomcat6x</home>
-                        <deployables>
-                            <deployable>
-                                <groupId>org.apache.airavata</groupId>
-                                <artifactId>airavata-credential-store-webapp</artifactId>
-                                <type>war</type>
-                                <properties>
-                                    <context>/acs</context>
-                                </properties>
-                            </deployable>
-                        </deployables>
-                    </configuration>
-                    <container>
-                        <containerId>tomcat6x</containerId>
-                        <timeout>180000</timeout>
-                        <zipUrlInstaller>
-                            <url>
-                                http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz
-                            </url>
-                        </zipUrlInstaller>
-                        <systemProperties>
-
-                        </systemProperties>
-                    </container>
-                </configuration>
-            </plugin>
-        </plugins>
-
-    </build>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derbyclient</artifactId>
-            <version>${derby.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-credential-store</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>net.oauth.core</groupId>
-            <artifactId>oauth-httpclient4</artifactId>
-            <version>20090617</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-security</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-common-utils</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-            <version>1.6</version>
-        </dependency>
-        <!-- <dependency>
-            <groupId>edu.uiuc.ncsa.myproxy</groupId>
-            <artifactId>oa4mp-client-oauth1</artifactId>
-            <version>${oa4mp.version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>mysql</groupId>
-                    <artifactId>mysql-connector-java</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>postgresql</groupId>
-                    <artifactId>postgresql</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency> -->
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>${org.slf4j.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <version>${org.slf4j.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-            <version>${org.slf4j.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <version>${org.slf4j.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.ebaysf.web</groupId>
-            <artifactId>cors-filter</artifactId>
-            <version>${ebay.cors.filter}</version>
-        </dependency>
-    </dependencies>
-    <properties>
-        <cargo.version>1.2.1</cargo.version>
-        <cargo.debug.address>8000</cargo.debug.address>
-        <cargo.debug.suspend>y</cargo.debug.suspend>
-        <javaagent />
-    </properties>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/basic/BasicAccessAuthenticator.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/basic/BasicAccessAuthenticator.java b/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/basic/BasicAccessAuthenticator.java
deleted file mode 100644
index c34cb1b..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/basic/BasicAccessAuthenticator.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * 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.credentialstore.basic;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credentialstore.session.ServletRequestHelper;
-import org.apache.airavata.security.AbstractAuthenticator;
-import org.apache.airavata.security.AuthenticationException;
-import org.apache.airavata.security.UserStoreException;
-import org.w3c.dom.Node;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-/**
- * This authenticator handles basic access authentication requests. In basic access authentication
- * we get user name and password as HTTP headers. The password is encoded with base64.
- * More information @link{http://en.wikipedia.org/wiki/Basic_access_authentication}
- */
-public class BasicAccessAuthenticator extends AbstractAuthenticator {
-
-
-    private static final String AUTHENTICATOR_NAME = "BasicAccessAuthenticator";
-
-    private ServletRequestHelper servletRequestHelper = new ServletRequestHelper();
-
-    public BasicAccessAuthenticator() {
-        super(AUTHENTICATOR_NAME);
-    }
-
-
-    /**
-     * Returns user name and password as an array. The first element is user name and second is password.
-     *
-     * @param httpServletRequest The servlet request.
-     * @return User name password pair as an array.
-     * @throws AuthenticationException If an error occurred while extracting user name and password.
-     */
-    private String[] getUserNamePassword(HttpServletRequest httpServletRequest) throws AuthenticationException {
-
-        String basicHeader = httpServletRequest.getHeader(ServletRequestHelper.AUTHORISATION_HEADER_NAME);
-
-        if (basicHeader == null) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        String[] userNamePasswordArray = basicHeader.split(" ");
-
-        if (userNamePasswordArray == null || userNamePasswordArray.length != 2) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        String decodedString = servletRequestHelper.decode(userNamePasswordArray[1]);
-
-        String[] array = decodedString.split(":");
-
-        if (array == null || array.length != 2) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        return array;
-
-    }
-
-    @Override
-    protected boolean doAuthentication(Object credentials) throws AuthenticationException {
-        if (this.getUserStore() == null) {
-            throw new AuthenticationException("Authenticator is not initialized. Error processing request.");
-        }
-
-        if (credentials == null)
-            return false;
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
-
-        String[] array = getUserNamePassword(httpServletRequest);
-
-        String userName = array[0];
-        String password = array[1];
-
-        try {
-            return this.getUserStore().authenticate(userName, password);
-
-        } catch (UserStoreException e) {
-            throw new AuthenticationException("Error querying database for session information.", e);
-        }
-    }
-
-
-
-    @Override
-    public void onSuccessfulAuthentication(Object authenticationInfo) {
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) authenticationInfo;
-
-        try {
-            String[] array = getUserNamePassword(httpServletRequest);
-
-            StringBuilder stringBuilder = new StringBuilder("User : ");
-
-            if (array != null) {
-
-                servletRequestHelper.addUserToSession(array[0], httpServletRequest);
-
-                stringBuilder.append(array[0]).append(" successfully logged into system at ").append(getCurrentTime());
-                log.debug(stringBuilder.toString());
-
-            } else {
-                log.error("System error occurred while extracting user name after authentication. " +
-                        "Couldn't extract user name from the request.");
-            }
-        } catch (AuthenticationException e) {
-            log.error("System error occurred while extracting user name after authentication.", e);
-        }
-
-    }
-
-    @Override
-    public void onFailedAuthentication(Object authenticationInfo) {
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) authenticationInfo;
-
-        try {
-            String[] array = getUserNamePassword(httpServletRequest);
-
-            StringBuilder stringBuilder = new StringBuilder("User : ");
-
-            if (array != null) {
-
-                stringBuilder.append(array[0]).append(" Failed login attempt to system at ").append(getCurrentTime());
-                log.warn(stringBuilder.toString());
-
-            } else {
-                stringBuilder.append("Failed login attempt to system at ").append(getCurrentTime()).append( ". User unknown.");
-                log.warn(stringBuilder.toString());
-            }
-        } catch (AuthenticationException e) {
-            log.error("System error occurred while extracting user name after authentication.", e);
-        }
-    }
-
-    @Override
-    public boolean isAuthenticated(Object credentials) {
-        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
-
-        HttpSession httpSession = httpServletRequest.getSession();
-
-        boolean seenInSession = false;
-
-        if (httpSession != null) {
-        	 String user = null;
-        	 String gateway = null;
-        	try{
-             user = (String)httpSession.getAttribute(Constants.USER_IN_SESSION);
-             gateway = (String)httpSession.getAttribute(ServerSettings.getDefaultUserGateway());
-             }
-            catch (ApplicationSettingsException e1) {
-    			// TODO Auto-generated catch block
-    			e1.printStackTrace();
-    		}
-            if (user != null && gateway != null) {
-                servletRequestHelper.addToContext(user, gateway);
-                seenInSession = true;
-            }
-        }
-
-        return seenInSession;
-
-    }
-
-    @Override
-    public boolean canProcess(Object credentials) {
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
-
-        return (httpServletRequest.getHeader(ServletRequestHelper.AUTHORISATION_HEADER_NAME) != null);
-    }
-
-
-
-    @Override
-    public void configure(Node node) throws RuntimeException {
-
-        /**
-         <specificConfigurations>
-         <database>
-         <jdbcUrl></jdbcUrl>
-         <databaseDriver></databaseDriver>
-         <userName></userName>
-         <password></password>
-         <userTableName></userTableName>
-         <userNameColumnName></userNameColumnName>
-         <passwordColumnName></passwordColumnName>
-         </database>
-         </specificConfigurations>
-         */
-
-        try {
-            this.getUserStore().configure(node);
-        } catch (UserStoreException e) {
-            throw new RuntimeException("Error while configuring authenticator user store", e);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/local/LocalUserStore.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/local/LocalUserStore.java b/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/local/LocalUserStore.java
deleted file mode 100644
index 0a2ca83..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/local/LocalUserStore.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- *
- * 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.credentialstore.local;
-
-import java.security.NoSuchAlgorithmException;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.SecurityUtil;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * User store to maintain internal DB database.
- */
-public class LocalUserStore {
-
-    protected static Logger log = LoggerFactory.getLogger(LocalUserStore.class);
-
-    private DBUtil dbUtil;
-
-    private String hashMethod;
-
-    public LocalUserStore(ServletContext servletContext) throws Exception {
-        // Properties properties = WebAppUtil.getAiravataProperties(servletContext);
-
-        hashMethod = ServerSettings.getSetting("default.registry.password.hash.method");
-
-        dbUtil = new DBUtil(ServerSettings.getSetting("registry.jdbc.url"),
-                ServerSettings.getSetting("registry.jdbc.user"),
-                ServerSettings.getSetting("registry.jdbc.password"),
-                ServerSettings.getSetting("registry.jdbc.driver"));
-
-    }
-
-    public LocalUserStore(DBUtil db) {
-        dbUtil = db;
-    }
-
-    public void addUser(String userName, String password) {
-
-        String sql = "insert into Users values (?, ?)";
-
-        Connection connection = null;
-        PreparedStatement preparedStatement = null;
-
-        try {
-            connection = dbUtil.getConnection();
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, userName);
-            preparedStatement.setString(2, SecurityUtil.digestString(password, hashMethod));
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-            log.debug("User " + userName + " successfully added.");
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error persisting user information.");
-            stringBuilder.append(" user - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } catch (NoSuchAlgorithmException e) {
-            String stringBuilder = "Error creating hash value for password.";
-            log.error(stringBuilder, e);
-
-            throw new RuntimeException(stringBuilder, e);
-        } finally {
-
-            dbUtil.cleanup(preparedStatement, connection);
-        }
-
-    }
-
-    protected String getPassword(String userName, Connection connection) {
-
-        String sql = "select password from Users where user_name = ?";
-
-        PreparedStatement preparedStatement = null;
-        ResultSet resultSet = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, userName);
-
-            resultSet = preparedStatement.executeQuery();
-
-            if (resultSet.next()) {
-                return resultSet.getString("password");
-            }
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for user.");
-            stringBuilder.append("name - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } finally {
-
-            if (resultSet != null) {
-                try {
-                    resultSet.close();
-                } catch (SQLException e) {
-                    log.error("Error closing result set", e);
-                }
-            }
-
-            if (preparedStatement != null) {
-                try {
-                    preparedStatement.close();
-                } catch (SQLException e) {
-                    log.error("Error closing prepared statement", e);
-                }
-            }
-        }
-
-        return null;
-    }
-
-    public void changePassword(String userName, String oldPassword, String newPassword) {
-
-        Connection connection = null;
-        PreparedStatement preparedStatement = null;
-
-        try {
-            connection = dbUtil.getConnection();
-
-            String storedPassword = getPassword(userName, connection);
-
-            String oldDigestedPassword = SecurityUtil.digestString(oldPassword, hashMethod);
-
-            if (storedPassword != null) {
-                if (!storedPassword.equals(oldDigestedPassword)) {
-                    throw new RuntimeException("Previous password did not match correctly. Please specify old password"
-                            + " correctly.");
-                }
-            }
-
-            String sql = "update Users set password = ? where user_name = ?";
-
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, SecurityUtil.digestString(newPassword, hashMethod));
-            preparedStatement.setString(2, userName);
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-            log.debug("Password changed for user " + userName);
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error updating credentials.");
-            stringBuilder.append(" user - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } catch (NoSuchAlgorithmException e) {
-            String stringBuilder = "Error creating hash value for password.";
-            log.error(stringBuilder, e);
-
-            throw new RuntimeException(stringBuilder, e);
-        } finally {
-
-            dbUtil.cleanup(preparedStatement, connection);
-        }
-
-    }
-
-    public void changePasswordByAdmin(String userName, String newPassword) {
-
-        Connection connection = null;
-        PreparedStatement preparedStatement = null;
-
-        try {
-            connection = dbUtil.getConnection();
-
-            String sql = "update Users set password = ? where user_name = ?";
-
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, SecurityUtil.digestString(newPassword, hashMethod));
-            preparedStatement.setString(2, userName);
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-            log.debug("Admin changed password of user " + userName);
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error updating credentials.");
-            stringBuilder.append(" user - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } catch (NoSuchAlgorithmException e) {
-            String stringBuilder = "Error creating hash value for password.";
-            log.error(stringBuilder, e);
-
-            throw new RuntimeException(stringBuilder, e);
-        } finally {
-
-            dbUtil.cleanup(preparedStatement, connection);
-        }
-
-    }
-
-    public void deleteUser(String userName) {
-
-        String sql = "delete from Users where user_name=?";
-
-        Connection connection = null;
-        PreparedStatement preparedStatement = null;
-
-        try {
-            connection = dbUtil.getConnection();
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, userName);
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-            log.debug("User " + userName + " deleted.");
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error deleting user.");
-            stringBuilder.append("user - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } finally {
-            dbUtil.cleanup(preparedStatement, connection);
-        }
-
-    }
-
-    public List<String> getUsers() {
-
-        List<String> userList = new ArrayList<String>();
-
-        String sql = "select user_name from Users";
-
-        PreparedStatement preparedStatement = null;
-        ResultSet resultSet = null;
-        Connection connection = null;
-
-        try {
-
-            connection = dbUtil.getConnection();
-            preparedStatement = connection.prepareStatement(sql);
-
-            resultSet = preparedStatement.executeQuery();
-
-            while (resultSet.next()) {
-                userList.add(resultSet.getString("user_name"));
-            }
-
-        } catch (SQLException e) {
-            String errorString = "Error retrieving Users.";
-            log.error(errorString, e);
-
-            throw new RuntimeException(errorString, e);
-        } finally {
-
-            if (resultSet != null) {
-                try {
-                    resultSet.close();
-                } catch (SQLException e) {
-                    log.error("Error closing result set", e);
-                }
-            }
-
-            if (preparedStatement != null) {
-                try {
-                    preparedStatement.close();
-                } catch (SQLException e) {
-                    log.error("Error closing prepared statement", e);
-                }
-            }
-
-            if (connection != null) {
-                try {
-                    connection.close();
-                } catch (SQLException e) {
-                    log.error("Error closing connection", e);
-                }
-            }
-        }
-
-        Collections.sort(userList);
-
-        return userList;
-
-    }
-
-    public static String getPasswordRegularExpression() {
-        return "'^[a-zA-Z0-9_-]{6,15}$'";
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/HttpAuthenticatorFilter.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/HttpAuthenticatorFilter.java b/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/HttpAuthenticatorFilter.java
deleted file mode 100644
index 0847d54..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/HttpAuthenticatorFilter.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.credentialstore.session;
-
-import org.apache.airavata.security.AuthenticationException;
-import org.apache.airavata.security.Authenticator;
-import org.apache.airavata.security.configurations.AuthenticatorConfigurationReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.SAXException;
-
-import javax.servlet.*;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Calendar;
-import java.util.List;
-
-/**
- * A servlet filter class which intercepts the request and do authentication.
- */
-public class HttpAuthenticatorFilter implements Filter {
-
-    private List<Authenticator> authenticatorList;
-
-    private static Logger log = LoggerFactory.getLogger(HttpAuthenticatorFilter.class);
-
-    private ServletRequestHelper servletRequestHelper = new ServletRequestHelper();
-
-    @Override
-    public void init(FilterConfig filterConfig) throws ServletException {
-        String authenticatorConfiguration = filterConfig.getInitParameter("authenticatorConfigurations");
-
-        //TODO make this able to read from a file as well
-
-
-        InputStream configurationFileStream = HttpAuthenticatorFilter.class.getClassLoader().
-                getResourceAsStream(authenticatorConfiguration);
-
-        if (configurationFileStream == null) {
-            String msg = "Invalid authenticator configuration. Cannot read file - ".concat(authenticatorConfiguration);
-            log.error(msg);
-            throw new ServletException(msg);
-        }
-
-        AuthenticatorConfigurationReader authenticatorConfigurationReader
-                = new AuthenticatorConfigurationReader();
-        try {
-            authenticatorConfigurationReader.init(configurationFileStream);
-        } catch (IOException e) {
-            String msg = "Error reading authenticator configurations.";
-
-            log.error(msg, e);
-            throw new ServletException(msg, e);
-        } catch (ParserConfigurationException e) {
-            String msg = "Error parsing authenticator configurations.";
-
-            log.error(msg, e);
-            throw new ServletException(msg, e);
-        } catch (SAXException e) {
-            String msg = "Error parsing authenticator configurations.";
-
-            log.error(msg, e);
-            throw new ServletException(msg, e);
-        } finally {
-            try {
-                configurationFileStream.close();
-            } catch (IOException e) {
-                log.error("Error closing authenticator file stream.", e);
-            }
-        }
-
-        this.authenticatorList = authenticatorConfigurationReader.getAuthenticatorList();
-
-        if (this.authenticatorList.isEmpty()) {
-            String msg = "No authenticators registered in the system. System cannot function without authenticators";
-            log.error(msg);
-            throw new ServletException(msg);
-        }
-
-    }
-
-    @Override
-    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
-
-        // Firs check whether authenticators are disabled
-        if (! AuthenticatorConfigurationReader.isAuthenticationEnabled()) {
-
-            // Extract user id and gateway id
-            try {
-                servletRequestHelper.addIdentityInformationToSession((HttpServletRequest) servletRequest);
-            } catch (AuthenticationException e) {
-                log.warn("Error adding identity information to session.", e);
-                populateUnauthorisedData(servletResponse, "Error adding identity information to session.");
-
-            }
-
-            filterChain.doFilter(servletRequest, servletResponse);
-            return;
-        }
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
-
-        Authenticator authenticator = getAuthenticator(httpServletRequest);
-
-        if (authenticator == null) {
-            //sendUnauthorisedError(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
-            populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
-        } else {
-            if (authenticator.isAuthenticated(httpServletRequest)) {
-                // Allow request to flow
-                filterChain.doFilter(servletRequest, servletResponse);
-            } else {
-                try {
-                    if (!authenticator.authenticate(httpServletRequest)) {
-                        //sendUnauthorisedError(servletResponse, "Unauthorised : Provided credentials are not valid.");
-                        populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
-                    } else {
-                        // Allow request to flow
-                        filterChain.doFilter(servletRequest, servletResponse);
-                    }
-                } catch (AuthenticationException e) {
-                    String msg = "An error occurred while authenticating request.";
-                    log.error(msg, e);
-                    //sendUnauthorisedError(servletResponse, e.getMessage());
-                    populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
-                }
-            }
-        }
-    }
-
-    public static void sendUnauthorisedError(ServletResponse servletResponse, String message) throws IOException {
-        HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
-        httpServletResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, message);
-    }
-
-    @Override
-    public void destroy() {
-
-        this.authenticatorList = null;
-    }
-
-    private Authenticator getAuthenticator(HttpServletRequest httpServletRequest) {
-
-        for (Authenticator authenticator : authenticatorList) {
-            if (authenticator.canProcess(httpServletRequest)) {
-                return authenticator;
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * This method will create a 401 unauthorized response to be sent.
-     *
-     * @param servletResponse The HTTP response.
-     */
-    public static void populateUnauthorisedData(ServletResponse servletResponse, String message) {
-
-        HttpServletResponse httpServletResponse = (HttpServletResponse)servletResponse;
-
-        httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-        httpServletResponse.addHeader("Server", "Airavata Server");
-        httpServletResponse.addHeader("Description", message);
-        httpServletResponse.addDateHeader("Date", Calendar.getInstance().getTimeInMillis());
-        httpServletResponse.addHeader("WWW-Authenticate", "Basic realm=Airavata");
-        httpServletResponse.setContentType("text/html");
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/ServletRequestHelper.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/ServletRequestHelper.java b/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/ServletRequestHelper.java
deleted file mode 100644
index c4a2c47..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/java/org/apache/airavata/credentialstore/session/ServletRequestHelper.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *
- * 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.credentialstore.session;
-
-import org.apache.airavata.common.context.RequestContext;
-import org.apache.airavata.common.context.WorkflowContext;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.security.AuthenticationException;
-import org.apache.commons.codec.binary.Base64;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Helper class to extract request information.
- */
-public class ServletRequestHelper {
-
-    /**
-     * Header names
-     */
-    public static final String AUTHORISATION_HEADER_NAME = "Authorization";
-    private final static Logger logger = LoggerFactory.getLogger(ServletRequestHelper.class);
-    protected void addIdentityInformationToSession(HttpServletRequest servletRequest) throws AuthenticationException {
-
-        addUserToSession(null, servletRequest);
-    }
-
-    public void addUserToSession(String userName, HttpServletRequest servletRequest) throws AuthenticationException {
-
-        if (userName == null) {
-            userName = getUserName(servletRequest);
-        }
-
-        String gatewayId = getGatewayId(servletRequest);
-
-        if (servletRequest.getSession() != null) {
-			try {
-				servletRequest.getSession().setAttribute(Constants.USER_IN_SESSION, userName);
-				servletRequest.getSession().setAttribute(ServerSettings.getDefaultUserGateway(), gatewayId);
-			} catch (ApplicationSettingsException e) {
-                logger.error(e.getMessage(), e);
-			}
-        }
-
-        addToContext(userName, gatewayId);
-    }
-
-    String getUserName(HttpServletRequest httpServletRequest) throws AuthenticationException {
-
-        String basicHeader = httpServletRequest.getHeader(AUTHORISATION_HEADER_NAME);
-
-        if (basicHeader == null) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        String[] userNamePasswordArray = basicHeader.split(" ");
-
-        if (userNamePasswordArray == null || userNamePasswordArray.length != 2) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        String decodedString = decode(userNamePasswordArray[1]);
-
-        String[] array = decodedString.split(":");
-
-        if (array == null || array.length != 1) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        return array[0];
-
-    }
-
-    public String decode(String encoded) {
-        return new String(Base64.decodeBase64(encoded.getBytes()));
-    }
-
-    String getGatewayId(HttpServletRequest request) throws AuthenticationException {
-        String gatewayId = null;
-		try {
-			gatewayId = request.getHeader(ServerSettings.getDefaultUserGateway());
-		} catch (ApplicationSettingsException e1) {
-            logger.error(e1.getMessage(), e1);
-		}
-
-        if (gatewayId == null) {
-            try {
-                gatewayId = ServerSettings.getDefaultUserGateway();
-            } catch (ApplicationSettingsException e) {
-                throw new AuthenticationException("Unable to retrieve default gateway", e);
-            }
-        }
-
-        return gatewayId;
-    }
-
-    public void addToContext(String userName, String gatewayId) {
-
-        RequestContext requestContext = new RequestContext();
-        requestContext.setUserIdentity(userName);
-        requestContext.setGatewayId(gatewayId);
-
-        WorkflowContext.set(requestContext);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/resources/airavata-server.properties b/modules/credential-store-service/credential-store-webapp/src/main/resources/airavata-server.properties
deleted file mode 100644
index fb02901..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/resources/airavata-server.properties
+++ /dev/null
@@ -1,234 +0,0 @@
-#
-#
-# 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.
-#
-
-###########################################################################
-#
-#  This properties file provides configuration for all Airavata Services:
-#  API Server, Registry, Workflow Interpreter, GFac, Orchestrator
-#
-###########################################################################
-
-###########################################################################
-#  API Server Registry Configuration
-###########################################################################
-
-#for derby [AiravataJPARegistry]
-registry.jdbc.driver=org.apache.derby.jdbc.ClientDriver
-registry.jdbc.url=jdbc:derby://localhost:1527/persistent_data;create=true;user=airavata;password=airavata
-# MySql database configuration
-#registry.jdbc.driver=com.mysql.jdbc.Driver
-#registry.jdbc.url=jdbc:mysql://localhost:3306/persistent_data
-registry.jdbc.user=airavata
-registry.jdbc.password=airavata
-start.derby.server.mode=true
-validationQuery=SELECT 1 from CONFIGURATION
-jpa.cache.size=5000
-#jpa.connection.properties=MaxActive=10,MaxIdle=5,MinIdle=2,MaxWait=60000,testWhileIdle=true,testOnBorrow=true
-
-# Properties for default user mode
-default.registry.user=admin
-default.registry.password=admin
-default.registry.password.hash.method=SHA
-default.registry.gateway=default
-
-#ip=127.0.0.1
-
-###########################################################################
-#  Application Catalog DB Configuration
-###########################################################################
-#for derby [AiravataJPARegistry]
-appcatalog.jdbc.driver=org.apache.derby.jdbc.ClientDriver
-appcatalog.jdbc.url=jdbc:derby://localhost:1527/app_catalog;create=true;user=airavata;password=airavata
-# MySql database configuration
-#appcatalog.jdbc.driver=com.mysql.jdbc.Driver
-#appcatalog.jdbc.url=jdbc:mysql://localhost:3306/app_catalog
-appcatalog.jdbc.user=airavata
-appcatalog.jdbc.password=airavata
-appcatalog.validationQuery=SELECT 1 from CONFIGURATION
-
-###########################################################################
-#  Server module Configuration
-###########################################################################
-
-servers=apiserver,orchestrator,gfac,workflowserver
-#shutdown.trategy=NONE
-shutdown.trategy=SELF_TERMINATE
-
-
-apiserver.server.host=localhost
-apiserver.server.port=8930
-apiserver.server.min.threads=50
-workflow.server.host=localhost
-workflow.server.port=8931
-orchestrator.server.host=localhost
-orchestrator.server.port=8940
-gfac.server.host=localhost
-gfac.server.port=8950
-orchestrator.server.min.threads=50
-
-###########################################################################
-# Credential Store module Configuration
-###########################################################################
-credential.store.keystore.url=/Users/lahirugunathilake/Downloads/airavata_sym.jks
-credential.store.keystore.alias=airavata
-credential.store.keystore.password=airavata
-credential.store.jdbc.url=jdbc:derby://localhost:1527/persistent_data;create=true;user=airavata;password=airavata
-credential.store.jdbc.user=airavata
-credential.store.jdbc.password=airavata
-credential.store.jdbc.driver=org.apache.derby.jdbc.ClientDriver
-
-notifier.enabled=false
-#period in milliseconds
-notifier.duration=5000
-
-email.server=smtp.googlemail.com
-email.server.port=465
-email.user=airavata
-email.password=xxx
-email.ssl=true
-email.from=airavata@apache.org
-
-###########################################################################
-# Airavata GFac MyProxy GSI credentials to access Grid Resources.
-###########################################################################
-#
-# Security Configuration used by Airavata Generic Factory Service
-#  to interact with Computational Resources.
-#
-gfac=org.apache.airavata.gfac.server.GfacServer
-myproxy.server=myproxy.teragrid.org
-myproxy.username=ogce
-myproxy.password=
-myproxy.life=3600
-# XSEDE Trusted certificates can be downloaded from https://software.xsede.org/security/xsede-certs.tar.gz
-trusted.cert.location=/Users/lahirugunathilake/Downloads/certificates
-# SSH PKI key pair or ssh password can be used SSH based authentication is used.
-# if user specify both password authentication gets the higher preference
-
-################# ---------- For ssh key pair authentication ------------------- ################
-#public.ssh.key=/path to public key for ssh
-#ssh.username=username for ssh connection
-#private.ssh.key=/path to private key file for ssh
-#ssh.keypass=passphrase for the private key
-
-
-################# ---------- For ssh key pair authentication ------------------- ################
-#ssh.username=username for ssh connection
-#ssh.password=Password for ssh connection
-
-
-
-###########################################################################
-# Airavata Workflow Interpreter Configurations
-###########################################################################
-
-#runInThread=true
-#provenance=true
-#provenanceWriterThreadPoolSize=20
-#gfac.embedded=true
-#workflowserver=org.apache.airavata.api.server.WorkflowServer
-
-
-###########################################################################
-# API Server module Configuration
-###########################################################################
-apiserver=org.apache.airavata.api.server.AiravataAPIServer
-
-###########################################################################
-# Workflow Server module Configuration
-###########################################################################
-
-workflowserver=org.apache.airavata.api.server.WorkflowServer
-
-###########################################################################
-# Advance configuration to change service implementations
-###########################################################################
-# If false, disables two phase commit when submitting jobs
-TwoPhase=true
-#
-# Class which implemented HostScheduler interface. It will determine the which host to submit the request
-#
-host.scheduler=org.apache.airavata.gfac.core.scheduler.impl.SimpleHostScheduler
-
-###########################################################################
-# Monitoring module Configuration
-###########################################################################
-
-#This will be the primary monitoring tool which runs in airavata, in future there will be multiple monitoring
-#mechanisms and one would be able to start a monitor
-monitors=org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor,org.apache.airavata.gfac.monitor.impl.LocalJobMonitor
-
-
-###########################################################################
-# AMQP Notification Configuration
-###########################################################################
-
-
-amqp.notification.enable=1
-
-amqp.broker.host=localhost
-amqp.broker.port=5672
-amqp.broker.username=guest
-amqp.broker.password=guest
-
-amqp.sender=org.apache.airavata.wsmg.client.amqp.rabbitmq.AMQPSenderImpl
-amqp.topic.sender=org.apache.airavata.wsmg.client.amqp.rabbitmq.AMQPTopicSenderImpl
-amqp.broadcast.sender=org.apache.airavata.wsmg.client.amqp.rabbitmq.AMQPBroadcastSenderImpl
-
-#,org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor
-#This is the amqp related configuration and this lists down the Rabbitmq host, this is an xsede specific configuration
-amqp.hosts=info1.dyn.teragrid.org,info2.dyn.teragrid.org
-proxy.file.path=/Users/lahirugunathilake/Downloads/x509up_u503876
-connection.name=xsede
-#publisher
-activity.listeners=org.apache.airavata.gfac.core.monitor.AiravataJobStatusUpdator,org.apache.airavata.gfac.core.monitor.AiravataTaskStatusUpdator,org.apache.airavata.gfac.core.monitor.AiravataWorkflowNodeStatusUpdator,org.apache.airavata.api.server.listener.AiravataExperimentStatusUpdator,org.apache.airavata.gfac.core.monitor.GfacInternalStatusUpdator,org.apache.airavata.workflow.engine.util.ProxyMonitorPublisher
-publish.rabbitmq=false
-activity.publisher=org.apache.airavata.messaging.core.impl.RabbitMQPublisher
-rabbitmq.broker.url=amqp://localhost:5672
-rabbitmq.exchange.name=airavata_rabbitmq_exchange
-
-###########################################################################
-# Orchestrator module Configuration
-###########################################################################
-
-#job.submitter=org.apache.airavata.orchestrator.core.impl.GFACEmbeddedJobSubmitter
-job.submitter=org.apache.airavata.orchestrator.core.impl.GFACServiceJobSubmitter
-job.validators=org.apache.airavata.orchestrator.core.validator.impl.SimpleAppDataValidator,org.apache.airavata.orchestrator.core.validator.impl.ExperimentStatusValidator
-submitter.interval=10000
-threadpool.size=10
-start.submitter=true
-embedded.mode=true
-enable.validation=true
-orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer
-
-###########################################################################
-# Zookeeper Server Configuration
-###########################################################################
-
-embedded.zk=true
-zookeeper.server.host=localhost
-zookeeper.server.port=2181
-airavata-server=/api-server
-orchestrator-server=/orchestrator-server
-gfac-server=/gfac-server
-gfac-experiments=/gfac-experiments
-gfac-server-name=gfac-node0
-orchestrator-server-name=orch-node0
-airavata-server-name=api-node0

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/client.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/client.xml b/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/client.xml
deleted file mode 100644
index bc721ed..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/client.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Licensed to the Apache Software
-	Foundation (ASF) under one or more contributor license agreements. See the
-	NOTICE file distributed with this work for additional information regarding
-	copyright ownership. The ASF licenses this file to you under the Apache License,
-	Version 2.0 (theƏ "License"); you may not use this file except in compliance
-	with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-	Unless required by applicable law or agreed to in writing, software distributed
-	under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
-	OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for
-	the specific language governing permissions and limitations under the License. -->
-
-<config>
-    <client name="acs">
-        <logging
-                logFileName="../logs/oa4mp.log"
-                logName="oa4mp"
-                logSize="1000000"
-                logFileCount="2"
-                debug="true"/>
-        <id>myproxy:oa4mp,2012:/client/5a323fc6fcffcff7a95401046a303520</id>
-        <serviceUri>https://oa4mp.xsede.org/oauth</serviceUri>
-        <callbackUri>https://localhost:8443/credential-store/callback</callbackUri>
-        <!--callbackUri>http://149.165.228.118/PHP-Reference-Gateway/xsede_login.php</callbackUri-->
-        <lifetime>864000</lifetime>
-        <publicKeyFile>/Users/chathuri/dev/airavata/credential-store/oa4mp/oauth-pubkey.pem</publicKeyFile>
-        <privateKeyFile>/Users/chathuri/dev/airavata/credential-store/oa4mp/oauth-privkey.pk8</privateKeyFile>
-    </client>
-
-    <credential-store>
-        <successUri>http://gw120.iu.xsede.org/PHP-Reference-Gateway/</successUri>
-        <errorUri>/credential-store/error.jsp</errorUri>
-        <redirectUri>/credential-store/show-redirect.jsp</redirectUri>
-    </credential-store>
-
-</config>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/oauth-privkey.pk8
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/oauth-privkey.pk8 b/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/oauth-privkey.pk8
deleted file mode 100644
index 60f5b03..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/oauth-privkey.pk8
+++ /dev/null
@@ -1,28 +0,0 @@
------BEGIN PRIVATE KEY-----
-MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCx/4hqCePa3scs
-oyGuwjnNdQCGfoPBlaCfl02Xq4L623EygIVo0faCX1ZZ/gA9ldw0TqZ6weCHfGck
-22TLeFQnJ4plAqJMMUbYwqmhnSsC9zTuc+c/yzcvdw2aCLPkMXnofFUasQEGhPI3
-/avTHOeUYBeu4ZU3u7G2Dp0jMDg1yh95v0FnGAjSPSBWQm1q4sxT90YB8jZyGvZ8
-kRs4S9Ik8Vz1VKNHJ16LZOuThfsRV4Af7vM8jXztjKUsrxQf1ZpKauAvXbJcDS2O
-pTjHWSvASk2pQxnDZDNcENE40MtG7V7qiDblMCuYumO8xnsJIGLreMKnSOQZKnDL
-uoBPNLB9AgMBAAECggEBAIJtcfHxaUr5rwygRJAftec88rOahMUW9Om8Hpkijglv
-PtT4o8kZAP6rCUVL/7Ug2IhjkU2mPvZIS/QP5x3JADDoolo9wdr+yKEQkuffmKLF
-rb2EpFB0ge1/2TGjat2s+11Frb6vMMcsJ6ircnpxVae9ed0lYwfBuwhiUPZ14NpY
-Figcq4mbM1fOmKIc035sR/fRVeuSEYPguw0sZkkx9LPGluvNXypwhfho60WCpxaB
-tgAadJRQgTEqz4kjHDD7xqY0w/KUJyqCOaJHnv2RmrdwrzDWFls6ETcc93PmINJU
-Mt2uLZZdd2nlZki91EhHA5XpPC1LoM2qXKaShfUMDWkCgYEA2oSVtz0ftT1njuX2
-OjsJi3ENOjmSuHaw81h72ZcIskCVrxZVeq0LGJdBQt361Q5ZhtnIgPA1bJXWtQ9s
-miFGkkPiPJb5GI45aLqpv+dJ/F/tXa0Q9LN++hfW8fKN8LejlM6tTiiYs3EqYEXO
-qqcLPoptxak8ZwDkOfj8yvJib6cCgYEA0IesCrCy8fpjVeDQdiAlIZqsecPJ2+Fz
-jLMik2hvAk6Yiyd8DmK8HMtSPfYMN4BhiphW49TXSyIoFEeCRQE8KMdSu3W4Z1wP
-AURZzQL78GRHc1n7EgCi2gzu38rSQDekmaQYr/hw+IlTpURjT68pDGKYXOybbjxu
-zUb67PHaAzsCgYADgs/ZAt1ojxUD4cQECYDMwcNBpT0rQ5TyRACxbVDRdGIzTvuO
-ngsomP2OcnyeQb3EgelL0RA6r2mkvRu0mkZFAVw4NwDHmTlo6l7h23h/2pa4w5gb
-Jmsq34kvmAMZ1AmH0Y5NTC+v6miQ5W49pbNzjMvYujBjQ0tndw2wwRY9zwKBgQDG
-FksgcI/b+z1Hg+Kig5CiJlr25DypibWJD1Wl74ucBmszrNNUmwgU1jOOtl8Ojf6a
-eHH5xOKq9YxbDz65LB4oood9masNTE7YpkQj0lTfG3MgKXatuDr6pVR49CLba8AJ
-Tu9AoeE2xsTVdmxccoiswi/3/a78fZ3HlEiism+lpwKBgCx7aX3MESqgxbf1kHgI
-Tu0nnvu06UwzAhBU6IpGKCqwu8zwfGN/PTTTz95hySUc1S4fSLuHVrdTAQTT3Zwr
-hwX85AxYdiyGhbeXFLue+eDWQ7PxAKXfRAwsKpdC72ixkXVqnVRh2yhRMPqKqnEu
-A5i3nuKHICZgD2fwQf+A8OL6
------END PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/oauth-pubkey.pem
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/oauth-pubkey.pem b/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/oauth-pubkey.pem
deleted file mode 100644
index f094a6d..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/oauth-pubkey.pem
+++ /dev/null
@@ -1,9 +0,0 @@
------BEGIN PUBLIC KEY-----
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsf+Iagnj2t7HLKMhrsI5
-zXUAhn6DwZWgn5dNl6uC+ttxMoCFaNH2gl9WWf4APZXcNE6mesHgh3xnJNtky3hU
-JyeKZQKiTDFG2MKpoZ0rAvc07nPnP8s3L3cNmgiz5DF56HxVGrEBBoTyN/2r0xzn
-lGAXruGVN7uxtg6dIzA4Ncofeb9BZxgI0j0gVkJtauLMU/dGAfI2chr2fJEbOEvS
-JPFc9VSjRydei2Trk4X7EVeAH+7zPI187YylLK8UH9WaSmrgL12yXA0tjqU4x1kr
-wEpNqUMZw2QzXBDRONDLRu1e6og25TArmLpjvMZ7CSBi63jCp0jkGSpwy7qATzSw
-fQIDAQAB
------END PUBLIC KEY-----

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/WEB-INF/web.xml b/modules/credential-store-service/credential-store-webapp/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 252f889..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more
-    contributor license agreements. See the NOTICE file ~ distributed with this
-    work for additional information ~ regarding copyright ownership. The ASF
-    licenses this file ~ to you under the Apache License, Version 2.0 (the ~
-    "License"); you may not use this file except in compliance ~ with the License.
-    You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0
-    ~ ~ Unless required by applicable law or agreed to in writing, ~ software
-    distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT
-    WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
-    License for the ~ specific language governing permissions and limitations
-    ~ under the License. -->
-
-<!-- This web.xml file is not required when using Servlet 3.0 container,
-     see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e194 -->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xmlns="http://java.sun.com/xml/ns/javaee"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
-         id="WebApp_ID" version="2.5">
-
-    <listener>
-        <listener-class>org.apache.airavata.credential.store.servlet.CredentialBootstrapper</listener-class>
-    </listener>
-
-    <context-param>
-        <param-name>oa4mp:client.config.file</param-name>
-        <param-value>${catalina.home}/webapps/credential-store/WEB-INF/classes/credential-store/client.xml</param-value>
-    </context-param>
-
-    <!-- Credential store parameters -->
-    <context-param>
-        <param-name>credential-store-jdbc-url</param-name>
-        <param-value>jdbc:mysql://localhost/airavata</param-value>
-    </context-param>
-
-    <context-param>
-        <param-name>credential-store-db-user</param-name>
-        <param-value>root</param-value>
-    </context-param>
-
-    <context-param>
-        <param-name>credential-store-db-password</param-name>
-        <param-value>root123</param-value>
-    </context-param>
-
-    <context-param>
-        <param-name>credential-store-db-driver</param-name>
-        <param-value>com.mysql.jdbc.Driver</param-value>
-    </context-param>
-
-    <!-- ========================= Security Related Configurations go here ================================== -->
-
-    <filter>
-        <filter-name>CORS Filter</filter-name>
-        <filter-class>org.ebaysf.web.cors.CORSFilter</filter-class>
-        <init-param>
-            <description>A comma separated list of allowed origins. Note: An '*' cannot be used for an allowed origin when using credentials.</description>
-            <param-name>cors.allowed.origins</param-name>
-            <param-value>*</param-value>
-        </init-param>
-        <init-param>
-            <param-name>cors.allowed.methods</param-name>
-            <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
-        </init-param>
-        <init-param>
-            <param-name>cors.allowed.headers</param-name>
-            <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization</param-value>
-        </init-param>
-        <init-param>
-            <param-name>cors.exposed.headers</param-name>
-            <param-value></param-value>
-        </init-param>
-        <init-param>
-            <param-name>cors.support.credentials</param-name>
-            <param-value>true</param-value>
-        </init-param>
-        <init-param>
-            <param-name>cors.logging.enabled</param-name>
-            <param-value>false</param-value>
-        </init-param>
-        <init-param>
-            <param-name>cors.preflight.maxage</param-name>
-            <param-value>1800</param-value>
-        </init-param>
-        <init-param>
-            <param-name>cors.request.decorate</param-name>
-            <param-value>true</param-value>
-        </init-param>
-    </filter>
-
-    <filter-mapping>
-        <filter-name>CORS Filter</filter-name>
-        <url-pattern>/user-store/*</url-pattern>
-    </filter-mapping>
-
-    <!-- ================================ End Security Related Configurations =============================== -->
-
-    <!-- Credential Store Configurations -->
-    <servlet>
-        <servlet-name>credential-store-start</servlet-name>
-        <!--internal name of the servlet-->
-        <servlet-class>org.apache.airavata.credential.store.servlet.CredentialStoreStartServlet</servlet-class>
-
-        <load-on-startup>1</load-on-startup>
-        <!--load as soon as tomcat starts?-->
-    </servlet>
-
-    <servlet-mapping>
-        <servlet-name>credential-store-start</servlet-name>
-        <!--the servlet-name above-->
-        <url-pattern>/acs-start-servlet</url-pattern>
-        <!--what needs to be in the url, so http://foo.org/client/simple-->
-    </servlet-mapping>
-
-    <servlet>
-        <servlet-name>callback</servlet-name>
-        <!--internal name of the servlet-->
-        <servlet-class>org.apache.airavata.credential.store.servlet.CredentialStoreCallbackServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-        <!--load as soon as tomcat starts?-->
-    </servlet>
-
-    <servlet-mapping>
-        <servlet-name>callback</servlet-name>
-        <!--the servlet-name above-->
-        <url-pattern>/callback</url-pattern>
-        <!--what needs to be in the url, so http://foo.org/client/simple-->
-    </servlet-mapping>
-</web-app>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/acs/index.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/acs/index.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/acs/index.jsp
deleted file mode 100644
index e7626fa..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/acs/index.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-<%--
-  ~ 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.
-  --%>
-  
-<html>
-<body>
-<h2>Sample Portal</h2>
-<p>This demonstrates how portal can use Credential Store to obtain community credentials ...</p>
-<form name="input" action="../acs-start-servlet" method="post">
-
-    <table border="0">
-        <tr>
-            <td>Gateway Name</td>
-            <td><input type="text" name="gatewayName"></td>
-        </tr>
-        <tr>
-            <td>Portal Username</td>
-            <td><input type="text" name="portalUserName"></td>
-        </tr>
-        <tr>
-            <td>Contact Email</td>
-            <td><input type="text" name="email"></td>
-        </tr>
-    </table>
-
-    <input type="submit" value="Submit">
-</form>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/error.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/error.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/error.jsp
deleted file mode 100644
index adc430d..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/error.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%@ page import="org.apache.airavata.credential.store.util.CredentialStoreConstants" %>
-<%--
-  ~ 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.
-  --%>
-  
-
-<%
-    String gatewayName = request.getParameter(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER);
-    String portalUserName = request.getParameter(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER);
-    Throwable exception = (Throwable) request.getAttribute("exception");
-
-%>
-
-<html>
-<body>
-<h1>Credential Store</h1>
-<p>An error occurred while processing</p>
-<p>
-    Gateway Name - <%=gatewayName%>. Portal user name - <%=portalUserName%>.
-    Exception -
-
-</p>
-
-<p>
-    <%
-
-        out.println("Exception - " + exception.getMessage());
-        out.println();
-        StackTraceElement[] elements = exception.getStackTrace();
-        for (StackTraceElement element : elements) {
-            out.print("         ");
-            out.println(element.toString());
-        }
-
-    %>
-</p>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/password-credentials.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/password-credentials.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/password-credentials.jsp
deleted file mode 100644
index 59a1e04..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/password-credentials.jsp
+++ /dev/null
@@ -1,33 +0,0 @@
-<%--
-  ~ 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.
-  --%>
-
-<html>
-<body>
-<h2>Store Passwords</h2>
-<p>This demonstrates how portal can use Credential Store to obtain community credentials ...</p>
-<form name="input" action="../airavata-registry-rest-services/credential-store" method="post">
-
-    Gateway Name   : <input type="text" name="gatewayName"><br>
-    Portal Username: <input type="text" name="portalUserName"><br>
-    Contact Email: <input type="text" name="email">
-
-    <input type="submit" value="Submit">
-</form>
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/show-redirect.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/show-redirect.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/show-redirect.jsp
deleted file mode 100644
index 84b54cf..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/show-redirect.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-<%--
-  ~ 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.
-  --%>
-  
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-
-<%
-    String redirectUrlInRequest = (String) request.getAttribute("redirectUrl");
-%>
-
-<html>
-<head>
-    <script type="text/javascript">
-        <!--
-        function redirect(){
-            window.location = "<%=redirectUrlInRequest%>"
-        }
-        //-->
-    </script>
-</head>
-<body onLoad="setTimeout('redirect()', 1000)">
-<h2>You will be now redirect to MyProxy portal !</h2>
-<p>
-    If your browser didn't redirect to MyProxy Portal within 1 minute click following link,
-    <br><br> <a href="<%=redirectUrlInRequest%>"><%=redirectUrlInRequest%></a>
-</p>
-
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/success.jsp
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/success.jsp b/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/success.jsp
deleted file mode 100644
index f2964d0..0000000
--- a/modules/credential-store-service/credential-store-webapp/src/main/webapp/credential-store/success.jsp
+++ /dev/null
@@ -1,25 +0,0 @@
-<%--
-  ~ 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.
-  --%>
-  
-<html>
-<body>
-<h1>Credential Store</h1>
-<p>Certificate Successfully Stored !</p>
-</body>
-</html>
\ No newline at end of file


[04/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
new file mode 100644
index 0000000..5d9c05c
--- /dev/null
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
@@ -0,0 +1,6888 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.cpi;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class CredentialStoreService {
+
+  public interface Iface {
+
+    /**
+     * Query CS server to fetch the CPI version
+     */
+    public String getCSServiceVersion() throws org.apache.thrift.TException;
+
+    /**
+     * This method is to add SSHCredential which will return the token Id in success
+     * 
+     * 
+     * @param sshCredential
+     */
+    public String addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public String addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public String addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+  }
+
+  public interface AsyncIface {
+
+    public void getCSServiceVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void getSSHCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void getCertificateCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void getPasswordCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+  }
+
+  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+      public Factory() {}
+      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+        return new Client(prot);
+      }
+      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+        return new Client(iprot, oprot);
+      }
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol prot)
+    {
+      super(prot, prot);
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+      super(iprot, oprot);
+    }
+
+    public String getCSServiceVersion() throws org.apache.thrift.TException
+    {
+      send_getCSServiceVersion();
+      return recv_getCSServiceVersion();
+    }
+
+    public void send_getCSServiceVersion() throws org.apache.thrift.TException
+    {
+      getCSServiceVersion_args args = new getCSServiceVersion_args();
+      sendBase("getCSServiceVersion", args);
+    }
+
+    public String recv_getCSServiceVersion() throws org.apache.thrift.TException
+    {
+      getCSServiceVersion_result result = new getCSServiceVersion_result();
+      receiveBase(result, "getCSServiceVersion");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCSServiceVersion failed: unknown result");
+    }
+
+    public String addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_addSSHCredential(sshCredential);
+      return recv_addSSHCredential();
+    }
+
+    public void send_addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) throws org.apache.thrift.TException
+    {
+      addSSHCredential_args args = new addSSHCredential_args();
+      args.setSshCredential(sshCredential);
+      sendBase("addSSHCredential", args);
+    }
+
+    public String recv_addSSHCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      addSSHCredential_result result = new addSSHCredential_result();
+      receiveBase(result, "addSSHCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addSSHCredential failed: unknown result");
+    }
+
+    public String addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_addCertificateCredential(certificateCredential);
+      return recv_addCertificateCredential();
+    }
+
+    public void send_addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential) throws org.apache.thrift.TException
+    {
+      addCertificateCredential_args args = new addCertificateCredential_args();
+      args.setCertificateCredential(certificateCredential);
+      sendBase("addCertificateCredential", args);
+    }
+
+    public String recv_addCertificateCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      addCertificateCredential_result result = new addCertificateCredential_result();
+      receiveBase(result, "addCertificateCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addCertificateCredential failed: unknown result");
+    }
+
+    public String addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_addPasswordCredential(passwordCredential);
+      return recv_addPasswordCredential();
+    }
+
+    public void send_addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.thrift.TException
+    {
+      addPasswordCredential_args args = new addPasswordCredential_args();
+      args.setPasswordCredential(passwordCredential);
+      sendBase("addPasswordCredential", args);
+    }
+
+    public String recv_addPasswordCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      addPasswordCredential_result result = new addPasswordCredential_result();
+      receiveBase(result, "addPasswordCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addPasswordCredential failed: unknown result");
+    }
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_getSSHCredential(tokenId, gatewayId);
+      return recv_getSSHCredential();
+    }
+
+    public void send_getSSHCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException
+    {
+      getSSHCredential_args args = new getSSHCredential_args();
+      args.setTokenId(tokenId);
+      args.setGatewayId(gatewayId);
+      sendBase("getSSHCredential", args);
+    }
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential recv_getSSHCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      getSSHCredential_result result = new getSSHCredential_result();
+      receiveBase(result, "getSSHCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getSSHCredential failed: unknown result");
+    }
+
+    public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_getCertificateCredential(tokenId, gatewayId);
+      return recv_getCertificateCredential();
+    }
+
+    public void send_getCertificateCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException
+    {
+      getCertificateCredential_args args = new getCertificateCredential_args();
+      args.setTokenId(tokenId);
+      args.setGatewayId(gatewayId);
+      sendBase("getCertificateCredential", args);
+    }
+
+    public org.apache.airavata.credential.store.datamodel.CertificateCredential recv_getCertificateCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      getCertificateCredential_result result = new getCertificateCredential_result();
+      receiveBase(result, "getCertificateCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCertificateCredential failed: unknown result");
+    }
+
+    public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_getPasswordCredential(tokenId, gatewayId);
+      return recv_getPasswordCredential();
+    }
+
+    public void send_getPasswordCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException
+    {
+      getPasswordCredential_args args = new getPasswordCredential_args();
+      args.setTokenId(tokenId);
+      args.setGatewayId(gatewayId);
+      sendBase("getPasswordCredential", args);
+    }
+
+    public org.apache.airavata.credential.store.datamodel.PasswordCredential recv_getPasswordCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      getPasswordCredential_result result = new getPasswordCredential_result();
+      receiveBase(result, "getPasswordCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPasswordCredential failed: unknown result");
+    }
+
+  }
+  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
+    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
+      private org.apache.thrift.async.TAsyncClientManager clientManager;
+      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+        this.clientManager = clientManager;
+        this.protocolFactory = protocolFactory;
+      }
+      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+        return new AsyncClient(protocolFactory, clientManager, transport);
+      }
+    }
+
+    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+      super(protocolFactory, clientManager, transport);
+    }
+
+    public void getCSServiceVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getCSServiceVersion_call method_call = new getCSServiceVersion_call(resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getCSServiceVersion_call extends org.apache.thrift.async.TAsyncMethodCall {
+      public getCSServiceVersion_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCSServiceVersion", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getCSServiceVersion_args args = new getCSServiceVersion_args();
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getCSServiceVersion();
+      }
+    }
+
+    public void addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      addSSHCredential_call method_call = new addSSHCredential_call(sshCredential, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class addSSHCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential;
+      public addSSHCredential_call(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.sshCredential = sshCredential;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addSSHCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        addSSHCredential_args args = new addSSHCredential_args();
+        args.setSshCredential(sshCredential);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_addSSHCredential();
+      }
+    }
+
+    public void addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      addCertificateCredential_call method_call = new addCertificateCredential_call(certificateCredential, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class addCertificateCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential;
+      public addCertificateCredential_call(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.certificateCredential = certificateCredential;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addCertificateCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        addCertificateCredential_args args = new addCertificateCredential_args();
+        args.setCertificateCredential(certificateCredential);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_addCertificateCredential();
+      }
+    }
+
+    public void addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      addPasswordCredential_call method_call = new addPasswordCredential_call(passwordCredential, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class addPasswordCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential;
+      public addPasswordCredential_call(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.passwordCredential = passwordCredential;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addPasswordCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        addPasswordCredential_args args = new addPasswordCredential_args();
+        args.setPasswordCredential(passwordCredential);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_addPasswordCredential();
+      }
+    }
+
+    public void getSSHCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getSSHCredential_call method_call = new getSSHCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getSSHCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String tokenId;
+      private String gatewayId;
+      public getSSHCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.tokenId = tokenId;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getSSHCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getSSHCredential_args args = new getSSHCredential_args();
+        args.setTokenId(tokenId);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.airavata.credential.store.datamodel.SSHCredential getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getSSHCredential();
+      }
+    }
+
+    public void getCertificateCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getCertificateCredential_call method_call = new getCertificateCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getCertificateCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String tokenId;
+      private String gatewayId;
+      public getCertificateCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.tokenId = tokenId;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCertificateCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getCertificateCredential_args args = new getCertificateCredential_args();
+        args.setTokenId(tokenId);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.airavata.credential.store.datamodel.CertificateCredential getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getCertificateCredential();
+      }
+    }
+
+    public void getPasswordCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getPasswordCredential_call method_call = new getPasswordCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getPasswordCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String tokenId;
+      private String gatewayId;
+      public getPasswordCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.tokenId = tokenId;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPasswordCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getPasswordCredential_args args = new getPasswordCredential_args();
+        args.setTokenId(tokenId);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.airavata.credential.store.datamodel.PasswordCredential getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getPasswordCredential();
+      }
+    }
+
+  }
+
+  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+    public Processor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+    }
+
+    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      processMap.put("getCSServiceVersion", new getCSServiceVersion());
+      processMap.put("addSSHCredential", new addSSHCredential());
+      processMap.put("addCertificateCredential", new addCertificateCredential());
+      processMap.put("addPasswordCredential", new addPasswordCredential());
+      processMap.put("getSSHCredential", new getSSHCredential());
+      processMap.put("getCertificateCredential", new getCertificateCredential());
+      processMap.put("getPasswordCredential", new getPasswordCredential());
+      return processMap;
+    }
+
+    public static class getCSServiceVersion<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getCSServiceVersion_args> {
+      public getCSServiceVersion() {
+        super("getCSServiceVersion");
+      }
+
+      public getCSServiceVersion_args getEmptyArgsInstance() {
+        return new getCSServiceVersion_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getCSServiceVersion_result getResult(I iface, getCSServiceVersion_args args) throws org.apache.thrift.TException {
+        getCSServiceVersion_result result = new getCSServiceVersion_result();
+        result.success = iface.getCSServiceVersion();
+        return result;
+      }
+    }
+
+    public static class addSSHCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addSSHCredential_args> {
+      public addSSHCredential() {
+        super("addSSHCredential");
+      }
+
+      public addSSHCredential_args getEmptyArgsInstance() {
+        return new addSSHCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public addSSHCredential_result getResult(I iface, addSSHCredential_args args) throws org.apache.thrift.TException {
+        addSSHCredential_result result = new addSSHCredential_result();
+        try {
+          result.success = iface.addSSHCredential(args.sshCredential);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class addCertificateCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addCertificateCredential_args> {
+      public addCertificateCredential() {
+        super("addCertificateCredential");
+      }
+
+      public addCertificateCredential_args getEmptyArgsInstance() {
+        return new addCertificateCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public addCertificateCredential_result getResult(I iface, addCertificateCredential_args args) throws org.apache.thrift.TException {
+        addCertificateCredential_result result = new addCertificateCredential_result();
+        try {
+          result.success = iface.addCertificateCredential(args.certificateCredential);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class addPasswordCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addPasswordCredential_args> {
+      public addPasswordCredential() {
+        super("addPasswordCredential");
+      }
+
+      public addPasswordCredential_args getEmptyArgsInstance() {
+        return new addPasswordCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public addPasswordCredential_result getResult(I iface, addPasswordCredential_args args) throws org.apache.thrift.TException {
+        addPasswordCredential_result result = new addPasswordCredential_result();
+        try {
+          result.success = iface.addPasswordCredential(args.passwordCredential);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class getSSHCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getSSHCredential_args> {
+      public getSSHCredential() {
+        super("getSSHCredential");
+      }
+
+      public getSSHCredential_args getEmptyArgsInstance() {
+        return new getSSHCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getSSHCredential_result getResult(I iface, getSSHCredential_args args) throws org.apache.thrift.TException {
+        getSSHCredential_result result = new getSSHCredential_result();
+        try {
+          result.success = iface.getSSHCredential(args.tokenId, args.gatewayId);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class getCertificateCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getCertificateCredential_args> {
+      public getCertificateCredential() {
+        super("getCertificateCredential");
+      }
+
+      public getCertificateCredential_args getEmptyArgsInstance() {
+        return new getCertificateCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getCertificateCredential_result getResult(I iface, getCertificateCredential_args args) throws org.apache.thrift.TException {
+        getCertificateCredential_result result = new getCertificateCredential_result();
+        try {
+          result.success = iface.getCertificateCredential(args.tokenId, args.gatewayId);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class getPasswordCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getPasswordCredential_args> {
+      public getPasswordCredential() {
+        super("getPasswordCredential");
+      }
+
+      public getPasswordCredential_args getEmptyArgsInstance() {
+        return new getPasswordCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getPasswordCredential_result getResult(I iface, getPasswordCredential_args args) throws org.apache.thrift.TException {
+        getPasswordCredential_result result = new getPasswordCredential_result();
+        try {
+          result.success = iface.getPasswordCredential(args.tokenId, args.gatewayId);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+  }
+
+  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
+    public AsyncProcessor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+    }
+
+    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      processMap.put("getCSServiceVersion", new getCSServiceVersion());
+      processMap.put("addSSHCredential", new addSSHCredential());
+      processMap.put("addCertificateCredential", new addCertificateCredential());
+      processMap.put("addPasswordCredential", new addPasswordCredential());
+      processMap.put("getSSHCredential", new getSSHCredential());
+      processMap.put("getCertificateCredential", new getCertificateCredential());
+      processMap.put("getPasswordCredential", new getPasswordCredential());
+      return processMap;
+    }
+
+    public static class getCSServiceVersion<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getCSServiceVersion_args, String> {
+      public getCSServiceVersion() {
+        super("getCSServiceVersion");
+      }
+
+      public getCSServiceVersion_args getEmptyArgsInstance() {
+        return new getCSServiceVersion_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            getCSServiceVersion_result result = new getCSServiceVersion_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getCSServiceVersion_result result = new getCSServiceVersion_result();
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getCSServiceVersion_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.getCSServiceVersion(resultHandler);
+      }
+    }
+
+    public static class addSSHCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addSSHCredential_args, String> {
+      public addSSHCredential() {
+        super("addSSHCredential");
+      }
+
+      public addSSHCredential_args getEmptyArgsInstance() {
+        return new addSSHCredential_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            addSSHCredential_result result = new addSSHCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            addSSHCredential_result result = new addSSHCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, addSSHCredential_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.addSSHCredential(args.sshCredential,resultHandler);
+      }
+    }
+
+    public static class addCertificateCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addCertificateCredential_args, String> {
+      public addCertificateCredential() {
+        super("addCertificateCredential");
+      }
+
+      public addCertificateCredential_args getEmptyArgsInstance() {
+        return new addCertificateCredential_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            addCertificateCredential_result result = new addCertificateCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            addCertificateCredential_result result = new addCertificateCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, addCertificateCredential_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.addCertificateCredential(args.certificateCredential,resultHandler);
+      }
+    }
+
+    public static class addPasswordCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addPasswordCredential_args, String> {
+      public addPasswordCredential() {
+        super("addPasswordCredential");
+      }
+
+      public addPasswordCredential_args getEmptyArgsInstance() {
+        return new addPasswordCredential_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            addPasswordCredential_result result = new addPasswordCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            addPasswordCredential_result result = new addPasswordCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, addPasswordCredential_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.addPasswordCredential(args.passwordCredential,resultHandler);
+      }
+    }
+
+    public static class getSSHCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getSSHCredential_args, org.apache.airavata.credential.store.datamodel.SSHCredential> {
+      public getSSHCredential() {
+        super("getSSHCredential");
+      }
+
+      public getSSHCredential_args getEmptyArgsInstance() {
+        return new getSSHCredential_args();
+      }
+
+      public AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential>() { 
+          public void onComplete(org.apache.airavata.credential.store.datamodel.SSHCredential o) {
+            getSSHCredential_result result = new getSSHCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getSSHCredential_result result = new getSSHCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getSSHCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential> resultHandler) throws TException {
+        iface.getSSHCredential(args.tokenId, args.gatewayId,resultHandler);
+      }
+    }
+
+    public static class getCertificateCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getCertificateCredential_args, org.apache.airavata.credential.store.datamodel.CertificateCredential> {
+      public getCertificateCredential() {
+        super("getCertificateCredential");
+      }
+
+      public getCertificateCredential_args getEmptyArgsInstance() {
+        return new getCertificateCredential_args();
+      }
+
+      public AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential>() { 
+          public void onComplete(org.apache.airavata.credential.store.datamodel.CertificateCredential o) {
+            getCertificateCredential_result result = new getCertificateCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getCertificateCredential_result result = new getCertificateCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getCertificateCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential> resultHandler) throws TException {
+        iface.getCertificateCredential(args.tokenId, args.gatewayId,resultHandler);
+      }
+    }
+
+    public static class getPasswordCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getPasswordCredential_args, org.apache.airavata.credential.store.datamodel.PasswordCredential> {
+      public getPasswordCredential() {
+        super("getPasswordCredential");
+      }
+
+      public getPasswordCredential_args getEmptyArgsInstance() {
+        return new getPasswordCredential_args();
+      }
+
+      public AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential>() { 
+          public void onComplete(org.apache.airavata.credential.store.datamodel.PasswordCredential o) {
+            getPasswordCredential_result result = new getPasswordCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getPasswordCredential_result result = new getPasswordCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getPasswordCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential> resultHandler) throws TException {
+        iface.getPasswordCredential(args.tokenId, args.gatewayId,resultHandler);
+      }
+    }
+
+  }
+
+  public static class getCSServiceVersion_args implements org.apache.thrift.TBase<getCSServiceVersion_args, getCSServiceVersion_args._Fields>, java.io.Serializable, Cloneable, Comparable<getCSServiceVersion_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getCSServiceVersion_args");
+
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new getCSServiceVersion_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getCSServiceVersion_argsTupleSchemeFactory());
+    }
+
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+;
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCSServiceVersion_args.class, metaDataMap);
+    }
+
+    public getCSServiceVersion_args() {
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getCSServiceVersion_args(getCSServiceVersion_args other) {
+    }
+
+    public getCSServiceVersion_args deepCopy() {
+      return new getCSServiceVersion_args(this);
+    }
+
+    @Override
+    public void clear() {
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getCSServiceVersion_args)
+        return this.equals((getCSServiceVersion_args)that);
+      return false;
+    }
+
+    public boolean equals(getCSServiceVersion_args that) {
+      if (that == null)
+        return false;
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(getCSServiceVersion_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getCSServiceVersion_args(");
+      boolean first = true;
+
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getCSServiceVersion_argsStandardSchemeFactory implements SchemeFactory {
+      public getCSServiceVersion_argsStandardScheme getScheme() {
+        return new getCSServiceVersion_argsStandardScheme();
+      }
+    }
+
+    private static class getCSServiceVersion_argsStandardScheme extends StandardScheme<getCSServiceVersion_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getCSServiceVersion_argsTupleSchemeFactory implements SchemeFactory {
+      public getCSServiceVersion_argsTupleScheme getScheme() {
+        return new getCSServiceVersion_argsTupleScheme();
+      }
+    }
+
+    private static class getCSServiceVersion_argsTupleScheme extends TupleScheme<getCSServiceVersion_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+      }
+    }
+
+  }
+
+  public static class getCSServiceVersion_result implements org.apache.thrift.TBase<getCSServiceVersion_result, getCSServiceVersion_result._Fields>, java.io.Serializable, Cloneable, Comparable<getCSServiceVersion_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getCSServiceVersion_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new getCSServiceVersion_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getCSServiceVersion_resultTupleSchemeFactory());
+    }
+
+    public String success; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCSServiceVersion_result.class, metaDataMap);
+    }
+
+    public getCSServiceVersion_result() {
+    }
+
+    public getCSServiceVersion_result(
+      String success)
+    {
+      this();
+      this.success = success;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getCSServiceVersion_result(getCSServiceVersion_result other) {
+      if (other.isSetSuccess()) {
+        this.success = other.success;
+      }
+    }
+
+    public getCSServiceVersion_result deepCopy() {
+      return new getCSServiceVersion_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+    }
+
+    public String getSuccess() {
+      return this.success;
+    }
+
+    public getCSServiceVersion_result setSuccess(String success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((String)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getCSServiceVersion_result)
+        return this.equals((getCSServiceVersion_result)that);
+      return false;
+    }
+
+    public boolean equals(getCSServiceVersion_result that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(getCSServiceVersion_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getCSServiceVersion_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getCSServiceVersion_resultStandardSchemeFactory implements SchemeFactory {
+      public getCSServiceVersion_resultStandardScheme getScheme() {
+        return new getCSServiceVersion_resultStandardScheme();
+      }
+    }
+
+    private static class getCSServiceVersion_resultStandardScheme extends StandardScheme<getCSServiceVersion_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.success = iprot.readString();
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          oprot.writeString(struct.success);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getCSServiceVersion_resultTupleSchemeFactory implements SchemeFactory {
+      public getCSServiceVersion_resultTupleScheme getScheme() {
+        return new getCSServiceVersion_resultTupleScheme();
+      }
+    }
+
+    private static class getCSServiceVersion_resultTupleScheme extends TupleScheme<getCSServiceVersion_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetSuccess()) {
+          oprot.writeString(struct.success);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.success = iprot.readString();
+          struct.setSuccessIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class addSSHCredential_args implements org.apache.thrift.TBase<addSSHCredential_args, addSSHCredential_args._Fields>, java.io.Serializable, Cloneable, Comparable<addSSHCredential_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("addSSHCredential_args");
+
+    private static final org.apache.thrift.protocol.TField SSH_CREDENTIAL_FIELD_DESC = new org.apache.thrift.protocol.TField("sshCredential", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new addSSHCredential_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new addSSHCredential_argsTupleSchemeFactory());
+    }
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SSH_CREDENTIAL((short)1, "sshCredential");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // SSH_CREDENTIAL
+            return SSH_CREDENTIAL;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SSH_CREDENTIAL, new org.apache.thrift.meta_data.FieldMetaData("sshCredential", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.credential.store.datamodel.SSHCredential.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(addSSHCredential_args.class, metaDataMap);
+    }
+
+    public addSSHCredential_args() {
+    }
+
+    public addSSHCredential_args(
+      org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential)
+    {
+      this();
+      this.sshCredential = sshCredential;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public addSSHCredential_args(addSSHCredential_args other) {
+      if (other.isSetSshCredential()) {
+        this.sshCredential = new org.apache.airavata.credential.store.datamodel.SSHCredential(other.sshCredential);
+      }
+    }
+
+    public addSSHCredential_args deepCopy() {
+      return new addSSHCredential_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.sshCredential = null;
+    }
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential getSshCredential() {
+      return this.sshCredential;
+    }
+
+    public addSSHCredential_args setSshCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) {
+      this.sshCredential = sshCredential;
+      return this;
+    }
+
+    public void unsetSshCredential() {
+      this.sshCredential = null;
+    }
+
+    /** Returns true if field sshCredential is set (has been assigned a value) and false otherwise */
+    public boolean isSetSshCredential() {
+      return this.sshCredential != null;
+    }
+
+    public void setSshCredentialIsSet(boolean value) {
+      if (!value) {
+        this.sshCredential = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SSH_CREDENTIAL:
+        if (value == null) {
+          unsetSshCredential();
+        } else {
+          setSshCredential((org.apache.airavata.credential.store.datamodel.SSHCredential)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SSH_CREDENTIAL:
+        return getSshCredential();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SSH_CREDENTIAL:
+        return isSetSshCredential();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof addSSHCredential_args)
+        return this.equals((addSSHCredential_args)that);
+      return false;
+    }
+
+    public boolean equals(addSSHCredential_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_sshCredential = true && this.isSetSshCredential();
+      boolean that_present_sshCredential = true && that.isSetSshCredential();
+      if (this_present_sshCredential || that_present_sshCredential) {
+        if (!(this_present_sshCredential && that_present_sshCredential))
+          return false;
+        if (!this.sshCredential.equals(that.sshCredential))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(addSSHCredential_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSshCredential()).compareTo(other.isSetSshCredential());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSshCredential()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sshCredential, other.sshCredential);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("addSSHCredential_args(");
+      boolean first = true;
+
+      sb.append("sshCredential:");
+      if (this.sshCredential == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.sshCredential);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (sshCredential == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'sshCredential' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (sshCredential != null) {
+        sshCredential.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void 

<TRUNCATED>

[09/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
new file mode 100644
index 0000000..5d9c05c
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
@@ -0,0 +1,6888 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.cpi;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class CredentialStoreService {
+
+  public interface Iface {
+
+    /**
+     * Query CS server to fetch the CPI version
+     */
+    public String getCSServiceVersion() throws org.apache.thrift.TException;
+
+    /**
+     * This method is to add SSHCredential which will return the token Id in success
+     * 
+     * 
+     * @param sshCredential
+     */
+    public String addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public String addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public String addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+    public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException;
+
+  }
+
+  public interface AsyncIface {
+
+    public void getCSServiceVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void getSSHCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void getCertificateCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void getPasswordCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+  }
+
+  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+      public Factory() {}
+      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+        return new Client(prot);
+      }
+      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+        return new Client(iprot, oprot);
+      }
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol prot)
+    {
+      super(prot, prot);
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+      super(iprot, oprot);
+    }
+
+    public String getCSServiceVersion() throws org.apache.thrift.TException
+    {
+      send_getCSServiceVersion();
+      return recv_getCSServiceVersion();
+    }
+
+    public void send_getCSServiceVersion() throws org.apache.thrift.TException
+    {
+      getCSServiceVersion_args args = new getCSServiceVersion_args();
+      sendBase("getCSServiceVersion", args);
+    }
+
+    public String recv_getCSServiceVersion() throws org.apache.thrift.TException
+    {
+      getCSServiceVersion_result result = new getCSServiceVersion_result();
+      receiveBase(result, "getCSServiceVersion");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCSServiceVersion failed: unknown result");
+    }
+
+    public String addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_addSSHCredential(sshCredential);
+      return recv_addSSHCredential();
+    }
+
+    public void send_addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) throws org.apache.thrift.TException
+    {
+      addSSHCredential_args args = new addSSHCredential_args();
+      args.setSshCredential(sshCredential);
+      sendBase("addSSHCredential", args);
+    }
+
+    public String recv_addSSHCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      addSSHCredential_result result = new addSSHCredential_result();
+      receiveBase(result, "addSSHCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addSSHCredential failed: unknown result");
+    }
+
+    public String addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_addCertificateCredential(certificateCredential);
+      return recv_addCertificateCredential();
+    }
+
+    public void send_addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential) throws org.apache.thrift.TException
+    {
+      addCertificateCredential_args args = new addCertificateCredential_args();
+      args.setCertificateCredential(certificateCredential);
+      sendBase("addCertificateCredential", args);
+    }
+
+    public String recv_addCertificateCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      addCertificateCredential_result result = new addCertificateCredential_result();
+      receiveBase(result, "addCertificateCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addCertificateCredential failed: unknown result");
+    }
+
+    public String addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_addPasswordCredential(passwordCredential);
+      return recv_addPasswordCredential();
+    }
+
+    public void send_addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.thrift.TException
+    {
+      addPasswordCredential_args args = new addPasswordCredential_args();
+      args.setPasswordCredential(passwordCredential);
+      sendBase("addPasswordCredential", args);
+    }
+
+    public String recv_addPasswordCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      addPasswordCredential_result result = new addPasswordCredential_result();
+      receiveBase(result, "addPasswordCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addPasswordCredential failed: unknown result");
+    }
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_getSSHCredential(tokenId, gatewayId);
+      return recv_getSSHCredential();
+    }
+
+    public void send_getSSHCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException
+    {
+      getSSHCredential_args args = new getSSHCredential_args();
+      args.setTokenId(tokenId);
+      args.setGatewayId(gatewayId);
+      sendBase("getSSHCredential", args);
+    }
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential recv_getSSHCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      getSSHCredential_result result = new getSSHCredential_result();
+      receiveBase(result, "getSSHCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getSSHCredential failed: unknown result");
+    }
+
+    public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_getCertificateCredential(tokenId, gatewayId);
+      return recv_getCertificateCredential();
+    }
+
+    public void send_getCertificateCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException
+    {
+      getCertificateCredential_args args = new getCertificateCredential_args();
+      args.setTokenId(tokenId);
+      args.setGatewayId(gatewayId);
+      sendBase("getCertificateCredential", args);
+    }
+
+    public org.apache.airavata.credential.store.datamodel.CertificateCredential recv_getCertificateCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      getCertificateCredential_result result = new getCertificateCredential_result();
+      receiveBase(result, "getCertificateCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCertificateCredential failed: unknown result");
+    }
+
+    public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      send_getPasswordCredential(tokenId, gatewayId);
+      return recv_getPasswordCredential();
+    }
+
+    public void send_getPasswordCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException
+    {
+      getPasswordCredential_args args = new getPasswordCredential_args();
+      args.setTokenId(tokenId);
+      args.setGatewayId(gatewayId);
+      sendBase("getPasswordCredential", args);
+    }
+
+    public org.apache.airavata.credential.store.datamodel.PasswordCredential recv_getPasswordCredential() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException
+    {
+      getPasswordCredential_result result = new getPasswordCredential_result();
+      receiveBase(result, "getPasswordCredential");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.csException != null) {
+        throw result.csException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPasswordCredential failed: unknown result");
+    }
+
+  }
+  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
+    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
+      private org.apache.thrift.async.TAsyncClientManager clientManager;
+      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+        this.clientManager = clientManager;
+        this.protocolFactory = protocolFactory;
+      }
+      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+        return new AsyncClient(protocolFactory, clientManager, transport);
+      }
+    }
+
+    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+      super(protocolFactory, clientManager, transport);
+    }
+
+    public void getCSServiceVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getCSServiceVersion_call method_call = new getCSServiceVersion_call(resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getCSServiceVersion_call extends org.apache.thrift.async.TAsyncMethodCall {
+      public getCSServiceVersion_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCSServiceVersion", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getCSServiceVersion_args args = new getCSServiceVersion_args();
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getCSServiceVersion();
+      }
+    }
+
+    public void addSSHCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      addSSHCredential_call method_call = new addSSHCredential_call(sshCredential, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class addSSHCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential;
+      public addSSHCredential_call(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.sshCredential = sshCredential;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addSSHCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        addSSHCredential_args args = new addSSHCredential_args();
+        args.setSshCredential(sshCredential);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_addSSHCredential();
+      }
+    }
+
+    public void addCertificateCredential(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      addCertificateCredential_call method_call = new addCertificateCredential_call(certificateCredential, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class addCertificateCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential;
+      public addCertificateCredential_call(org.apache.airavata.credential.store.datamodel.CertificateCredential certificateCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.certificateCredential = certificateCredential;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addCertificateCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        addCertificateCredential_args args = new addCertificateCredential_args();
+        args.setCertificateCredential(certificateCredential);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_addCertificateCredential();
+      }
+    }
+
+    public void addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      addPasswordCredential_call method_call = new addPasswordCredential_call(passwordCredential, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class addPasswordCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential;
+      public addPasswordCredential_call(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.passwordCredential = passwordCredential;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addPasswordCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        addPasswordCredential_args args = new addPasswordCredential_args();
+        args.setPasswordCredential(passwordCredential);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_addPasswordCredential();
+      }
+    }
+
+    public void getSSHCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getSSHCredential_call method_call = new getSSHCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getSSHCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String tokenId;
+      private String gatewayId;
+      public getSSHCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.tokenId = tokenId;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getSSHCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getSSHCredential_args args = new getSSHCredential_args();
+        args.setTokenId(tokenId);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.airavata.credential.store.datamodel.SSHCredential getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getSSHCredential();
+      }
+    }
+
+    public void getCertificateCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getCertificateCredential_call method_call = new getCertificateCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getCertificateCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String tokenId;
+      private String gatewayId;
+      public getCertificateCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.tokenId = tokenId;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCertificateCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getCertificateCredential_args args = new getCertificateCredential_args();
+        args.setTokenId(tokenId);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.airavata.credential.store.datamodel.CertificateCredential getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getCertificateCredential();
+      }
+    }
+
+    public void getPasswordCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getPasswordCredential_call method_call = new getPasswordCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getPasswordCredential_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String tokenId;
+      private String gatewayId;
+      public getPasswordCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.tokenId = tokenId;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPasswordCredential", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getPasswordCredential_args args = new getPasswordCredential_args();
+        args.setTokenId(tokenId);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.airavata.credential.store.datamodel.PasswordCredential getResult() throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getPasswordCredential();
+      }
+    }
+
+  }
+
+  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+    public Processor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+    }
+
+    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      processMap.put("getCSServiceVersion", new getCSServiceVersion());
+      processMap.put("addSSHCredential", new addSSHCredential());
+      processMap.put("addCertificateCredential", new addCertificateCredential());
+      processMap.put("addPasswordCredential", new addPasswordCredential());
+      processMap.put("getSSHCredential", new getSSHCredential());
+      processMap.put("getCertificateCredential", new getCertificateCredential());
+      processMap.put("getPasswordCredential", new getPasswordCredential());
+      return processMap;
+    }
+
+    public static class getCSServiceVersion<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getCSServiceVersion_args> {
+      public getCSServiceVersion() {
+        super("getCSServiceVersion");
+      }
+
+      public getCSServiceVersion_args getEmptyArgsInstance() {
+        return new getCSServiceVersion_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getCSServiceVersion_result getResult(I iface, getCSServiceVersion_args args) throws org.apache.thrift.TException {
+        getCSServiceVersion_result result = new getCSServiceVersion_result();
+        result.success = iface.getCSServiceVersion();
+        return result;
+      }
+    }
+
+    public static class addSSHCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addSSHCredential_args> {
+      public addSSHCredential() {
+        super("addSSHCredential");
+      }
+
+      public addSSHCredential_args getEmptyArgsInstance() {
+        return new addSSHCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public addSSHCredential_result getResult(I iface, addSSHCredential_args args) throws org.apache.thrift.TException {
+        addSSHCredential_result result = new addSSHCredential_result();
+        try {
+          result.success = iface.addSSHCredential(args.sshCredential);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class addCertificateCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addCertificateCredential_args> {
+      public addCertificateCredential() {
+        super("addCertificateCredential");
+      }
+
+      public addCertificateCredential_args getEmptyArgsInstance() {
+        return new addCertificateCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public addCertificateCredential_result getResult(I iface, addCertificateCredential_args args) throws org.apache.thrift.TException {
+        addCertificateCredential_result result = new addCertificateCredential_result();
+        try {
+          result.success = iface.addCertificateCredential(args.certificateCredential);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class addPasswordCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addPasswordCredential_args> {
+      public addPasswordCredential() {
+        super("addPasswordCredential");
+      }
+
+      public addPasswordCredential_args getEmptyArgsInstance() {
+        return new addPasswordCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public addPasswordCredential_result getResult(I iface, addPasswordCredential_args args) throws org.apache.thrift.TException {
+        addPasswordCredential_result result = new addPasswordCredential_result();
+        try {
+          result.success = iface.addPasswordCredential(args.passwordCredential);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class getSSHCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getSSHCredential_args> {
+      public getSSHCredential() {
+        super("getSSHCredential");
+      }
+
+      public getSSHCredential_args getEmptyArgsInstance() {
+        return new getSSHCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getSSHCredential_result getResult(I iface, getSSHCredential_args args) throws org.apache.thrift.TException {
+        getSSHCredential_result result = new getSSHCredential_result();
+        try {
+          result.success = iface.getSSHCredential(args.tokenId, args.gatewayId);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class getCertificateCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getCertificateCredential_args> {
+      public getCertificateCredential() {
+        super("getCertificateCredential");
+      }
+
+      public getCertificateCredential_args getEmptyArgsInstance() {
+        return new getCertificateCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getCertificateCredential_result getResult(I iface, getCertificateCredential_args args) throws org.apache.thrift.TException {
+        getCertificateCredential_result result = new getCertificateCredential_result();
+        try {
+          result.success = iface.getCertificateCredential(args.tokenId, args.gatewayId);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+    public static class getPasswordCredential<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getPasswordCredential_args> {
+      public getPasswordCredential() {
+        super("getPasswordCredential");
+      }
+
+      public getPasswordCredential_args getEmptyArgsInstance() {
+        return new getPasswordCredential_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getPasswordCredential_result getResult(I iface, getPasswordCredential_args args) throws org.apache.thrift.TException {
+        getPasswordCredential_result result = new getPasswordCredential_result();
+        try {
+          result.success = iface.getPasswordCredential(args.tokenId, args.gatewayId);
+        } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) {
+          result.csException = csException;
+        }
+        return result;
+      }
+    }
+
+  }
+
+  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
+    public AsyncProcessor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+    }
+
+    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      processMap.put("getCSServiceVersion", new getCSServiceVersion());
+      processMap.put("addSSHCredential", new addSSHCredential());
+      processMap.put("addCertificateCredential", new addCertificateCredential());
+      processMap.put("addPasswordCredential", new addPasswordCredential());
+      processMap.put("getSSHCredential", new getSSHCredential());
+      processMap.put("getCertificateCredential", new getCertificateCredential());
+      processMap.put("getPasswordCredential", new getPasswordCredential());
+      return processMap;
+    }
+
+    public static class getCSServiceVersion<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getCSServiceVersion_args, String> {
+      public getCSServiceVersion() {
+        super("getCSServiceVersion");
+      }
+
+      public getCSServiceVersion_args getEmptyArgsInstance() {
+        return new getCSServiceVersion_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            getCSServiceVersion_result result = new getCSServiceVersion_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getCSServiceVersion_result result = new getCSServiceVersion_result();
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getCSServiceVersion_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.getCSServiceVersion(resultHandler);
+      }
+    }
+
+    public static class addSSHCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addSSHCredential_args, String> {
+      public addSSHCredential() {
+        super("addSSHCredential");
+      }
+
+      public addSSHCredential_args getEmptyArgsInstance() {
+        return new addSSHCredential_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            addSSHCredential_result result = new addSSHCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            addSSHCredential_result result = new addSSHCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, addSSHCredential_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.addSSHCredential(args.sshCredential,resultHandler);
+      }
+    }
+
+    public static class addCertificateCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addCertificateCredential_args, String> {
+      public addCertificateCredential() {
+        super("addCertificateCredential");
+      }
+
+      public addCertificateCredential_args getEmptyArgsInstance() {
+        return new addCertificateCredential_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            addCertificateCredential_result result = new addCertificateCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            addCertificateCredential_result result = new addCertificateCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, addCertificateCredential_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.addCertificateCredential(args.certificateCredential,resultHandler);
+      }
+    }
+
+    public static class addPasswordCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addPasswordCredential_args, String> {
+      public addPasswordCredential() {
+        super("addPasswordCredential");
+      }
+
+      public addPasswordCredential_args getEmptyArgsInstance() {
+        return new addPasswordCredential_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            addPasswordCredential_result result = new addPasswordCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            addPasswordCredential_result result = new addPasswordCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, addPasswordCredential_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.addPasswordCredential(args.passwordCredential,resultHandler);
+      }
+    }
+
+    public static class getSSHCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getSSHCredential_args, org.apache.airavata.credential.store.datamodel.SSHCredential> {
+      public getSSHCredential() {
+        super("getSSHCredential");
+      }
+
+      public getSSHCredential_args getEmptyArgsInstance() {
+        return new getSSHCredential_args();
+      }
+
+      public AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential>() { 
+          public void onComplete(org.apache.airavata.credential.store.datamodel.SSHCredential o) {
+            getSSHCredential_result result = new getSSHCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getSSHCredential_result result = new getSSHCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getSSHCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential> resultHandler) throws TException {
+        iface.getSSHCredential(args.tokenId, args.gatewayId,resultHandler);
+      }
+    }
+
+    public static class getCertificateCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getCertificateCredential_args, org.apache.airavata.credential.store.datamodel.CertificateCredential> {
+      public getCertificateCredential() {
+        super("getCertificateCredential");
+      }
+
+      public getCertificateCredential_args getEmptyArgsInstance() {
+        return new getCertificateCredential_args();
+      }
+
+      public AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential>() { 
+          public void onComplete(org.apache.airavata.credential.store.datamodel.CertificateCredential o) {
+            getCertificateCredential_result result = new getCertificateCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getCertificateCredential_result result = new getCertificateCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getCertificateCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential> resultHandler) throws TException {
+        iface.getCertificateCredential(args.tokenId, args.gatewayId,resultHandler);
+      }
+    }
+
+    public static class getPasswordCredential<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getPasswordCredential_args, org.apache.airavata.credential.store.datamodel.PasswordCredential> {
+      public getPasswordCredential() {
+        super("getPasswordCredential");
+      }
+
+      public getPasswordCredential_args getEmptyArgsInstance() {
+        return new getPasswordCredential_args();
+      }
+
+      public AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential>() { 
+          public void onComplete(org.apache.airavata.credential.store.datamodel.PasswordCredential o) {
+            getPasswordCredential_result result = new getPasswordCredential_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getPasswordCredential_result result = new getPasswordCredential_result();
+            if (e instanceof org.apache.airavata.credential.store.exception.CredentialStoreException) {
+                        result.csException = (org.apache.airavata.credential.store.exception.CredentialStoreException) e;
+                        result.setCsExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getPasswordCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential> resultHandler) throws TException {
+        iface.getPasswordCredential(args.tokenId, args.gatewayId,resultHandler);
+      }
+    }
+
+  }
+
+  public static class getCSServiceVersion_args implements org.apache.thrift.TBase<getCSServiceVersion_args, getCSServiceVersion_args._Fields>, java.io.Serializable, Cloneable, Comparable<getCSServiceVersion_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getCSServiceVersion_args");
+
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new getCSServiceVersion_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getCSServiceVersion_argsTupleSchemeFactory());
+    }
+
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+;
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCSServiceVersion_args.class, metaDataMap);
+    }
+
+    public getCSServiceVersion_args() {
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getCSServiceVersion_args(getCSServiceVersion_args other) {
+    }
+
+    public getCSServiceVersion_args deepCopy() {
+      return new getCSServiceVersion_args(this);
+    }
+
+    @Override
+    public void clear() {
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getCSServiceVersion_args)
+        return this.equals((getCSServiceVersion_args)that);
+      return false;
+    }
+
+    public boolean equals(getCSServiceVersion_args that) {
+      if (that == null)
+        return false;
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(getCSServiceVersion_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getCSServiceVersion_args(");
+      boolean first = true;
+
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getCSServiceVersion_argsStandardSchemeFactory implements SchemeFactory {
+      public getCSServiceVersion_argsStandardScheme getScheme() {
+        return new getCSServiceVersion_argsStandardScheme();
+      }
+    }
+
+    private static class getCSServiceVersion_argsStandardScheme extends StandardScheme<getCSServiceVersion_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getCSServiceVersion_argsTupleSchemeFactory implements SchemeFactory {
+      public getCSServiceVersion_argsTupleScheme getScheme() {
+        return new getCSServiceVersion_argsTupleScheme();
+      }
+    }
+
+    private static class getCSServiceVersion_argsTupleScheme extends TupleScheme<getCSServiceVersion_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+      }
+    }
+
+  }
+
+  public static class getCSServiceVersion_result implements org.apache.thrift.TBase<getCSServiceVersion_result, getCSServiceVersion_result._Fields>, java.io.Serializable, Cloneable, Comparable<getCSServiceVersion_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getCSServiceVersion_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new getCSServiceVersion_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getCSServiceVersion_resultTupleSchemeFactory());
+    }
+
+    public String success; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCSServiceVersion_result.class, metaDataMap);
+    }
+
+    public getCSServiceVersion_result() {
+    }
+
+    public getCSServiceVersion_result(
+      String success)
+    {
+      this();
+      this.success = success;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getCSServiceVersion_result(getCSServiceVersion_result other) {
+      if (other.isSetSuccess()) {
+        this.success = other.success;
+      }
+    }
+
+    public getCSServiceVersion_result deepCopy() {
+      return new getCSServiceVersion_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+    }
+
+    public String getSuccess() {
+      return this.success;
+    }
+
+    public getCSServiceVersion_result setSuccess(String success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((String)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getCSServiceVersion_result)
+        return this.equals((getCSServiceVersion_result)that);
+      return false;
+    }
+
+    public boolean equals(getCSServiceVersion_result that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(getCSServiceVersion_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getCSServiceVersion_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getCSServiceVersion_resultStandardSchemeFactory implements SchemeFactory {
+      public getCSServiceVersion_resultStandardScheme getScheme() {
+        return new getCSServiceVersion_resultStandardScheme();
+      }
+    }
+
+    private static class getCSServiceVersion_resultStandardScheme extends StandardScheme<getCSServiceVersion_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.success = iprot.readString();
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          oprot.writeString(struct.success);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getCSServiceVersion_resultTupleSchemeFactory implements SchemeFactory {
+      public getCSServiceVersion_resultTupleScheme getScheme() {
+        return new getCSServiceVersion_resultTupleScheme();
+      }
+    }
+
+    private static class getCSServiceVersion_resultTupleScheme extends TupleScheme<getCSServiceVersion_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetSuccess()) {
+          oprot.writeString(struct.success);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getCSServiceVersion_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.success = iprot.readString();
+          struct.setSuccessIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class addSSHCredential_args implements org.apache.thrift.TBase<addSSHCredential_args, addSSHCredential_args._Fields>, java.io.Serializable, Cloneable, Comparable<addSSHCredential_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("addSSHCredential_args");
+
+    private static final org.apache.thrift.protocol.TField SSH_CREDENTIAL_FIELD_DESC = new org.apache.thrift.protocol.TField("sshCredential", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new addSSHCredential_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new addSSHCredential_argsTupleSchemeFactory());
+    }
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SSH_CREDENTIAL((short)1, "sshCredential");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // SSH_CREDENTIAL
+            return SSH_CREDENTIAL;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SSH_CREDENTIAL, new org.apache.thrift.meta_data.FieldMetaData("sshCredential", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.credential.store.datamodel.SSHCredential.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(addSSHCredential_args.class, metaDataMap);
+    }
+
+    public addSSHCredential_args() {
+    }
+
+    public addSSHCredential_args(
+      org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential)
+    {
+      this();
+      this.sshCredential = sshCredential;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public addSSHCredential_args(addSSHCredential_args other) {
+      if (other.isSetSshCredential()) {
+        this.sshCredential = new org.apache.airavata.credential.store.datamodel.SSHCredential(other.sshCredential);
+      }
+    }
+
+    public addSSHCredential_args deepCopy() {
+      return new addSSHCredential_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.sshCredential = null;
+    }
+
+    public org.apache.airavata.credential.store.datamodel.SSHCredential getSshCredential() {
+      return this.sshCredential;
+    }
+
+    public addSSHCredential_args setSshCredential(org.apache.airavata.credential.store.datamodel.SSHCredential sshCredential) {
+      this.sshCredential = sshCredential;
+      return this;
+    }
+
+    public void unsetSshCredential() {
+      this.sshCredential = null;
+    }
+
+    /** Returns true if field sshCredential is set (has been assigned a value) and false otherwise */
+    public boolean isSetSshCredential() {
+      return this.sshCredential != null;
+    }
+
+    public void setSshCredentialIsSet(boolean value) {
+      if (!value) {
+        this.sshCredential = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SSH_CREDENTIAL:
+        if (value == null) {
+          unsetSshCredential();
+        } else {
+          setSshCredential((org.apache.airavata.credential.store.datamodel.SSHCredential)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SSH_CREDENTIAL:
+        return getSshCredential();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SSH_CREDENTIAL:
+        return isSetSshCredential();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof addSSHCredential_args)
+        return this.equals((addSSHCredential_args)that);
+      return false;
+    }
+
+    public boolean equals(addSSHCredential_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_sshCredential = true && this.isSetSshCredential();
+      boolean that_present_sshCredential = true && that.isSetSshCredential();
+      if (this_present_sshCredential || that_present_sshCredential) {
+        if (!(this_present_sshCredential && that_present_sshCredential))
+          return false;
+        if (!this.sshCredential.equals(that.sshCredential))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(addSSHCredential_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSshCredential()).compareTo(other.isSetSshCredential());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSshCredential()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sshCredential, other.sshCredential);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("addSSHCredential_args(");
+      boolean first = true;
+
+      sb.append("sshCredential:");
+      if (this.sshCredential == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.sshCredential);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (sshCredential == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'sshCredential' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (sshCredential != null) {
+        sshCredential.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    priva

<TRUNCATED>

[10/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/pom.xml b/modules/credential-store-service/pom.xml
deleted file mode 100644
index efc075f..0000000
--- a/modules/credential-store-service/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
-    distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
-    the Apache License, Version 2.0 (theƏ "License"); you may not use this file except in compliance with the License. You may
-    obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
-    in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-    ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
-    the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <parent>
-        <groupId>org.apache.airavata</groupId>
-        <artifactId>airavata</artifactId>
-        <version>0.15-SNAPSHOT</version>
-        <relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>airavata-credential-store-service</artifactId>
-    <packaging>pom</packaging>
-    <name>Airavata Credential Store Service</name>
-    <url>http://airavata.apache.org/</url>
-
-    <profiles>
-        <profile>
-            <id>default</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <modules>
-                <module>credential-store</module>
-                <module>credential-store-webapp</module>
-            </modules>
-        </profile>
-    </profiles>
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-    </properties>
-</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/pom.xml b/modules/credential-store/credential-store-service/pom.xml
new file mode 100644
index 0000000..d8af25f
--- /dev/null
+++ b/modules/credential-store/credential-store-service/pom.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+	license agreements. See the NOTICE file distributed with this work for additional 
+	information regarding copyright ownership. The ASF licenses this file to 
+	you under the Apache License, Version 2.0 (theƏ "License"); you may not use 
+	this file except in compliance with the License. You may obtain a copy of 
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+	by applicable law or agreed to in writing, software distributed under the 
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+	OF ANY ~ KIND, either express or implied. See the License for the specific 
+	language governing permissions and limitations under the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<parent>
+		<groupId>org.apache.airavata</groupId>
+		<artifactId>airavata</artifactId>
+		<version>0.15-SNAPSHOT</version>
+		<relativePath>../../../pom.xml</relativePath>
+	</parent>
+
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>airavata-credential-store</artifactId>
+	<name>Airavata Credential Store</name>
+	<description>Module to manage credentials</description>
+
+	<dependencies>
+		<dependency>
+			<groupId>edu.uiuc.ncsa.myproxy</groupId>
+			<artifactId>oa4mp-client-api</artifactId>
+			<version>${oa4mp.version}</version>
+		</dependency>
+		<dependency>
+            <groupId>edu.uiuc.ncsa.myproxy</groupId>
+            <artifactId>oa4mp-client-loader-oauth1</artifactId>
+            <version>${oa4mp.version}</version>
+            <exclusions>
+        	<exclusion>
+          		<groupId>net.oauth.core</groupId> 
+          		<artifactId>oauth-httpclient4</artifactId>
+        	</exclusion>
+			<exclusion>
+				<groupId>net.oauth.core</groupId>
+				<artifactId>oauth-consumer</artifactId>
+			</exclusion>
+			<exclusion>
+				<groupId>mysql</groupId>
+				<artifactId>mysql-connector-java</artifactId>
+			</exclusion>
+			<exclusion>
+				<groupId>postgresql</groupId>
+				<artifactId>postgresql</artifactId>
+			</exclusion>
+            </exclusions>
+        </dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.7</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.derby</groupId>
+			<artifactId>derby</artifactId>
+			<version>${derby.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.derby</groupId>
+			<artifactId>derbyclient</artifactId>
+			<version>${derby.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.derby</groupId>
+			<artifactId>derbynet</artifactId>
+			<version>${derby.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.derby</groupId>
+			<artifactId>derbytools</artifactId>
+			<version>${derby.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>commons-dbcp</groupId>
+			<artifactId>commons-dbcp</artifactId>
+			<version>1.4</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.airavata</groupId>
+			<artifactId>airavata-common-utils</artifactId>
+			<version>${project.version}</version>
+		</dependency> 
+		<dependency>
+			<groupId>com.jcraft</groupId>
+			<artifactId>jsch</artifactId>
+			<version>0.1.50</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>2.5</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-email</artifactId>
+			<version>1.3.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-io</artifactId>
+			<version>1.3.2</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<version>${surefire.version}</version>
+				<inherited>true</inherited>
+				<configuration>
+					<systemPropertyVariables>
+						<credential.module.directory>${basedir}</credential.module.directory>
+					</systemPropertyVariables>
+					<excludes>
+						<exclude>**/DAOBaseTestCase.java</exclude>
+						<exclude>**/MappingDAOTest.java</exclude>
+					</excludes>
+					<testSourceDirectory>${basedir}\src\test\java\</testSourceDirectory>
+				</configuration>
+			</plugin>
+
+		</plugins>
+		<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
+		<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
+		<testResources>
+			<testResource>
+				<directory>${project.basedir}/src/test/resources</directory>
+			</testResource>
+		</testResources>
+	</build>
+</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/scripts/credential-store-h2.sql
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/scripts/credential-store-h2.sql b/modules/credential-store/credential-store-service/scripts/credential-store-h2.sql
new file mode 100644
index 0000000..91915b6
--- /dev/null
+++ b/modules/credential-store/credential-store-service/scripts/credential-store-h2.sql
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.
+ *
+ */
+CREATE TABLE COMMUNITY_USER
+(
+	GATEWAY_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);
+
+
+CREATE TABLE CREDENTIALS
+(
+	GATEWAY_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+	CREDENTIAL CLOB NOT NULL,
+	PRIVATE_KEY CLOB NOT NULL,
+	NOT_BEFORE VARCHAR(256) NOT NULL,
+	NOT_AFTER VARCHAR(256) NOT NULL,
+	LIFETIME MEDIUMINT NOT NULL,
+	REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,
+	REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/scripts/credential-store-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/scripts/credential-store-mysql.sql b/modules/credential-store/credential-store-service/scripts/credential-store-mysql.sql
new file mode 100644
index 0000000..50d5e0f
--- /dev/null
+++ b/modules/credential-store/credential-store-service/scripts/credential-store-mysql.sql
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.
+ *
+ */
+CREATE TABLE COMMUNITY_USER
+(
+	GATEWAY_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);
+
+
+CREATE TABLE CREDENTIALS
+(
+	GATEWAY_NAME VARCHAR(256) NOT NULL,
+	COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+	CREDENTIAL TEXT NOT NULL,
+	PRIVATE_KEY TEXT NOT NULL,
+	NOT_BEFORE VARCHAR(256) NOT NULL,
+	NOT_AFTER VARCHAR(256) NOT NULL,
+	LIFETIME MEDIUMINT NOT NULL,
+	REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,
+	REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+    PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java
new file mode 100644
index 0000000..12105e2
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java
@@ -0,0 +1,140 @@
+/*
+ *
+ * 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.client;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.credential.store.cpi.CredentialStoreService;
+import org.apache.airavata.credential.store.datamodel.CertificateCredential;
+import org.apache.airavata.credential.store.datamodel.CommunityUser;
+import org.apache.airavata.credential.store.datamodel.SSHCredential;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TSSLTransportFactory;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import org.apache.commons.codec.binary.Base64;
+
+public class TestSSLClient {
+    private void invoke() {
+        TTransport transport;
+        try {
+            AiravataUtils.setExecutionAsServer();
+            TSSLTransportFactory.TSSLTransportParameters params =
+                    new TSSLTransportFactory.TSSLTransportParameters();
+            String keystorePath = ServerSettings.getCredentialStoreThriftServerKeyStorePath();
+            String keystorePWD = ServerSettings.getCredentialStoreThriftServerKeyStorePassword();
+            params.setTrustStore(keystorePath, keystorePWD);
+            final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_PORT, "8960"));
+            final String serverHost = ServerSettings.getSetting(Constants.CREDNETIAL_SERVER_HOST, null);
+
+            transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params);
+            TProtocol protocol = new TBinaryProtocol(transport);
+
+            CredentialStoreService.Client client = new CredentialStoreService.Client(protocol);
+//            testSSHCredential(client);
+            testCertificateCredential(client);
+            transport.close();
+        } catch (TTransportException e) {
+            e.printStackTrace();
+        }catch (ApplicationSettingsException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void testSSHCredential (CredentialStoreService.Client client){
+        try {
+            SSHCredential sshCredential = new SSHCredential();
+            sshCredential.setUsername("test");
+            sshCredential.setGatewayId("testGateway");
+            sshCredential.setPassphrase("mypassphrase");
+            String token = client.addSSHCredential(sshCredential);
+            System.out.println("SSH Token :" + token);
+            SSHCredential credential = client.getSSHCredential(token, "testGateway");
+            System.out.println("private key : " + credential.getPrivateKey());
+            System.out.println("public key : " + credential.getPublicKey());
+        }catch (TTransportException e) {
+            e.printStackTrace();
+        } catch (TException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void testCertificateCredential (CredentialStoreService.Client client){
+        try {
+            CertificateCredential certificateCredential = new CertificateCredential();
+            CommunityUser communityUser = new CommunityUser("testGateway", "test", "test@ddsd");
+            certificateCredential.setCommunityUser(communityUser);
+            X509Certificate[] x509Certificates = new X509Certificate[1];
+            KeyStore ks = KeyStore.getInstance("JKS");
+            File keyStoreFile = new File("/Users/chathuri/dev/airavata/credential-store/oa4mp/airavata.jks");
+            FileInputStream fis = new FileInputStream(keyStoreFile);
+            char[] password = "airavata".toCharArray();
+            ks.load(fis,password);
+            x509Certificates[0] = (X509Certificate) ks.getCertificate("airavata");
+            Base64 encoder = new Base64(64);
+            String cert_begin = "-----BEGIN CERTIFICATE-----\n";
+            String end_cert = "-----END CERTIFICATE-----";
+            byte[] derCert = x509Certificates[0].getEncoded();
+            String pemCertPre = new String(encoder.encode(derCert));
+            String pemCert = cert_begin + pemCertPre + end_cert;
+            certificateCredential.setX509Cert(pemCert);
+            String token = client.addCertificateCredential(certificateCredential);
+            System.out.println("Certificate Token :" + token);
+            CertificateCredential credential = client.getCertificateCredential(token, "testGateway");
+            System.out.println("certificate : " + credential.getX509Cert());
+            System.out.println("gateway name  : " + credential.getCommunityUser().getGatewayNmae());
+        }catch (TTransportException e) {
+            e.printStackTrace();
+        } catch (TException e) {
+            e.printStackTrace();
+        } catch (KeyStoreException e) {
+            e.printStackTrace();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        } catch (CertificateException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) {
+        TestSSLClient c = new TestSSLClient();
+        c.invoke();
+
+    }
+}


[11/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
deleted file mode 100644
index b9dc2ef..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- *
- * 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;
-import org.apache.airavata.common.utils.KeyStorePasswordCallback;
-import org.apache.airavata.common.utils.SecurityUtil;
-import org.apache.airavata.credential.store.credential.Credential;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-
-import java.io.*;
-import java.security.GeneralSecurityException;
-import java.sql.*;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Data access class for credential store.
- */
-public class CredentialsDAO extends ParentDAO {
-
-    private String keyStorePath = null;
-    private String secretKeyAlias = null;
-    private KeyStorePasswordCallback keyStorePasswordCallback = null;
-
-    public CredentialsDAO() {
-    }
-
-    public CredentialsDAO(String keyStore, String alias, KeyStorePasswordCallback passwordCallback) {
-        this.keyStorePath = keyStore;
-        this.secretKeyAlias = alias;
-        this.keyStorePasswordCallback = passwordCallback;
-    }
-
-    public String getKeyStorePath() {
-        return keyStorePath;
-    }
-
-    public void setKeyStorePath(String keyStorePath) {
-        this.keyStorePath = keyStorePath;
-    }
-
-    public String getSecretKeyAlias() {
-        return secretKeyAlias;
-    }
-
-    public void setSecretKeyAlias(String secretKeyAlias) {
-        this.secretKeyAlias = secretKeyAlias;
-    }
-
-    public KeyStorePasswordCallback getKeyStorePasswordCallback() {
-        return keyStorePasswordCallback;
-    }
-
-    public void setKeyStorePasswordCallback(KeyStorePasswordCallback keyStorePasswordCallback) {
-        this.keyStorePasswordCallback = keyStorePasswordCallback;
-    }
-
-    /**
-     * 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 {
-
-        String sql = "INSERT INTO CREDENTIALS VALUES (?, ?, ?, ?, ?)";
-
-        PreparedStatement preparedStatement = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, gatewayId);
-            preparedStatement.setString(2, credential.getToken());
-
-            InputStream isCert = new ByteArrayInputStream(convertObjectToByteArray(credential));
-            preparedStatement.setBinaryStream(3, isCert);
-
-            preparedStatement.setString(4, credential.getPortalUserName());
-
-            java.util.Date date = new java.util.Date();
-            Timestamp timestamp = new Timestamp(date.getTime());
-
-            preparedStatement.setTimestamp(5, timestamp);
-
-            preparedStatement.executeUpdate();
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error persisting credentials.");
-            stringBuilder.append(" gateway - ").append(gatewayId);
-            stringBuilder.append(" token id - ").append(credential.getToken());
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-
-            DBUtil.cleanup(preparedStatement);
-        }
-    }
-
-    public void deleteCredentials(String gatewayName, String tokenId, Connection connection)
-            throws CredentialStoreException {
-
-        String sql = "DELETE FROM CREDENTIALS WHERE GATEWAY_ID=? AND TOKEN_ID=?";
-
-        PreparedStatement preparedStatement = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, gatewayName);
-            preparedStatement.setString(2, tokenId);
-
-            preparedStatement.executeUpdate();
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error deleting credentials for .");
-            stringBuilder.append("gateway - ").append(gatewayName);
-            stringBuilder.append("token id - ").append(tokenId);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-            DBUtil.cleanup(preparedStatement);
-        }
-    }
-
-    /**
-     * 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 = ?, PORTAL_USER_ID = ?, TIME_PERSISTED = ? where GATEWAY_ID = ? and TOKEN_ID = ?";
-
-        PreparedStatement preparedStatement = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            InputStream isCert = new ByteArrayInputStream(convertObjectToByteArray(credential));
-            preparedStatement.setBinaryStream(1, isCert);
-
-            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();
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error updating credentials.");
-            stringBuilder.append(" gateway - ").append(gatewayId);
-            stringBuilder.append(" token id - ").append(credential.getToken());
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-
-            DBUtil.cleanup(preparedStatement);
-        }
-
-    }
-
-    /**
-     * 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_ID=? AND TOKEN_ID=?";
-
-        PreparedStatement preparedStatement = null;
-        ResultSet resultSet = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, gatewayName);
-            preparedStatement.setString(2, tokenId);
-
-            resultSet = preparedStatement.executeQuery();
-
-            if (resultSet.next()) {
-                // CertificateCredential certificateCredential = new CertificateCredential();
-
-                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
-                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());
-
-                Credential certificateCredential = (Credential) convertByteArrayToObject(certificate);
-
-                certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
-                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
-
-                return certificateCredential;
-            }
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for user.");
-            stringBuilder.append("gateway - ").append(gatewayName);
-            stringBuilder.append("token id - ").append(tokenId);
-
-            log.debug(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-            DBUtil.cleanup(preparedStatement, resultSet);
-        }
-
-        return null;
-    }
-    /**
-     * 
-     */
-    public String getGatewayID(String tokenId, Connection connection)
-            throws CredentialStoreException {
-
-        String sql = "SELECT GATEWAY_ID FROM CREDENTIALS WHERE TOKEN_ID=?";
-
-        PreparedStatement preparedStatement = null;
-        ResultSet resultSet = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, tokenId);
-         
-            resultSet = preparedStatement.executeQuery();
-
-            if (resultSet.next()) {
-            	return resultSet.getString("GATEWAY_ID");
-              }
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for user.");
-            stringBuilder.append("token id - ").append(tokenId);
-
-            log.debug(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-            DBUtil.cleanup(preparedStatement, resultSet);
-        }
-
-        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"
-     * + ")";
-     */
-    public List<Credential> getCredentials(String gatewayName, Connection connection) throws CredentialStoreException {
-
-        List<Credential> credentialList = new ArrayList<Credential>();
-
-        String sql = "SELECT * FROM CREDENTIALS WHERE GATEWAY_ID=?";
-
-        PreparedStatement preparedStatement = null;
-        ResultSet resultSet = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, gatewayName);
-
-            resultSet = preparedStatement.executeQuery();
-
-            Credential certificateCredential;
-
-            while (resultSet.next()) {
-
-                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
-                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());
-
-                certificateCredential = (Credential) convertByteArrayToObject(certificate);
-
-                certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
-                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
-
-                credentialList.add(certificateCredential);
-            }
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error retrieving credential list for ");
-            stringBuilder.append("gateway - ").append(gatewayName);
-
-            log.debug(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-            DBUtil.cleanup(preparedStatement, resultSet);
-        }
-
-        return credentialList;
-    }
-
-    /**
-     * Gets all credentials.
-     * @param connection The database connection
-     * @return All credentials as a list
-     * @throws CredentialStoreException If an error occurred while rerieving credentials.
-     */
-    public List<Credential> getCredentials(Connection connection) throws CredentialStoreException {
-
-        List<Credential> credentialList = new ArrayList<Credential>();
-
-        String sql = "SELECT * FROM CREDENTIALS";
-
-        PreparedStatement preparedStatement = null;
-        ResultSet resultSet = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            resultSet = preparedStatement.executeQuery();
-
-            Credential certificateCredential;
-
-            while (resultSet.next()) {
-
-                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
-                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());
-
-                certificateCredential = (Credential) convertByteArrayToObject(certificate);
-
-                certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
-                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
-
-                credentialList.add(certificateCredential);
-            }
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error retrieving all credentials");
-
-            log.debug(stringBuilder.toString(), e);
-
-            throw new CredentialStoreException(stringBuilder.toString(), e);
-        } finally {
-            DBUtil.cleanup(preparedStatement, resultSet);
-        }
-
-        return credentialList;
-    }
-
-    public Object convertByteArrayToObject(byte[] data) throws CredentialStoreException {
-        ObjectInputStream objectInputStream = null;
-        Object o = null;
-        try {
-            try {
-                //decrypt the data first
-                if (encrypt()) {
-                    data = SecurityUtil.decrypt(this.keyStorePath, this.secretKeyAlias, this.keyStorePasswordCallback, data);
-                }
-
-                objectInputStream = new ObjectInputStream(new ByteArrayInputStream(data));
-                o = objectInputStream.readObject();
-
-            } catch (IOException e) {
-                throw new CredentialStoreException("Error de-serializing object.", e);
-            } catch (ClassNotFoundException e) {
-                throw new CredentialStoreException("Error de-serializing object.", e);
-            } catch (GeneralSecurityException e) {
-                throw new CredentialStoreException("Error decrypting data.", e);
-            }
-        } finally {
-            if (objectInputStream != null) {
-                try {
-                    objectInputStream.close();
-                } catch (IOException e) {
-                    log.error("Error occurred while closing the stream", e);
-                }
-            }
-        }
-        return o;
-    }
-
-    public byte[] convertObjectToByteArray(Serializable o) throws CredentialStoreException {
-        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-
-        ObjectOutputStream objectOutputStream = null;
-        try {
-            objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
-            objectOutputStream.writeObject(o);
-            objectOutputStream.flush();
-        } catch (IOException e) {
-            throw new CredentialStoreException("Error serializing object.", e);
-        } finally {
-            if (objectOutputStream != null) {
-                try {
-                    objectOutputStream.close();
-                } catch (IOException e) {
-                    log.error("Error occurred while closing object output stream", e);
-                }
-            }
-        }
-
-        // encrypt the byte array
-        if (encrypt()) {
-            byte[] array = byteArrayOutputStream.toByteArray();
-            try {
-                return SecurityUtil.encrypt(this.keyStorePath, this.secretKeyAlias, this.keyStorePasswordCallback, array);
-            } catch (GeneralSecurityException e) {
-                throw new CredentialStoreException("Error encrypting data", e);
-            } catch (IOException e) {
-                throw new CredentialStoreException("Error encrypting data. IO exception.", e);
-            }
-        } else {
-            return byteArrayOutputStream.toByteArray();
-        }
-    }
-
-    /**
-     * Says whether to encrypt data or not. if alias, keystore is set
-     * we treat encryption true.
-     * @return true if data should encrypt else false.
-     */
-    private boolean encrypt() {
-        return this.keyStorePath != null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java
deleted file mode 100644
index 8ef0d69..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/store/impl/db/ParentDAO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * 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;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Super class to abstract out Data access classes.
- */
-public class ParentDAO {
-    protected static Logger log = LoggerFactory.getLogger(ParentDAO.class);
-
-    public ParentDAO() {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/ConfigurationReader.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/ConfigurationReader.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/ConfigurationReader.java
deleted file mode 100644
index e44d4d8..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/ConfigurationReader.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * 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.util;
-
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 8/25/13
- * Time: 6:40 AM
- */
-
-/**
- * Reads credential store specific configurations from the client.xml file.
- */
-public class ConfigurationReader {
-
-    private String successUrl;
-
-    private String errorUrl;
-
-    private String portalRedirectUrl;
-
-    public String getPortalRedirectUrl() {
-        return portalRedirectUrl;
-    }
-
-    public void setPortalRedirectUrl(String portalRedirectUrl) {
-        this.portalRedirectUrl = portalRedirectUrl;
-    }
-
-    public ConfigurationReader() throws CredentialStoreException {
-
-        try {
-            loadConfigurations();
-        } catch (Exception e) {
-            throw new CredentialStoreException("Unable to read credential store specific configurations." , e);
-        }
-
-
-    }
-
-    private void loadConfigurations() throws ParserConfigurationException,
-            IOException, SAXException {
-        InputStream inputStream
-                = this.getClass().getClassLoader().getResourceAsStream("credential-store/client.xml");
-
-        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-        Document doc = dBuilder.parse(inputStream);
-
-        doc.getDocumentElement().normalize();
-
-        NodeList nodeList = doc.getElementsByTagName("credential-store");
-
-        readElementValue(nodeList);
-
-    }
-
-    private void readElementValue(NodeList nodeList) {
-        for (int temp = 0; temp < nodeList.getLength(); temp++) {
-
-            Node nNode = nodeList.item(temp);
-
-            if (nNode.getNodeType() == Node.ELEMENT_NODE) {
-
-                Element eElement = (Element) nNode;
-
-                this.successUrl = eElement.getElementsByTagName("successUri").item(0).getTextContent();
-                this.errorUrl =  eElement.getElementsByTagName("errorUri").item(0).getTextContent();
-                this.portalRedirectUrl = eElement.getElementsByTagName("redirectUri").item(0).getTextContent();
-            }
-        }
-    }
-
-    public String getSuccessUrl() {
-        return successUrl;
-    }
-
-    public void setSuccessUrl(String successUrl) {
-        this.successUrl = successUrl;
-    }
-
-    public String getErrorUrl() {
-        return errorUrl;
-    }
-
-    public void setErrorUrl(String errorUrl) {
-        this.errorUrl = errorUrl;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/CredentialStoreConstants.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/CredentialStoreConstants.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/CredentialStoreConstants.java
deleted file mode 100644
index de3c59c..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/CredentialStoreConstants.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * 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.util;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 8/25/13
- * Time: 4:34 PM
- */
-
-public class CredentialStoreConstants {
-
-    public static final String GATEWAY_NAME_QUERY_PARAMETER = "gatewayName";
-    public static final String PORTAL_USER_QUERY_PARAMETER = "portalUserName";
-    public static final String PORTAL_USER_EMAIL_QUERY_PARAMETER = "email";
-    public static final String PORTAL_TOKEN_ID_ASSIGNED = "associatedToken";
-    public static final String DURATION_QUERY_PARAMETER = "duration";
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/PrivateKeyStore.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/PrivateKeyStore.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/PrivateKeyStore.java
deleted file mode 100644
index cd6db7e..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/PrivateKeyStore.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- * 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.util;
-
-import java.security.PrivateKey;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 9/5/13
- * Time: 6:47 PM
- */
-
-public class PrivateKeyStore {
-
-    private Map<String, PrivateKey> privateKeyMap;
-
-    private static PrivateKeyStore privateKeyStore = null;
-
-    private PrivateKeyStore() {
-        privateKeyMap = new HashMap<String, PrivateKey>();
-    }
-
-    public static PrivateKeyStore getPrivateKeyStore() {
-
-        if (privateKeyStore == null) {
-            privateKeyStore = new PrivateKeyStore();
-        }
-
-        return privateKeyStore;
-    }
-
-    public synchronized void addKey(String tokenId, PrivateKey privateKey) {
-
-        privateKeyMap.put(tokenId, privateKey);
-    }
-
-    public synchronized PrivateKey getKey(String tokenId) {
-
-        PrivateKey privateKey = privateKeyMap.get(tokenId);
-
-        if (privateKey != null) {
-            privateKeyMap.remove(tokenId);
-        }
-
-        return privateKey;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/TokenGenerator.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/TokenGenerator.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/TokenGenerator.java
deleted file mode 100644
index 1c36f8d..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/TokenGenerator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * 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.util;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 5/21/13
- * Time: 3:07 PM
- */
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.Timestamp;
-import java.util.UUID;
-
-/**
- * Generates tokens for users.
- */
-public class TokenGenerator {
-
-    protected static Logger log = LoggerFactory.getLogger(TokenGenerator.class);
-
-
-    public TokenGenerator() {
-
-    }
-
-    public static String generateToken(String gatewayId, String metadata) {
-
-        return UUID.randomUUID().toString();
-    }
-
-    public String encryptToken(String token) {
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java
deleted file mode 100644
index 0ea7bc1..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *
- * 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.util;
-
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.KeyPair;
-import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
-import org.apache.commons.io.FileUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.security.KeyStore;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Contains some utility methods.
- */
-public class Utility {
-
-    protected static Logger log = LoggerFactory.getLogger(Utility.class);
-
-    private static final String DATE_FORMAT = "MM/dd/yyyy HH:mm:ss";
-
-    public static String convertDateToString(Date date) {
-
-        DateFormat df = new SimpleDateFormat(DATE_FORMAT);
-        return df.format(date);
-    }
-
-    public static Date convertStringToDate(String date) throws ParseException {
-
-        DateFormat df = new SimpleDateFormat(DATE_FORMAT);
-        return df.parse(date);
-    }
-
-    public static String encrypt(String stringToEncrypt) {
-        return null;
-
-    }
-
-    public static KeyStore loadKeyStore(String keyStoreFile) throws Exception {
-        KeyStore ks = KeyStore.getInstance("JKS");
-        // get user password and file input stream
-        char[] password = getPassword();
-
-        java.io.FileInputStream fis = null;
-        try {
-            fis = new FileInputStream(keyStoreFile);
-            ks.load(fis, password);
-
-            return ks;
-        } finally {
-            if (fis != null) {
-                fis.close();
-            }
-        }
-    }
-
-    public static char[] getPassword() {
-        return new char[0];
-    }
-
-    public static org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential generateKeyPair(SSHCredential credential) throws Exception{
-        JSch jsch=new JSch();
-        try{
-            KeyPair kpair=KeyPair.genKeyPair(jsch, KeyPair.RSA);
-            File file = File.createTempFile("id_rsa", "");
-            String fileName = file.getAbsolutePath();
-
-            kpair.writePrivateKey(fileName,credential.getPassphrase().getBytes());
-            kpair.writePublicKey(fileName + ".pub"  , "");
-            kpair.dispose();
-            byte[] priKey = FileUtils.readFileToByteArray(new File(fileName));
-
-            byte[] pubKey = FileUtils.readFileToByteArray(new File(fileName + ".pub"));
-            credential.setPrivateKey(priKey);
-            credential.setPublicKey(pubKey);
-            return credential;
-        }
-        catch(Exception e){
-            log.error("Error while creating key pair", e);
-            throw new Exception("Error while creating key pair", e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierTest.java b/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierTest.java
deleted file mode 100644
index 05d7a10..0000000
--- a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/notifier/impl/EmailNotifierTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * 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.notifier.impl;
-
-import junit.framework.TestCase;
-import org.apache.airavata.credential.store.notifier.NotificationMessage;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 12/27/13
- * Time: 1:54 PM
- */
-
-public class EmailNotifierTest extends TestCase {
-    public void setUp() throws Exception {
-        super.setUp();
-
-    }
-
-    // Test is disabled. Need to fill in parameters to send mails
-    public void xtestNotifyMessage() throws Exception {
-
-        EmailNotifierConfiguration emailNotifierConfiguration = new EmailNotifierConfiguration("smtp.googlemail.com",
-                465, "yyy", "xxx", true, "yyy@gmail.com");
-
-        EmailNotifier notifier = new EmailNotifier(emailNotifierConfiguration);
-        EmailNotificationMessage emailNotificationMessage = new EmailNotificationMessage("Test",
-                "ggg@gmail.com", "Testing credential store");
-        notifier.notifyMessage(emailNotificationMessage);
-
-    }
-
-    // Just to ignore test failures.
-    public void testIgnore() {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java b/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
deleted file mode 100644
index 8ed8a6a..0000000
--- a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- *
- * 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;
-import org.apache.airavata.common.utils.DatabaseTestCases;
-import org.apache.airavata.common.utils.DerbyUtil;
-import org.apache.airavata.credential.store.credential.CommunityUser;
-import org.junit.*;
-
-import java.sql.Connection;
-import java.util.List;
-
-/**
- * Test for community user DAO.
- */
-public class CommunityUserDAOTest extends DatabaseTestCases {
-
-    private CommunityUserDAO communityUserDAO;
-
-    @BeforeClass
-    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 dropTable = "drop table COMMUNITY_USER";
-
-        try {
-            executeSQL(dropTable);
-        } catch (Exception e) {
-        }
-
-        executeSQL(createTable);
-
-    }
-
-    @AfterClass
-    public static void shutDownDatabase() throws Exception {
-        DerbyUtil.stopDerbyServer();
-    }
-
-    @Before
-    public void setUp() throws Exception {
-
-        communityUserDAO = new CommunityUserDAO();
-
-        Connection connection = getDbUtil().getConnection();
-
-        try {
-            DBUtil.truncate("community_user", connection);
-        } finally {
-            connection.close();
-        }
-
-    }
-
-    @Test
-    public void testAddCommunityUser() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-
-            CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-            communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
-
-            communityUser = new CommunityUser("gw1", "ogce2", "ogce@sciencegateway.org");
-            communityUserDAO.addCommunityUser(communityUser, "Token2", connection);
-
-            CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            Assert.assertNotNull(user);
-            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-            user = communityUserDAO.getCommunityUser("gw1", "ogce2", connection);
-            Assert.assertNotNull(user);
-            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-            user = communityUserDAO.getCommunityUserByToken("gw1", "Token1", connection);
-            Assert.assertNotNull(user);
-            Assert.assertEquals("ogce", user.getUserName());
-            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-            user = communityUserDAO.getCommunityUserByToken("gw1", "Token2", connection);
-            Assert.assertNotNull(user);
-            Assert.assertEquals("ogce2", user.getUserName());
-            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-        } finally {
-            connection.close();
-        }
-
-    }
-
-    @Test
-    public void testDeleteCommunityUser() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-            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");
-            communityUserDAO.deleteCommunityUser(communityUser, connection);
-
-            user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            Assert.assertNull(user);
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testDeleteCommunityUserByToken() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-            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");
-            communityUserDAO.deleteCommunityUserByToken(communityUser, "Token1", connection);
-
-            user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            Assert.assertNull(user);
-
-        } finally {
-            connection.close();
-        }
-
-    }
-
-    @Test
-    public void testGetCommunityUsers() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-            CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-            communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
-
-            CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            Assert.assertNotNull(user);
-            Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-        } finally {
-            connection.close();
-        }
-
-    }
-
-    @Test
-    public void testGetCommunityUsersForGateway() throws Exception {
-
-        Connection connection = getConnection();
-
-        CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-        communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
-
-        communityUser = new CommunityUser("gw1", "ogce2", "ogce@sciencegateway.org");
-        communityUserDAO.addCommunityUser(communityUser, "Token2", connection);
-
-        List<CommunityUser> users = communityUserDAO.getCommunityUsers("gw1", connection);
-        Assert.assertNotNull(users);
-        Assert.assertEquals(2, users.size());
-
-        Assert.assertEquals(users.get(0).getUserName(), "ogce");
-        Assert.assertEquals(users.get(1).getUserName(), "ogce2");
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java b/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
deleted file mode 100644
index c175454..0000000
--- a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- *
- * 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;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.DatabaseTestCases;
-import org.apache.airavata.common.utils.DerbyUtil;
-import org.apache.airavata.common.utils.KeyStorePasswordCallback;
-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.CredentialStoreException;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.net.URL;
-import java.security.*;
-import java.security.cert.X509Certificate;
-import java.sql.Connection;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Test class for credential class
- */
-public class CredentialsDAOTest extends DatabaseTestCases {
-
-    private static final Logger logger = LoggerFactory.getLogger(CredentialsDAOTest.class);
-
-    private CredentialsDAO credentialsDAO;
-
-    private X509Certificate[] x509Certificates;
-    private PrivateKey privateKey;
-
-    @BeforeClass
-    public static void setUpDatabase() throws Exception {
-        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
-
-        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 dropTable = "drop table CREDENTIALS";
-
-        try {
-            executeSQL(dropTable);
-        } catch (Exception e) {
-        }
-
-        executeSQL(createTable);
-
-    }
-
-    @AfterClass
-    public static void shutDownDatabase() throws Exception {
-        DerbyUtil.stopDerbyServer();
-    }
-
-    @Before
-    public void setUp() throws Exception {
-
-        credentialsDAO = new CredentialsDAO();
-
-        x509Certificates = new X509Certificate[1];
-
-        // Cleanup tables;
-        Connection connection = getConnection();
-
-        try {
-            DBUtil.truncate("credentials", connection);
-        } finally {
-            connection.close();
-        }
-
-        initializeKeys();
-    }
-
-    private void initializeKeys() throws Exception {
-        KeyStore ks = KeyStore.getInstance("JKS");
-        char[] password = "password".toCharArray();
-
-        String baseDirectory = System.getProperty("credential.module.directory");
-
-        String keyStorePath = "src" + File.separator + "test" + File.separator + "resources" + File.separator
-                + "keystore.jks";
-
-        if (baseDirectory != null) {
-            keyStorePath = baseDirectory + File.separator + keyStorePath;
-        } else {
-            keyStorePath = "modules" + File.separator + "credential-store" + File.separator + keyStorePath;
-        }
-
-        File keyStoreFile = new File(keyStorePath);
-        if (!keyStoreFile.exists()) {
-            logger.error("Unable to read keystore file " + keyStoreFile);
-            throw new RuntimeException("Unable to read keystore file " + keyStoreFile);
-
-        }
-
-        java.io.FileInputStream fis = null;
-        try {
-            fis = new java.io.FileInputStream(keyStorePath);
-            ks.load(fis, password);
-        } finally {
-            if (fis != null) {
-                fis.close();
-            }
-        }
-
-        fis.close();
-
-        privateKey = (PrivateKey) ks.getKey("selfsigned", password);
-        x509Certificates[0] = (X509Certificate) ks.getCertificate("selfsigned");
-
-    }
-
-    @Test
-    public void testKeyReading() throws Exception {
-        initializeKeys();
-        System.out.println(privateKey.getAlgorithm());
-        System.out.println(x509Certificates[0].getIssuerDN());
-
-        Assert.assertNotNull(privateKey);
-        Assert.assertNotNull(x509Certificates);
-    }
-
-    private CommunityUser getCommunityUser(String gateway, String name) {
-        return new CommunityUser(gateway, name, "amila@sciencegateway.org");
-    }
-
-    private void addTestCredentials() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-            CertificateCredential certificateCredential = getTestCredentialObject();
-            credentialsDAO.addCredentials(certificateCredential.getCommunityUser().getGatewayName(),
-                    certificateCredential, connection);
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    public CertificateCredential getTestCredentialObject() {
-
-        CertificateCredential certificateCredential = new CertificateCredential();
-        certificateCredential.setToken("tom");
-        certificateCredential.setCertificates(x509Certificates);
-        certificateCredential.setPrivateKey(privateKey);
-        certificateCredential.setCommunityUser(getCommunityUser("gw1", "tom"));
-        certificateCredential.setLifeTime(1000);
-        certificateCredential.setPortalUserName("jerry");
-        certificateCredential.setNotBefore("13 OCT 2012 5:34:23");
-        certificateCredential.setNotAfter("14 OCT 2012 5:34:23");
-
-        return certificateCredential;
-
-    }
-
-    @Test
-    public void testSerialization() throws CredentialStoreException {
-
-        CertificateCredential certificateCredential = getTestCredentialObject();
-
-        CredentialsDAO credentialsDAO1 = new CredentialsDAO();
-
-        byte[] array = credentialsDAO1.convertObjectToByteArray(certificateCredential);
-        CertificateCredential readCertificateCredential = (CertificateCredential) credentialsDAO1
-                .convertByteArrayToObject(array);
-
-        checkEquality(certificateCredential.getCertificates(), readCertificateCredential.getCertificates());
-        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());
-        Assert.assertEquals(certificateCredential.getPortalUserName(), readCertificateCredential.getPortalUserName());
-
-        PrivateKey newKey = readCertificateCredential.getPrivateKey();
-
-        Assert.assertNotNull(newKey);
-        Assert.assertEquals(privateKey.getClass(), newKey.getClass());
-
-        Assert.assertEquals(privateKey.getFormat(), newKey.getFormat());
-        Assert.assertEquals(privateKey.getAlgorithm(), newKey.getAlgorithm());
-        Assert.assertTrue(Arrays.equals(privateKey.getEncoded(), newKey.getEncoded()));
-    }
-
-    @Test
-    public void testSerializationWithEncryption() throws CredentialStoreException {
-
-        URL url = this.getClass().getClassLoader().getResource("mykeystore.jks");
-        String secretKeyAlias = "mykey";
-
-        assert url != null;
-
-        CertificateCredential certificateCredential = getTestCredentialObject();
-
-        CredentialsDAO credentialsDAO1 = new CredentialsDAO(url.getPath(), secretKeyAlias,
-                new TestACSKeyStoreCallback());
-
-        byte[] array = credentialsDAO1.convertObjectToByteArray(certificateCredential);
-        CertificateCredential readCertificateCredential = (CertificateCredential) credentialsDAO1
-                .convertByteArrayToObject(array);
-
-        checkEquality(certificateCredential.getCertificates(), readCertificateCredential.getCertificates());
-        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());
-        Assert.assertEquals(certificateCredential.getPortalUserName(), readCertificateCredential.getPortalUserName());
-
-        PrivateKey newKey = readCertificateCredential.getPrivateKey();
-
-        Assert.assertNotNull(newKey);
-        Assert.assertEquals(privateKey.getClass(), newKey.getClass());
-
-        Assert.assertEquals(privateKey.getFormat(), newKey.getFormat());
-        Assert.assertEquals(privateKey.getAlgorithm(), newKey.getAlgorithm());
-        Assert.assertTrue(Arrays.equals(privateKey.getEncoded(), newKey.getEncoded()));
-    }
-
-    private class TestACSKeyStoreCallback implements KeyStorePasswordCallback {
-
-        @Override
-        public char[] getStorePassword() {
-            return "airavata".toCharArray();
-        }
-
-        @Override
-        public char[] getSecretKeyPassPhrase(String keyAlias) {
-            if (keyAlias.equals("mykey")) {
-                return "airavatasecretkey".toCharArray();
-            }
-
-            return null;
-        }
-    }
-
-    private void checkEquality(X509Certificate[] certificates1, X509Certificate[] certificates2) {
-
-        int i = 0;
-
-        for (X509Certificate certificate : certificates1) {
-            Assert.assertEquals(certificate, certificates2[i]);
-        }
-
-        Assert.assertEquals(certificates1.length, certificates2.length);
-
-    }
-
-    @Test
-    public void testAddCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-            CertificateCredential certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1",
-                    "tom", connection);
-            //Test get gateway name
-            String gateway = credentialsDAO.getGatewayID("tom", connection);
-            Assert.assertNotNull(certificateCredential);
-            Assert.assertEquals("jerry", certificateCredential.getPortalUserName());
-            Assert.assertEquals("gw1", gateway);
-            checkEquality(x509Certificates, certificateCredential.getCertificates());
-            Assert.assertEquals(privateKey.getFormat(), certificateCredential.getPrivateKey().getFormat());
-        } finally {
-            connection.close();
-        }
-    }
-    
-    @Test
-    public void testDeleteCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-            CertificateCredential certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1",
-                    "tom", connection);
-            Assert.assertNotNull(certificateCredential);
-
-            credentialsDAO.deleteCredentials("gw1", "tom", connection);
-
-            certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
-            Assert.assertNull(certificateCredential);
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testUpdateCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-            CommunityUser communityUser = getCommunityUser("gw1", "tom");
-            CertificateCredential certificateCredential = new CertificateCredential();
-            certificateCredential.setToken("tom");
-            certificateCredential.setCommunityUser(communityUser);
-            certificateCredential.setCertificates(x509Certificates);
-            // certificateCredential.setPrivateKey(privateKey);
-            certificateCredential.setPortalUserName("test2");
-            certificateCredential.setLifeTime(50);
-            certificateCredential.setNotBefore("15 OCT 2012 5:34:23");
-            certificateCredential.setNotAfter("16 OCT 2012 5:34:23");
-
-            credentialsDAO.updateCredentials(communityUser.getGatewayName(), certificateCredential, 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.getCertificates()[0].getIssuerDN().toString());
-            // Assert.assertNotNull(certificateCredential.getPrivateKey());
-            Assert.assertEquals("test2", certificateCredential.getPortalUserName());
-
-        } finally {
-            connection.close();
-        }
-
-    }
-
-    @Test
-    public void testGetCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-
-            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.getCertificates()[0].getIssuerDN().toString());
-            // Assert.assertNotNull(certificateCredential.getPrivateKey());
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testGetGatewayCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-            List<Credential> list = credentialsDAO.getCredentials("gw1", connection);
-
-            Assert.assertEquals(1, list.size());
-        } finally {
-            connection.close();
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/util/ConfigurationReaderTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/util/ConfigurationReaderTest.java b/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/util/ConfigurationReaderTest.java
deleted file mode 100644
index 7a95e3e..0000000
--- a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/util/ConfigurationReaderTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * 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.util;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 8/25/13
- * Time: 10:28 AM
- */
-
-public class ConfigurationReaderTest extends TestCase {
-    public void setUp() throws Exception {
-        super.setUp();
-
-    }
-
-    public void testGetSuccessUrl() throws Exception {
-
-        ConfigurationReader configurationReader = new ConfigurationReader();
-        System.out.println(configurationReader.getSuccessUrl());
-        Assert.assertEquals("/credential-store/success.jsp", configurationReader.getSuccessUrl());
-    }
-
-    public void testGetErrorUrl() throws Exception {
-
-        ConfigurationReader configurationReader = new ConfigurationReader();
-        Assert.assertEquals("/credential-store/error.jsp", configurationReader.getErrorUrl());
-
-    }
-
-    public void testRedirectUrl() throws Exception {
-
-        ConfigurationReader configurationReader = new ConfigurationReader();
-        Assert.assertEquals("/credential-store/show-redirect.jsp", configurationReader.getPortalRedirectUrl());
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/util/TokenGeneratorTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/util/TokenGeneratorTest.java b/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/util/TokenGeneratorTest.java
deleted file mode 100644
index 57b52ae..0000000
--- a/modules/credential-store-service/credential-store/src/test/java/org/apache/airavata/credential/store/util/TokenGeneratorTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * 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.util;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 8/5/13
- * Time: 4:20 PM
- */
-
-public class    TokenGeneratorTest extends TestCase {
-
-    public void testGenerateToken() throws Exception {
-
-        String token = TokenGenerator.generateToken("gw1", "admin");
-        Assert.assertNotNull(token);
-        System.out.println(token);
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/test/resources/credential-store/client.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/test/resources/credential-store/client.xml b/modules/credential-store-service/credential-store/src/test/resources/credential-store/client.xml
deleted file mode 100644
index 8b934e6..0000000
--- a/modules/credential-store-service/credential-store/src/test/resources/credential-store/client.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Licensed to the Apache Software
-	Foundation (ASF) under one or more contributor license agreements. See the
-	NOTICE file distributed with this work for additional information regarding
-	copyright ownership. The ASF licenses this file to you under the Apache License,
-	Version 2.0 (theƏ "License"); you may not use this file except in compliance
-	with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-	Unless required by applicable law or agreed to in writing, software distributed
-	under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
-	OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for
-	the specific language governing permissions and limitations under the License. -->
-
-<config>
-    <client name="acs">
-        <logging
-                logFileName="../logs/oa4mp.log"
-                logName="oa4mp"
-                logSize="1000000"
-                logFileCount="2"
-                debug="true"/>
-        <id>myproxy:oa4mp,2012:/client/24c45c2eb65d93231d02d423e94d0362</id>
-        <serviceUri>https://oa4mp.xsede.org/oauth</serviceUri>
-        <callbackUri>https://localhost:8443/airavata/callback</callbackUri>
-        <lifetime>864000</lifetime>
-        <publicKeyFile>../webapps/airavata/WEB-INF/classes/credential-store/oauth-pubkey.pem</publicKeyFile>
-        <privateKeyFile>../webapps/airavata/WEB-INF/classes/credential-store/oauth-privkey.pk8</privateKeyFile>
-    </client>
-
-    <credential-store>
-        <successUri>/credential-store/success.jsp</successUri>
-        <errorUri>/credential-store/error.jsp</errorUri>
-        <redirectUri>/credential-store/show-redirect.jsp</redirectUri>
-    </credential-store>
-
-</config>

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/test/resources/keystore.jks
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/test/resources/keystore.jks b/modules/credential-store-service/credential-store/src/test/resources/keystore.jks
deleted file mode 100644
index 14cf022..0000000
Binary files a/modules/credential-store-service/credential-store/src/test/resources/keystore.jks and /dev/null differ

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/test/resources/mykeystore.jks
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/test/resources/mykeystore.jks b/modules/credential-store-service/credential-store/src/test/resources/mykeystore.jks
deleted file mode 100644
index 335ebf8..0000000
Binary files a/modules/credential-store-service/credential-store/src/test/resources/mykeystore.jks and /dev/null differ

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/cs-thrift-description/credentialStoreErrors.thrift
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/cs-thrift-description/credentialStoreErrors.thrift b/modules/credential-store-service/cs-thrift-description/credentialStoreErrors.thrift
deleted file mode 100644
index 148d7f2..0000000
--- a/modules/credential-store-service/cs-thrift-description/credentialStoreErrors.thrift
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- *
- */
-
-/*
-* This file describes the definitions of the Error Messages that can occur
-*  when invoking Apache Airavata Services through the API. In addition Thrift provides
-*  built in funcationality to raise TApplicationException for all internal server errors.
-*/
-
-namespace java org.apache.airavata.credential.store.exception
-namespace php Airavata.Credential.Store.Error
-
-exception CredentialStoreException {
-  1: required string message
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/cs-thrift-description/cs.cpi.service.thrift
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/cs-thrift-description/cs.cpi.service.thrift b/modules/credential-store-service/cs-thrift-description/cs.cpi.service.thrift
deleted file mode 100644
index c8a31db..0000000
--- a/modules/credential-store-service/cs-thrift-description/cs.cpi.service.thrift
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.
- *
- */
-
-/*
- * Component Programming Interface definition for Apache Airavata GFac Service.
- *
-*/
-
-include "csDataModel.thrift"
-include "credentialStoreErrors.thrift"
-
-namespace java org.apache.airavata.credential.store.cpi
-
-const string CS_CPI_VERSION = "0.15.0"
-
-service CredentialStoreService {
-
-  /** Query CS server to fetch the CPI version */
-  string getCSServiceVersion(),
-
-  /**
-  * This method is to add SSHCredential which will return the token Id in success
-  **/
-  string addSSHCredential (1: required csDataModel.SSHCredential sshCredential)
-                        throws (1:credentialStoreErrors.CredentialStoreException csException);
-
-  string addCertificateCredential (1: required csDataModel.CertificateCredential certificateCredential)
-                        throws (1:credentialStoreErrors.CredentialStoreException csException);
-
-  string addPasswordCredential (1: required csDataModel.PasswordCredential passwordCredential)
-                        throws (1:credentialStoreErrors.CredentialStoreException csException);
-
-  csDataModel.SSHCredential getSSHCredential (1: required string tokenId, 2: required string gatewayId)
-                        throws (1:credentialStoreErrors.CredentialStoreException csException);
-
-  csDataModel.CertificateCredential getCertificateCredential (1: required string tokenId, 2: required string gatewayId)
-                        throws (1:credentialStoreErrors.CredentialStoreException csException);
-
-  csDataModel.PasswordCredential getPasswordCredential (1: required string tokenId, 2: required string gatewayId)
-                        throws (1:credentialStoreErrors.CredentialStoreException csException);
-
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/cs-thrift-description/csDataModel.thrift
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/cs-thrift-description/csDataModel.thrift b/modules/credential-store-service/cs-thrift-description/csDataModel.thrift
deleted file mode 100644
index ce4dc46..0000000
--- a/modules/credential-store-service/cs-thrift-description/csDataModel.thrift
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.
- *
- */
-
-
-namespace java org.apache.airavata.credential.store.datamodel
-namespace php Airavata.Model.Credential.Store
-
-
-const string DEFAULT_ID = "DO_NOT_SET_AT_CLIENTS"
-
-
-struct SSHCredential {
-    1: required string gatewayId,
-    2: required string username,
-    3: required string passphrase,
-    4: optional string publicKey,
-    5: optional string privateKey,
-    6: optional i64 persistedTime,
-    7: optional string token
-}
-
-struct CommunityUser {
-    1: required string gatewayName,
-    2: required string username,
-    3: required string userEmail
-}
-
-struct CertificateCredential {
-    1: required CommunityUser communityUser,
-    2: required string x509Cert,
-    3: optional string notAfter,
-    4: optional string privateKey,
-    5: optional i64 lifeTime,
-    6: optional string notBefore
-    7: optional i64 persistedTime,
-    8: optional string token
-}
-
-struct PasswordCredential {
-    1: required string username,
-    2: required string password,
-    3: optional i64 persistedTime,
-    4: optional string token
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/cs-thrift-description/generate-cs-stubs.sh
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/cs-thrift-description/generate-cs-stubs.sh b/modules/credential-store-service/cs-thrift-description/generate-cs-stubs.sh
deleted file mode 100755
index 156aaa6..0000000
--- a/modules/credential-store-service/cs-thrift-description/generate-cs-stubs.sh
+++ /dev/null
@@ -1,134 +0,0 @@
-#! /usr/bin/env bash
-
-# 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.
-
-# This script will regenerate the thrift code for Airavata Credential Store Server Skeltons and Client Stubs.
-
-
-# Global Constants used across the script
-REQUIRED_THRIFT_VERSION='0.9.1'
-BASE_TARGET_DIR='target'
-CS_SERVICE_DIR='../credential-store/src/main/java'
-
-# The Function fail prints error messages on failure and quits the script.
-fail() {
-    echo $@
-    exit 1
-}
-
-# The function add_license_header adds the ASF V2 license header to all java files within the specified generated
-#   directory. The function also adds suppress all warnings annotation to all public classes and enums
-#  To Call:
-#   add_license_header $generated_code_directory
-add_license_header() {
-
-    # Fetch the generated code directory passed as the argument
-    GENERATED_CODE_DIR=$1
-
-    # For all generated thrift code, add the suppress all warnings annotation
-    #  NOTE: In order to save the original file as a backup, use sed -i.orig in place of sed -i ''
-    find ${GENERATED_CODE_DIR} -name '*.java' -print0 | xargs -0 sed -i '' -e 's/public class /@SuppressWarnings("all") public class /'
-    find ${GENERATED_CODE_DIR} -name '*.java' -print0 | xargs -0 sed -i '' -e 's/public enum /@SuppressWarnings("all") public enum /'
-
-    # For each java file within the generated directory, add the ASF V2 LICENSE header
-    for f in $(find ${GENERATED_CODE_DIR} -name '*.java'); do
-      cat - ${f} >${f}-with-license <<EOF
-    /*
-     * 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.
-     */
-EOF
-    mv ${f}-with-license ${f}
-    done
-}
-
-# The function compares every generated java file with the one in specified existing source location. If the comparison
-#   shows a difference, then it replaces with the newly generated file (with added license header).
-#  To Call:
-#   copy_changed_files $generated_code_directory $existing_source_directory
-copy_changed_files() {
-
-    # Read all the function arguments
-    GENERATED_CODE_DIR=$1
-    WORKSPACE_SRC_DIR=$2
-
-    echo "Generated sources are in ${GENERATED_CODE_DIR}"
-    echo "Destination workspace is in ${WORKSPACE_SRC_DIR}"
-
-    # Check if the newly generated files exist in the targetted workspace, if not copy. Only changed files will be synced.
-    #  the extra slash to GENERATED_CODE_DIR is needed to ensure the parent directory itself is not copied.
-    rsync -auv ${GENERATED_CODE_DIR}/ ${WORKSPACE_SRC_DIR}
-}
-
-# Generation of thrift files will require installing Apache Thrift. Please add thrift to your path.
-#  Verify is thrift is installed, is in the path is at a specified version.
-VERSION=$(thrift -version 2>/dev/null | grep -F "${REQUIRED_THRIFT_VERSION}" |  wc -l)
-if [ "$VERSION" -ne 1 ] ; then
-    echo "****************************************************"
-    echo "*** thrift is not installed or is not in the path"
-    echo "***   expecting 'thrift -version' to return ${REQUIRED_THRIFT_VERSION}"
-    echo "*** generated code will not be updated"
-    fail "****************************************************"
-fi
-
-# Initialize the thrift arguments.
-#  Since most of the Airavata API and Data Models have includes, use recursive option by default.
-#  Generate all the files in target directory
-THRIFT_ARGS="-r -o ${BASE_TARGET_DIR}"
-# Ensure the required target directories exists, if not create.
-mkdir -p ${BASE_TARGET_DIR}
-
-#######################################################################
-# Generate/Update the Credential Store CPI service stubs
-#  To start with both the servicer and client are in same package, but
-#  needs to be split using a common generated api-boilerplate-code
-#######################################################################
-
-#Java generation directory
-JAVA_GEN_DIR=${BASE_TARGET_DIR}/gen-java
-
-# As a precaution  remove and previously generated files if exists
-rm -rf ${JAVA_GEN_DIR}
-
-# Using thrift Java generator, generate the java classes based on Airavata API. This
-#   The airavataAPI.thrift includes rest of data models.
-thrift ${THRIFT_ARGS} --gen java cs.cpi.service.thrift || fail unable to generate java thrift classes
-thrift ${THRIFT_ARGS} --gen java csDataModel.thrift || fail unable to generate java thrift classes
-
-
-# For the generated java classes add the ASF V2 License header
-add_license_header $JAVA_GEN_DIR
-
-# Compare the newly generated classes with existing java generated skeleton/stub sources and replace the changed ones.
-copy_changed_files ${JAVA_GEN_DIR} ${CS_SERVICE_DIR}
-
-# CleanUp: Delete the base target build directory
-#rm -rf ${BASE_TARGET_DIR}
-
-echo "Successfully generated new sources, compared against exiting code and replaced the changed files"
-exit 0


[14/17] airavata git commit: Reorganizing credential store to create a light weight stubs artifact - AIRAVATA-1621

Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/cs_cpi_serviceConstants.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/cs_cpi_serviceConstants.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/cs_cpi_serviceConstants.java
deleted file mode 100644
index 2b8858e..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/cs_cpi_serviceConstants.java
+++ /dev/null
@@ -1,55 +0,0 @@
-    /*
-     * 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.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.credential.store.cpi;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class cs_cpi_serviceConstants {
-
-  public static final String CS_CPI_VERSION = "0.15.0";
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java
deleted file mode 100644
index 93b4e94..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/AuditInfo.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * 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;
-import java.util.Date;
-
-/**
- * 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();
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java
deleted file mode 100644
index 2856f36..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/CommunityUser.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * 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;
-
-/**
- * Represents the community user.
- */
-public class CommunityUser implements Serializable {
-
-    static final long serialVersionUID = 5783370135149452010L;
-
-    private String gatewayName;
-    private String userName;
-    private String userEmail;
-
-    public String getGatewayName() {
-        return gatewayName;
-    }
-
-    public void setGatewayName(String gatewayName) {
-        this.gatewayName = gatewayName;
-    }
-
-    public String getUserEmail() {
-        return userEmail;
-    }
-
-    public void setUserEmail(String userEmail) {
-        this.userEmail = userEmail;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public CommunityUser(String gatewayName, String userName, String userEmail) {
-        this.gatewayName = gatewayName;
-        this.userName = userName;
-        this.userEmail = userEmail;
-    }
-
-    public CommunityUser(String gatewayName, String userName) {
-        this.gatewayName = gatewayName;
-        this.userName = userName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
deleted file mode 100644
index 4f04123..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * 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;
-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 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;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java
deleted file mode 100644
index 17ddb3f..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateAuditInfo.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *
- * 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;
-import org.apache.airavata.credential.store.credential.CommunityUser;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.Date;
-
-/**
- * Audit information related to community credential.
- */
-@XmlRootElement
-public class CertificateAuditInfo implements AuditInfo {
-
-    private static final long serialVersionUID = 13213123L;
-
-    private String gatewayName;
-    private String communityUserName;
-    private String portalUserName;
-    private Date credentialsRequestedTime;
-    private String notBefore;
-    private String notAfter;
-    private long credentialLifeTime;
-
-    public String getGatewayName() {
-        return gatewayName;
-    }
-
-    public void setGatewayName(String gatewayName) {
-        this.gatewayName = gatewayName;
-    }
-
-    public void setCommunityUserName(String communityUserName) {
-        this.communityUserName = communityUserName;
-    }
-
-    public void setPortalUserName(String portalUserName) {
-        this.portalUserName = portalUserName;
-    }
-
-    public void setCredentialsRequestedTime(Date credentialsRequestedTime) {
-        this.credentialsRequestedTime = credentialsRequestedTime;
-    }
-
-    public String getNotBefore() {
-        return notBefore;
-    }
-
-    public void setNotBefore(String notBefore) {
-        this.notBefore = notBefore;
-    }
-
-    public String getNotAfter() {
-        return notAfter;
-    }
-
-    public void setNotAfter(String notAfter) {
-        this.notAfter = notAfter;
-    }
-
-    public long getCredentialLifeTime() {
-        return credentialLifeTime;
-    }
-
-    public void setCredentialLifeTime(long credentialLifeTime) {
-        this.credentialLifeTime = credentialLifeTime;
-    }
-
-    public CommunityUser getCommunityUser() {
-        return new CommunityUser(gatewayName, communityUserName);
-    }
-
-    public String getPortalUserId() {
-        return portalUserName;
-    }
-
-    public Date getTimePersisted() {
-        return credentialsRequestedTime;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java
deleted file mode 100644
index 16c3351..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/certificate/CertificateCredential.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *
- * 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 java.security.cert.X509Certificate;
-
-/**
- * Represents the certificate credentials.
- */
-public class CertificateCredential extends Credential {
-
-    static final long serialVersionUID = 6603675553790734432L;
-
-    /**
-     * The community user associated with this credentials.
-     */
-    private CommunityUser communityUser;
-
-    private String notAfter;
-
-    private X509Certificate[] certificates;
-
-    private PrivateKey privateKey;
-
-    private long lifeTime;
-
-    private String notBefore;
-
-    public CertificateCredential() {
-    }
-
-    public String getNotBefore() {
-        return notBefore;
-    }
-
-    public void setNotBefore(String notBefore) {
-        this.notBefore = notBefore;
-    }
-
-    public String getNotAfter() {
-        return notAfter;
-    }
-
-    public void setNotAfter(String notAfter) {
-        this.notAfter = notAfter;
-    }
-
-    public PrivateKey getPrivateKey() {
-        return privateKey;
-    }
-
-    public void setPrivateKey(PrivateKey privateKey) {
-        this.privateKey = privateKey;
-    }
-
-    public X509Certificate[] getCertificates() {
-        return certificates;
-    }
-
-    public void setCertificates(X509Certificate[] certificate) {
-        this.certificates = certificate;
-    }
-
-    public long getLifeTime() {
-        return lifeTime;
-    }
-
-    public void setLifeTime(long lifeTime) {
-        this.lifeTime = lifeTime;
-    }
-
-    public CommunityUser getCommunityUser() {
-        return communityUser;
-    }
-
-    public void setCommunityUser(CommunityUser communityUser) {
-        this.communityUser = communityUser;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java
deleted file mode 100644
index a31c98b..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/password/PasswordCredential.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * 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 org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
-
-import java.util.Date;
-
-/**
- * User name password credentials.
- */
-public class PasswordCredential extends SSHCredential {
-
-    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;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java
deleted file mode 100644
index d41af21..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredential.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * 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.ssh;
-
-import org.apache.airavata.credential.store.credential.Credential;
-import java.io.Serializable;
-
-/**
- * An SSH Credential class which is an extension of Airavata Credential 
- */
-public class SSHCredential extends Credential implements Serializable {
-
-    /**
-	 * 
-	 */
-	private static final long serialVersionUID = 1277154647420198981L;
-	
-	private byte[] privatekey;
-    private byte[] publicKey;
-    private String passphrase;
-    private String gateway;
-    private String username;
-
-
-    public SSHCredential() {
-    }
-
-    public SSHCredential(byte[] privatekey, byte[] publicKey, String passphrase, String gateway,String username) {
-        this.privatekey = privatekey;
-        this.publicKey = publicKey;
-        this.passphrase = passphrase;
-        this.gateway = gateway;
-        this.username = username;
-        this.setPortalUserName(username);
-    }
-
-    public byte[] getPrivateKey() {
-        return privatekey;
-    }
-
-    public void setPrivateKey(byte[] privatekey) {
-        this.privatekey = privatekey;
-    }
-
-    public byte[] getPublicKey() {
-        return publicKey;
-    }
-
-    public void setPublicKey(byte[] pubKey) {
-        this.publicKey = pubKey;
-    }
-
-    public String getPassphrase() {
-        return passphrase;
-    }
-
-    public void setPassphrase(String passphrase) {
-        this.passphrase = passphrase;
-    }
-
-	public String getGateway() {
-		return gateway;
-	}
-
-	public void setGateway(String gateway) {
-		this.gateway = gateway;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java
deleted file mode 100644
index ac1f0df..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialGenerator.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *
- * 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.ssh;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.RandomStringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.KeyPair;
-
-/**
- * A class which generates an SSH credential
- */
-public class SSHCredentialGenerator {
-	
-	private static Logger logger = LoggerFactory.getLogger(SSHCredentialWriter.class);
-	
-	/**
-	 * 
-	 * @return a SSH Credential generated and encrypted using a randomly generated password
-	 * @throws CredentialStoreException 
-	 */
-	public SSHCredential generateCredential(String tokenId) throws CredentialStoreException {
-        JSch jsch=new JSch();
-        try {
-            KeyPair kpair=KeyPair.genKeyPair(jsch, KeyPair.RSA);
-            File file;
-			
-				file = File.createTempFile("id_rsa", "");
-			
-            String fileName = file.getAbsolutePath();
-
-            String password = generateRandomString();
-            // We are encrypting the private key with the hash of (tokenId+password). 
-            // Any client which wants to use this private key will also generate a hash and then use it to decrypt the key.  
-            kpair.writePrivateKey(fileName,password.getBytes());
-            kpair.writePublicKey(fileName + ".pub"  , "");
-            kpair.dispose();
-            byte[] priKey = FileUtils.readFileToByteArray(new File(fileName));
-            byte[] pubKey = FileUtils.readFileToByteArray(new File(fileName + ".pub"));
-            SSHCredential sshCredential = new SSHCredential();
-            sshCredential.setPrivateKey(priKey);
-            sshCredential.setPublicKey(pubKey);
-            sshCredential.setPassphrase(password);
-            return sshCredential;
-		} catch (IOException e) {
-			logger.error("IO Exception when creating SSH credential ",e);
-			throw new CredentialStoreException("Unable to generate SSH Credential", e);
-		} catch (JSchException e) {
-			logger.error("JSch SSH credential creation exception ",e);
-			throw new CredentialStoreException("Unable to generate SSH Credential. JSch exception ", e);
-		}
-	}
-	
-	private String generateHash(String tokenId, String password) {
-        byte[] bytesOfMessage = new byte[0];
-        try {
-            bytesOfMessage = password.getBytes("UTF-8");
-            MessageDigest md = MessageDigest.getInstance("MD5");
-            return new String( md.digest(bytesOfMessage));
-        } catch (UnsupportedEncodingException e) {
-            logger.error(e.getMessage(), e);
-        } catch (NoSuchAlgorithmException e) {
-            logger.error(e.getMessage(), e);
-        }
-        return  null;
-    }
-
-	// Generate a random alphanumberic string of 16 characters length
-	private String generateRandomString() {
-		return RandomStringUtils.randomAlphanumeric(16);
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
deleted file mode 100644
index ae37b1d..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
+++ /dev/null
@@ -1,1104 +0,0 @@
-    /*
-     * 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.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.credential.store.datamodel;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class CertificateCredential implements org.apache.thrift.TBase<CertificateCredential, CertificateCredential._Fields>, java.io.Serializable, Cloneable, Comparable<CertificateCredential> {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CertificateCredential");
-
-  private static final org.apache.thrift.protocol.TField COMMUNITY_USER_FIELD_DESC = new org.apache.thrift.protocol.TField("communityUser", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-  private static final org.apache.thrift.protocol.TField X509_CERT_FIELD_DESC = new org.apache.thrift.protocol.TField("x509Cert", org.apache.thrift.protocol.TType.STRING, (short)2);
-  private static final org.apache.thrift.protocol.TField NOT_AFTER_FIELD_DESC = new org.apache.thrift.protocol.TField("notAfter", org.apache.thrift.protocol.TType.STRING, (short)3);
-  private static final org.apache.thrift.protocol.TField PRIVATE_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("privateKey", org.apache.thrift.protocol.TType.STRING, (short)4);
-  private static final org.apache.thrift.protocol.TField LIFE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lifeTime", org.apache.thrift.protocol.TType.I64, (short)5);
-  private static final org.apache.thrift.protocol.TField NOT_BEFORE_FIELD_DESC = new org.apache.thrift.protocol.TField("notBefore", org.apache.thrift.protocol.TType.STRING, (short)6);
-  private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)7);
-  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)8);
-
-  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new CertificateCredentialStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new CertificateCredentialTupleSchemeFactory());
-  }
-
-  public CommunityUser communityUser; // required
-  public String x509Cert; // required
-  public String notAfter; // optional
-  public String privateKey; // optional
-  public long lifeTime; // optional
-  public String notBefore; // optional
-  public long persistedTime; // optional
-  public String token; // optional
-
-  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    COMMUNITY_USER((short)1, "communityUser"),
-    X509_CERT((short)2, "x509Cert"),
-    NOT_AFTER((short)3, "notAfter"),
-    PRIVATE_KEY((short)4, "privateKey"),
-    LIFE_TIME((short)5, "lifeTime"),
-    NOT_BEFORE((short)6, "notBefore"),
-    PERSISTED_TIME((short)7, "persistedTime"),
-    TOKEN((short)8, "token");
-
-    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-    static {
-      for (_Fields field : EnumSet.allOf(_Fields.class)) {
-        byName.put(field.getFieldName(), field);
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, or null if its not found.
-     */
-    public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // COMMUNITY_USER
-          return COMMUNITY_USER;
-        case 2: // X509_CERT
-          return X509_CERT;
-        case 3: // NOT_AFTER
-          return NOT_AFTER;
-        case 4: // PRIVATE_KEY
-          return PRIVATE_KEY;
-        case 5: // LIFE_TIME
-          return LIFE_TIME;
-        case 6: // NOT_BEFORE
-          return NOT_BEFORE;
-        case 7: // PERSISTED_TIME
-          return PERSISTED_TIME;
-        case 8: // TOKEN
-          return TOKEN;
-        default:
-          return null;
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, throwing an exception
-     * if it is not found.
-     */
-    public static _Fields findByThriftIdOrThrow(int fieldId) {
-      _Fields fields = findByThriftId(fieldId);
-      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      return fields;
-    }
-
-    /**
-     * Find the _Fields constant that matches name, or null if its not found.
-     */
-    public static _Fields findByName(String name) {
-      return byName.get(name);
-    }
-
-    private final short _thriftId;
-    private final String _fieldName;
-
-    _Fields(short thriftId, String fieldName) {
-      _thriftId = thriftId;
-      _fieldName = fieldName;
-    }
-
-    public short getThriftFieldId() {
-      return _thriftId;
-    }
-
-    public String getFieldName() {
-      return _fieldName;
-    }
-  }
-
-  // isset id assignments
-  private static final int __LIFETIME_ISSET_ID = 0;
-  private static final int __PERSISTEDTIME_ISSET_ID = 1;
-  private byte __isset_bitfield = 0;
-  private _Fields optionals[] = {_Fields.NOT_AFTER,_Fields.PRIVATE_KEY,_Fields.LIFE_TIME,_Fields.NOT_BEFORE,_Fields.PERSISTED_TIME,_Fields.TOKEN};
-  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.COMMUNITY_USER, new org.apache.thrift.meta_data.FieldMetaData("communityUser", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CommunityUser.class)));
-    tmpMap.put(_Fields.X509_CERT, new org.apache.thrift.meta_data.FieldMetaData("x509Cert", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.NOT_AFTER, new org.apache.thrift.meta_data.FieldMetaData("notAfter", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PRIVATE_KEY, new org.apache.thrift.meta_data.FieldMetaData("privateKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.LIFE_TIME, new org.apache.thrift.meta_data.FieldMetaData("lifeTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
-    tmpMap.put(_Fields.NOT_BEFORE, new org.apache.thrift.meta_data.FieldMetaData("notBefore", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
-    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
-    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CertificateCredential.class, metaDataMap);
-  }
-
-  public CertificateCredential() {
-  }
-
-  public CertificateCredential(
-    CommunityUser communityUser,
-    String x509Cert)
-  {
-    this();
-    this.communityUser = communityUser;
-    this.x509Cert = x509Cert;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public CertificateCredential(CertificateCredential other) {
-    __isset_bitfield = other.__isset_bitfield;
-    if (other.isSetCommunityUser()) {
-      this.communityUser = new CommunityUser(other.communityUser);
-    }
-    if (other.isSetX509Cert()) {
-      this.x509Cert = other.x509Cert;
-    }
-    if (other.isSetNotAfter()) {
-      this.notAfter = other.notAfter;
-    }
-    if (other.isSetPrivateKey()) {
-      this.privateKey = other.privateKey;
-    }
-    this.lifeTime = other.lifeTime;
-    if (other.isSetNotBefore()) {
-      this.notBefore = other.notBefore;
-    }
-    this.persistedTime = other.persistedTime;
-    if (other.isSetToken()) {
-      this.token = other.token;
-    }
-  }
-
-  public CertificateCredential deepCopy() {
-    return new CertificateCredential(this);
-  }
-
-  @Override
-  public void clear() {
-    this.communityUser = null;
-    this.x509Cert = null;
-    this.notAfter = null;
-    this.privateKey = null;
-    setLifeTimeIsSet(false);
-    this.lifeTime = 0;
-    this.notBefore = null;
-    setPersistedTimeIsSet(false);
-    this.persistedTime = 0;
-    this.token = null;
-  }
-
-  public CommunityUser getCommunityUser() {
-    return this.communityUser;
-  }
-
-  public CertificateCredential setCommunityUser(CommunityUser communityUser) {
-    this.communityUser = communityUser;
-    return this;
-  }
-
-  public void unsetCommunityUser() {
-    this.communityUser = null;
-  }
-
-  /** Returns true if field communityUser is set (has been assigned a value) and false otherwise */
-  public boolean isSetCommunityUser() {
-    return this.communityUser != null;
-  }
-
-  public void setCommunityUserIsSet(boolean value) {
-    if (!value) {
-      this.communityUser = null;
-    }
-  }
-
-  public String getX509Cert() {
-    return this.x509Cert;
-  }
-
-  public CertificateCredential setX509Cert(String x509Cert) {
-    this.x509Cert = x509Cert;
-    return this;
-  }
-
-  public void unsetX509Cert() {
-    this.x509Cert = null;
-  }
-
-  /** Returns true if field x509Cert is set (has been assigned a value) and false otherwise */
-  public boolean isSetX509Cert() {
-    return this.x509Cert != null;
-  }
-
-  public void setX509CertIsSet(boolean value) {
-    if (!value) {
-      this.x509Cert = null;
-    }
-  }
-
-  public String getNotAfter() {
-    return this.notAfter;
-  }
-
-  public CertificateCredential setNotAfter(String notAfter) {
-    this.notAfter = notAfter;
-    return this;
-  }
-
-  public void unsetNotAfter() {
-    this.notAfter = null;
-  }
-
-  /** Returns true if field notAfter is set (has been assigned a value) and false otherwise */
-  public boolean isSetNotAfter() {
-    return this.notAfter != null;
-  }
-
-  public void setNotAfterIsSet(boolean value) {
-    if (!value) {
-      this.notAfter = null;
-    }
-  }
-
-  public String getPrivateKey() {
-    return this.privateKey;
-  }
-
-  public CertificateCredential setPrivateKey(String privateKey) {
-    this.privateKey = privateKey;
-    return this;
-  }
-
-  public void unsetPrivateKey() {
-    this.privateKey = null;
-  }
-
-  /** Returns true if field privateKey is set (has been assigned a value) and false otherwise */
-  public boolean isSetPrivateKey() {
-    return this.privateKey != null;
-  }
-
-  public void setPrivateKeyIsSet(boolean value) {
-    if (!value) {
-      this.privateKey = null;
-    }
-  }
-
-  public long getLifeTime() {
-    return this.lifeTime;
-  }
-
-  public CertificateCredential setLifeTime(long lifeTime) {
-    this.lifeTime = lifeTime;
-    setLifeTimeIsSet(true);
-    return this;
-  }
-
-  public void unsetLifeTime() {
-    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LIFETIME_ISSET_ID);
-  }
-
-  /** Returns true if field lifeTime is set (has been assigned a value) and false otherwise */
-  public boolean isSetLifeTime() {
-    return EncodingUtils.testBit(__isset_bitfield, __LIFETIME_ISSET_ID);
-  }
-
-  public void setLifeTimeIsSet(boolean value) {
-    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LIFETIME_ISSET_ID, value);
-  }
-
-  public String getNotBefore() {
-    return this.notBefore;
-  }
-
-  public CertificateCredential setNotBefore(String notBefore) {
-    this.notBefore = notBefore;
-    return this;
-  }
-
-  public void unsetNotBefore() {
-    this.notBefore = null;
-  }
-
-  /** Returns true if field notBefore is set (has been assigned a value) and false otherwise */
-  public boolean isSetNotBefore() {
-    return this.notBefore != null;
-  }
-
-  public void setNotBeforeIsSet(boolean value) {
-    if (!value) {
-      this.notBefore = null;
-    }
-  }
-
-  public long getPersistedTime() {
-    return this.persistedTime;
-  }
-
-  public CertificateCredential setPersistedTime(long persistedTime) {
-    this.persistedTime = persistedTime;
-    setPersistedTimeIsSet(true);
-    return this;
-  }
-
-  public void unsetPersistedTime() {
-    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
-  }
-
-  /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */
-  public boolean isSetPersistedTime() {
-    return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID);
-  }
-
-  public void setPersistedTimeIsSet(boolean value) {
-    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value);
-  }
-
-  public String getToken() {
-    return this.token;
-  }
-
-  public CertificateCredential setToken(String token) {
-    this.token = token;
-    return this;
-  }
-
-  public void unsetToken() {
-    this.token = null;
-  }
-
-  /** Returns true if field token is set (has been assigned a value) and false otherwise */
-  public boolean isSetToken() {
-    return this.token != null;
-  }
-
-  public void setTokenIsSet(boolean value) {
-    if (!value) {
-      this.token = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case COMMUNITY_USER:
-      if (value == null) {
-        unsetCommunityUser();
-      } else {
-        setCommunityUser((CommunityUser)value);
-      }
-      break;
-
-    case X509_CERT:
-      if (value == null) {
-        unsetX509Cert();
-      } else {
-        setX509Cert((String)value);
-      }
-      break;
-
-    case NOT_AFTER:
-      if (value == null) {
-        unsetNotAfter();
-      } else {
-        setNotAfter((String)value);
-      }
-      break;
-
-    case PRIVATE_KEY:
-      if (value == null) {
-        unsetPrivateKey();
-      } else {
-        setPrivateKey((String)value);
-      }
-      break;
-
-    case LIFE_TIME:
-      if (value == null) {
-        unsetLifeTime();
-      } else {
-        setLifeTime((Long)value);
-      }
-      break;
-
-    case NOT_BEFORE:
-      if (value == null) {
-        unsetNotBefore();
-      } else {
-        setNotBefore((String)value);
-      }
-      break;
-
-    case PERSISTED_TIME:
-      if (value == null) {
-        unsetPersistedTime();
-      } else {
-        setPersistedTime((Long)value);
-      }
-      break;
-
-    case TOKEN:
-      if (value == null) {
-        unsetToken();
-      } else {
-        setToken((String)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case COMMUNITY_USER:
-      return getCommunityUser();
-
-    case X509_CERT:
-      return getX509Cert();
-
-    case NOT_AFTER:
-      return getNotAfter();
-
-    case PRIVATE_KEY:
-      return getPrivateKey();
-
-    case LIFE_TIME:
-      return Long.valueOf(getLifeTime());
-
-    case NOT_BEFORE:
-      return getNotBefore();
-
-    case PERSISTED_TIME:
-      return Long.valueOf(getPersistedTime());
-
-    case TOKEN:
-      return getToken();
-
-    }
-    throw new IllegalStateException();
-  }
-
-  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
-    switch (field) {
-    case COMMUNITY_USER:
-      return isSetCommunityUser();
-    case X509_CERT:
-      return isSetX509Cert();
-    case NOT_AFTER:
-      return isSetNotAfter();
-    case PRIVATE_KEY:
-      return isSetPrivateKey();
-    case LIFE_TIME:
-      return isSetLifeTime();
-    case NOT_BEFORE:
-      return isSetNotBefore();
-    case PERSISTED_TIME:
-      return isSetPersistedTime();
-    case TOKEN:
-      return isSetToken();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof CertificateCredential)
-      return this.equals((CertificateCredential)that);
-    return false;
-  }
-
-  public boolean equals(CertificateCredential that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_communityUser = true && this.isSetCommunityUser();
-    boolean that_present_communityUser = true && that.isSetCommunityUser();
-    if (this_present_communityUser || that_present_communityUser) {
-      if (!(this_present_communityUser && that_present_communityUser))
-        return false;
-      if (!this.communityUser.equals(that.communityUser))
-        return false;
-    }
-
-    boolean this_present_x509Cert = true && this.isSetX509Cert();
-    boolean that_present_x509Cert = true && that.isSetX509Cert();
-    if (this_present_x509Cert || that_present_x509Cert) {
-      if (!(this_present_x509Cert && that_present_x509Cert))
-        return false;
-      if (!this.x509Cert.equals(that.x509Cert))
-        return false;
-    }
-
-    boolean this_present_notAfter = true && this.isSetNotAfter();
-    boolean that_present_notAfter = true && that.isSetNotAfter();
-    if (this_present_notAfter || that_present_notAfter) {
-      if (!(this_present_notAfter && that_present_notAfter))
-        return false;
-      if (!this.notAfter.equals(that.notAfter))
-        return false;
-    }
-
-    boolean this_present_privateKey = true && this.isSetPrivateKey();
-    boolean that_present_privateKey = true && that.isSetPrivateKey();
-    if (this_present_privateKey || that_present_privateKey) {
-      if (!(this_present_privateKey && that_present_privateKey))
-        return false;
-      if (!this.privateKey.equals(that.privateKey))
-        return false;
-    }
-
-    boolean this_present_lifeTime = true && this.isSetLifeTime();
-    boolean that_present_lifeTime = true && that.isSetLifeTime();
-    if (this_present_lifeTime || that_present_lifeTime) {
-      if (!(this_present_lifeTime && that_present_lifeTime))
-        return false;
-      if (this.lifeTime != that.lifeTime)
-        return false;
-    }
-
-    boolean this_present_notBefore = true && this.isSetNotBefore();
-    boolean that_present_notBefore = true && that.isSetNotBefore();
-    if (this_present_notBefore || that_present_notBefore) {
-      if (!(this_present_notBefore && that_present_notBefore))
-        return false;
-      if (!this.notBefore.equals(that.notBefore))
-        return false;
-    }
-
-    boolean this_present_persistedTime = true && this.isSetPersistedTime();
-    boolean that_present_persistedTime = true && that.isSetPersistedTime();
-    if (this_present_persistedTime || that_present_persistedTime) {
-      if (!(this_present_persistedTime && that_present_persistedTime))
-        return false;
-      if (this.persistedTime != that.persistedTime)
-        return false;
-    }
-
-    boolean this_present_token = true && this.isSetToken();
-    boolean that_present_token = true && that.isSetToken();
-    if (this_present_token || that_present_token) {
-      if (!(this_present_token && that_present_token))
-        return false;
-      if (!this.token.equals(that.token))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return 0;
-  }
-
-  @Override
-  public int compareTo(CertificateCredential other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-
-    lastComparison = Boolean.valueOf(isSetCommunityUser()).compareTo(other.isSetCommunityUser());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetCommunityUser()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.communityUser, other.communityUser);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetX509Cert()).compareTo(other.isSetX509Cert());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetX509Cert()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.x509Cert, other.x509Cert);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetNotAfter()).compareTo(other.isSetNotAfter());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetNotAfter()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notAfter, other.notAfter);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetPrivateKey()).compareTo(other.isSetPrivateKey());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetPrivateKey()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privateKey, other.privateKey);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetLifeTime()).compareTo(other.isSetLifeTime());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetLifeTime()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lifeTime, other.lifeTime);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetNotBefore()).compareTo(other.isSetNotBefore());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetNotBefore()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notBefore, other.notBefore);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetPersistedTime()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetToken()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
-  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-  }
-
-  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("CertificateCredential(");
-    boolean first = true;
-
-    sb.append("communityUser:");
-    if (this.communityUser == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.communityUser);
-    }
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("x509Cert:");
-    if (this.x509Cert == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.x509Cert);
-    }
-    first = false;
-    if (isSetNotAfter()) {
-      if (!first) sb.append(", ");
-      sb.append("notAfter:");
-      if (this.notAfter == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.notAfter);
-      }
-      first = false;
-    }
-    if (isSetPrivateKey()) {
-      if (!first) sb.append(", ");
-      sb.append("privateKey:");
-      if (this.privateKey == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.privateKey);
-      }
-      first = false;
-    }
-    if (isSetLifeTime()) {
-      if (!first) sb.append(", ");
-      sb.append("lifeTime:");
-      sb.append(this.lifeTime);
-      first = false;
-    }
-    if (isSetNotBefore()) {
-      if (!first) sb.append(", ");
-      sb.append("notBefore:");
-      if (this.notBefore == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.notBefore);
-      }
-      first = false;
-    }
-    if (isSetPersistedTime()) {
-      if (!first) sb.append(", ");
-      sb.append("persistedTime:");
-      sb.append(this.persistedTime);
-      first = false;
-    }
-    if (isSetToken()) {
-      if (!first) sb.append(", ");
-      sb.append("token:");
-      if (this.token == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.token);
-      }
-      first = false;
-    }
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    if (communityUser == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'communityUser' was not present! Struct: " + toString());
-    }
-    if (x509Cert == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'x509Cert' was not present! Struct: " + toString());
-    }
-    // check for sub-struct validity
-    if (communityUser != null) {
-      communityUser.validate();
-    }
-  }
-
-  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-    try {
-      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-    try {
-      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
-      __isset_bitfield = 0;
-      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private static class CertificateCredentialStandardSchemeFactory implements SchemeFactory {
-    public CertificateCredentialStandardScheme getScheme() {
-      return new CertificateCredentialStandardScheme();
-    }
-  }
-
-  private static class CertificateCredentialStandardScheme extends StandardScheme<CertificateCredential> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, CertificateCredential struct) throws org.apache.thrift.TException {
-      org.apache.thrift.protocol.TField schemeField;
-      iprot.readStructBegin();
-      while (true)
-      {
-        schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-          break;
-        }
-        switch (schemeField.id) {
-          case 1: // COMMUNITY_USER
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
-              struct.communityUser = new CommunityUser();
-              struct.communityUser.read(iprot);
-              struct.setCommunityUserIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 2: // X509_CERT
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.x509Cert = iprot.readString();
-              struct.setX509CertIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 3: // NOT_AFTER
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.notAfter = iprot.readString();
-              struct.setNotAfterIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 4: // PRIVATE_KEY
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.privateKey = iprot.readString();
-              struct.setPrivateKeyIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 5: // LIFE_TIME
-            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
-              struct.lifeTime = iprot.readI64();
-              struct.setLifeTimeIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 6: // NOT_BEFORE
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.notBefore = iprot.readString();
-              struct.setNotBeforeIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 7: // PERSISTED_TIME
-            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
-              struct.persistedTime = iprot.readI64();
-              struct.setPersistedTimeIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 8: // TOKEN
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.token = iprot.readString();
-              struct.setTokenIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          default:
-            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-        }
-        iprot.readFieldEnd();
-      }
-      iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
-      struct.validate();
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot, CertificateCredential struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.communityUser != null) {
-        oprot.writeFieldBegin(COMMUNITY_USER_FIELD_DESC);
-        struct.communityUser.write(oprot);
-        oprot.writeFieldEnd();
-      }
-      if (struct.x509Cert != null) {
-        oprot.writeFieldBegin(X509_CERT_FIELD_DESC);
-        oprot.writeString(struct.x509Cert);
-        oprot.writeFieldEnd();
-      }
-      if (struct.notAfter != null) {
-        if (struct.isSetNotAfter()) {
-          oprot.writeFieldBegin(NOT_AFTER_FIELD_DESC);
-          oprot.writeString(struct.notAfter);
-          oprot.writeFieldEnd();
-        }
-      }
-      if (struct.privateKey != null) {
-        if (struct.isSetPrivateKey()) {
-          oprot.writeFieldBegin(PRIVATE_KEY_FIELD_DESC);
-          oprot.writeString(struct.privateKey);
-          oprot.writeFieldEnd();
-        }
-      }
-      if (struct.isSetLifeTime()) {
-        oprot.writeFieldBegin(LIFE_TIME_FIELD_DESC);
-        oprot.writeI64(struct.lifeTime);
-        oprot.writeFieldEnd();
-      }
-      if (struct.notBefore != null) {
-        if (struct.isSetNotBefore()) {
-          oprot.writeFieldBegin(NOT_BEFORE_FIELD_DESC);
-          oprot.writeString(struct.notBefore);
-          oprot.writeFieldEnd();
-        }
-      }
-      if (struct.isSetPersistedTime()) {
-        oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC);
-        oprot.writeI64(struct.persistedTime);
-        oprot.writeFieldEnd();
-      }
-      if (struct.token != null) {
-        if (struct.isSetToken()) {
-          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
-          oprot.writeString(struct.token);
-          oprot.writeFieldEnd();
-        }
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class CertificateCredentialTupleSchemeFactory implements SchemeFactory {
-    public CertificateCredentialTupleScheme getScheme() {
-      return new CertificateCredentialTupleScheme();
-    }
-  }
-
-  private static class CertificateCredentialTupleScheme extends TupleScheme<CertificateCredential> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, CertificateCredential struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      struct.communityUser.write(oprot);
-      oprot.writeString(struct.x509Cert);
-      BitSet optionals = new BitSet();
-      if (struct.isSetNotAfter()) {
-        optionals.set(0);
-      }
-      if (struct.isSetPrivateKey()) {
-        optionals.set(1);
-      }
-      if (struct.isSetLifeTime()) {
-        optionals.set(2);
-      }
-      if (struct.isSetNotBefore()) {
-        optionals.set(3);
-      }
-      if (struct.isSetPersistedTime()) {
-        optionals.set(4);
-      }
-      if (struct.isSetToken()) {
-        optionals.set(5);
-      }
-      oprot.writeBitSet(optionals, 6);
-      if (struct.isSetNotAfter()) {
-        oprot.writeString(struct.notAfter);
-      }
-      if (struct.isSetPrivateKey()) {
-        oprot.writeString(struct.privateKey);
-      }
-      if (struct.isSetLifeTime()) {
-        oprot.writeI64(struct.lifeTime);
-      }
-      if (struct.isSetNotBefore()) {
-        oprot.writeString(struct.notBefore);
-      }
-      if (struct.isSetPersistedTime()) {
-        oprot.writeI64(struct.persistedTime);
-      }
-      if (struct.isSetToken()) {
-        oprot.writeString(struct.token);
-      }
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, CertificateCredential struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      struct.communityUser = new CommunityUser();
-      struct.communityUser.read(iprot);
-      struct.setCommunityUserIsSet(true);
-      struct.x509Cert = iprot.readString();
-      struct.setX509CertIsSet(true);
-      BitSet incoming = iprot.readBitSet(6);
-      if (incoming.get(0)) {
-        struct.notAfter = iprot.readString();
-        struct.setNotAfterIsSet(true);
-      }
-      if (incoming.get(1)) {
-        struct.privateKey = iprot.readString();
-        struct.setPrivateKeyIsSet(true);
-      }
-      if (incoming.get(2)) {
-        struct.lifeTime = iprot.readI64();
-        struct.setLifeTimeIsSet(true);
-      }
-      if (incoming.get(3)) {
-        struct.notBefore = iprot.readString();
-        struct.setNotBeforeIsSet(true);
-      }
-      if (incoming.get(4)) {
-        struct.persistedTime = iprot.readI64();
-        struct.setPersistedTimeIsSet(true);
-      }
-      if (incoming.get(5)) {
-        struct.token = iprot.readString();
-        struct.setTokenIsSet(true);
-      }
-    }
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/58c58cf2/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
deleted file mode 100644
index 9b62310..0000000
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
+++ /dev/null
@@ -1,589 +0,0 @@
-    /*
-     * 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.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.credential.store.datamodel;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class CommunityUser implements org.apache.thrift.TBase<CommunityUser, CommunityUser._Fields>, java.io.Serializable, Cloneable, Comparable<CommunityUser> {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CommunityUser");
-
-  private static final org.apache.thrift.protocol.TField GATEWAY_NMAE_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayNmae", org.apache.thrift.protocol.TType.STRING, (short)1);
-  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2);
-  private static final org.apache.thrift.protocol.TField USER_EMAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("userEmail", org.apache.thrift.protocol.TType.STRING, (short)3);
-
-  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new CommunityUserStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new CommunityUserTupleSchemeFactory());
-  }
-
-  public String gatewayNmae; // required
-  public String username; // required
-  public String userEmail; // required
-
-  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-  @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    GATEWAY_NMAE((short)1, "gatewayNmae"),
-    USERNAME((short)2, "username"),
-    USER_EMAIL((short)3, "userEmail");
-
-    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-    static {
-      for (_Fields field : EnumSet.allOf(_Fields.class)) {
-        byName.put(field.getFieldName(), field);
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, or null if its not found.
-     */
-    public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // GATEWAY_NMAE
-          return GATEWAY_NMAE;
-        case 2: // USERNAME
-          return USERNAME;
-        case 3: // USER_EMAIL
-          return USER_EMAIL;
-        default:
-          return null;
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, throwing an exception
-     * if it is not found.
-     */
-    public static _Fields findByThriftIdOrThrow(int fieldId) {
-      _Fields fields = findByThriftId(fieldId);
-      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      return fields;
-    }
-
-    /**
-     * Find the _Fields constant that matches name, or null if its not found.
-     */
-    public static _Fields findByName(String name) {
-      return byName.get(name);
-    }
-
-    private final short _thriftId;
-    private final String _fieldName;
-
-    _Fields(short thriftId, String fieldName) {
-      _thriftId = thriftId;
-      _fieldName = fieldName;
-    }
-
-    public short getThriftFieldId() {
-      return _thriftId;
-    }
-
-    public String getFieldName() {
-      return _fieldName;
-    }
-  }
-
-  // isset id assignments
-  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.GATEWAY_NMAE, new org.apache.thrift.meta_data.FieldMetaData("gatewayNmae", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.USER_EMAIL, new org.apache.thrift.meta_data.FieldMetaData("userEmail", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
-    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CommunityUser.class, metaDataMap);
-  }
-
-  public CommunityUser() {
-  }
-
-  public CommunityUser(
-    String gatewayNmae,
-    String username,
-    String userEmail)
-  {
-    this();
-    this.gatewayNmae = gatewayNmae;
-    this.username = username;
-    this.userEmail = userEmail;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public CommunityUser(CommunityUser other) {
-    if (other.isSetGatewayNmae()) {
-      this.gatewayNmae = other.gatewayNmae;
-    }
-    if (other.isSetUsername()) {
-      this.username = other.username;
-    }
-    if (other.isSetUserEmail()) {
-      this.userEmail = other.userEmail;
-    }
-  }
-
-  public CommunityUser deepCopy() {
-    return new CommunityUser(this);
-  }
-
-  @Override
-  public void clear() {
-    this.gatewayNmae = null;
-    this.username = null;
-    this.userEmail = null;
-  }
-
-  public String getGatewayNmae() {
-    return this.gatewayNmae;
-  }
-
-  public CommunityUser setGatewayNmae(String gatewayNmae) {
-    this.gatewayNmae = gatewayNmae;
-    return this;
-  }
-
-  public void unsetGatewayNmae() {
-    this.gatewayNmae = null;
-  }
-
-  /** Returns true if field gatewayNmae is set (has been assigned a value) and false otherwise */
-  public boolean isSetGatewayNmae() {
-    return this.gatewayNmae != null;
-  }
-
-  public void setGatewayNmaeIsSet(boolean value) {
-    if (!value) {
-      this.gatewayNmae = null;
-    }
-  }
-
-  public String getUsername() {
-    return this.username;
-  }
-
-  public CommunityUser setUsername(String username) {
-    this.username = username;
-    return this;
-  }
-
-  public void unsetUsername() {
-    this.username = null;
-  }
-
-  /** Returns true if field username is set (has been assigned a value) and false otherwise */
-  public boolean isSetUsername() {
-    return this.username != null;
-  }
-
-  public void setUsernameIsSet(boolean value) {
-    if (!value) {
-      this.username = null;
-    }
-  }
-
-  public String getUserEmail() {
-    return this.userEmail;
-  }
-
-  public CommunityUser setUserEmail(String userEmail) {
-    this.userEmail = userEmail;
-    return this;
-  }
-
-  public void unsetUserEmail() {
-    this.userEmail = null;
-  }
-
-  /** Returns true if field userEmail is set (has been assigned a value) and false otherwise */
-  public boolean isSetUserEmail() {
-    return this.userEmail != null;
-  }
-
-  public void setUserEmailIsSet(boolean value) {
-    if (!value) {
-      this.userEmail = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case GATEWAY_NMAE:
-      if (value == null) {
-        unsetGatewayNmae();
-      } else {
-        setGatewayNmae((String)value);
-      }
-      break;
-
-    case USERNAME:
-      if (value == null) {
-        unsetUsername();
-      } else {
-        setUsername((String)value);
-      }
-      break;
-
-    case USER_EMAIL:
-      if (value == null) {
-        unsetUserEmail();
-      } else {
-        setUserEmail((String)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case GATEWAY_NMAE:
-      return getGatewayNmae();
-
-    case USERNAME:
-      return getUsername();
-
-    case USER_EMAIL:
-      return getUserEmail();
-
-    }
-    throw new IllegalStateException();
-  }
-
-  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
-    switch (field) {
-    case GATEWAY_NMAE:
-      return isSetGatewayNmae();
-    case USERNAME:
-      return isSetUsername();
-    case USER_EMAIL:
-      return isSetUserEmail();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof CommunityUser)
-      return this.equals((CommunityUser)that);
-    return false;
-  }
-
-  public boolean equals(CommunityUser that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_gatewayNmae = true && this.isSetGatewayNmae();
-    boolean that_present_gatewayNmae = true && that.isSetGatewayNmae();
-    if (this_present_gatewayNmae || that_present_gatewayNmae) {
-      if (!(this_present_gatewayNmae && that_present_gatewayNmae))
-        return false;
-      if (!this.gatewayNmae.equals(that.gatewayNmae))
-        return false;
-    }
-
-    boolean this_present_username = true && this.isSetUsername();
-    boolean that_present_username = true && that.isSetUsername();
-    if (this_present_username || that_present_username) {
-      if (!(this_present_username && that_present_username))
-        return false;
-      if (!this.username.equals(that.username))
-        return false;
-    }
-
-    boolean this_present_userEmail = true && this.isSetUserEmail();
-    boolean that_present_userEmail = true && that.isSetUserEmail();
-    if (this_present_userEmail || that_present_userEmail) {
-      if (!(this_present_userEmail && that_present_userEmail))
-        return false;
-      if (!this.userEmail.equals(that.userEmail))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return 0;
-  }
-
-  @Override
-  public int compareTo(CommunityUser other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-
-    lastComparison = Boolean.valueOf(isSetGatewayNmae()).compareTo(other.isSetGatewayNmae());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetGatewayNmae()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayNmae, other.gatewayNmae);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetUsername()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetUserEmail()).compareTo(other.isSetUserEmail());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetUserEmail()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userEmail, other.userEmail);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
-  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-  }
-
-  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("CommunityUser(");
-    boolean first = true;
-
-    sb.append("gatewayNmae:");
-    if (this.gatewayNmae == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.gatewayNmae);
-    }
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("username:");
-    if (this.username == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.username);
-    }
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("userEmail:");
-    if (this.userEmail == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.userEmail);
-    }
-    first = false;
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    if (gatewayNmae == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayNmae' was not present! Struct: " + toString());
-    }
-    if (username == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
-    }
-    if (userEmail == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'userEmail' was not present! Struct: " + toString());
-    }
-    // check for sub-struct validity
-  }
-
-  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-    try {
-      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-    try {
-      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private static class CommunityUserStandardSchemeFactory implements SchemeFactory {
-    public CommunityUserStandardScheme getScheme() {
-      return new CommunityUserStandardScheme();
-    }
-  }
-
-  private static class CommunityUserStandardScheme extends StandardScheme<CommunityUser> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, CommunityUser struct) throws org.apache.thrift.TException {
-      org.apache.thrift.protocol.TField schemeField;
-      iprot.readStructBegin();
-      while (true)
-      {
-        schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-          break;
-        }
-        switch (schemeField.id) {
-          case 1: // GATEWAY_NMAE
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.gatewayNmae = iprot.readString();
-              struct.setGatewayNmaeIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 2: // USERNAME
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.username = iprot.readString();
-              struct.setUsernameIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 3: // USER_EMAIL
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.userEmail = iprot.readString();
-              struct.setUserEmailIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          default:
-            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-        }
-        iprot.readFieldEnd();
-      }
-      iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
-      struct.validate();
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot, CommunityUser struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.gatewayNmae != null) {
-        oprot.writeFieldBegin(GATEWAY_NMAE_FIELD_DESC);
-        oprot.writeString(struct.gatewayNmae);
-        oprot.writeFieldEnd();
-      }
-      if (struct.username != null) {
-        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
-        oprot.writeString(struct.username);
-        oprot.writeFieldEnd();
-      }
-      if (struct.userEmail != null) {
-        oprot.writeFieldBegin(USER_EMAIL_FIELD_DESC);
-        oprot.writeString(struct.userEmail);
-        oprot.writeFieldEnd();
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class CommunityUserTupleSchemeFactory implements SchemeFactory {
-    public CommunityUserTupleScheme getScheme() {
-      return new CommunityUserTupleScheme();
-    }
-  }
-
-  private static class CommunityUserTupleScheme extends TupleScheme<CommunityUser> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, CommunityUser struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      oprot.writeString(struct.gatewayNmae);
-      oprot.writeString(struct.username);
-      oprot.writeString(struct.userEmail);
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, CommunityUser struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      struct.gatewayNmae = iprot.readString();
-      struct.setGatewayNmaeIsSet(true);
-      struct.username = iprot.readString();
-      struct.setUsernameIsSet(true);
-      struct.userEmail = iprot.readString();
-      struct.setUserEmailIsSet(true);
-    }
-  }
-
-}
-