Repository: airavata
Updated Branches:
  refs/heads/develop 3bb7f493d -> 421a44147


removing gateway credentials


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

Branch: refs/heads/develop
Commit: 421a441470e96dd08d8bd31ce4a7b3b2dab454c7
Parents: 3bb7f49
Author: scnakandala <[email protected]>
Authored: Sun May 1 20:43:13 2016 -0400
Committer: scnakandala <[email protected]>
Committed: Sun May 1 20:43:13 2016 -0400

----------------------------------------------------------------------
 .../core/app/catalog/impl/AppCatalogImpl.java   |   7 +-
 .../catalog/impl/GwyClientCredentialImpl.java   | 104 -----
 .../catalog/model/GatewayClientCredential.java  |  63 ---
 .../GatewayClientCredentialResource.java        | 389 -------------------
 .../app/catalog/util/AppCatalogJPAUtils.java    |  17 -
 .../catalog/util/AppCatalogResourceType.java    |   1 -
 .../src/main/resources/META-INF/persistence.xml |   1 -
 .../src/main/resources/appcatalog-derby.sql     |   8 -
 .../src/main/resources/appcatalog-mysql.sql     |   8 -
 .../catalog/GatewayClientCredentialTest.java    |  69 ----
 .../airavata/registry/cpi/AppCatalog.java       |   7 -
 11 files changed, 1 insertion(+), 673 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogImpl.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogImpl.java
index 60d4033..c6203bb 100644
--- 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogImpl.java
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogImpl.java
@@ -51,12 +51,7 @@ public class AppCatalogImpl implements AppCatalog {
        public GwyResourceProfile getGatewayProfile() throws 
AppCatalogException {
                return new GwyResourceProfileImpl();
        }
-
-    @Override
-    public GwyClientCredential getGatewayClientCredential() throws 
AppCatalogException {
-        return new GwyClientCredentialImpl();
-    }
-
+    
     @Override
     public WorkflowCatalog getWorkflowCatalog() throws AppCatalogException {
         return new WorkflowCatalogImpl();

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyClientCredentialImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyClientCredentialImpl.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyClientCredentialImpl.java
deleted file mode 100644
index e96fc9e..0000000
--- 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyClientCredentialImpl.java
+++ /dev/null
@@ -1,104 +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.registry.core.app.catalog.impl;
-
-import 
org.apache.airavata.registry.core.app.catalog.resources.AppCatAbstractResource;
-import 
org.apache.airavata.registry.core.app.catalog.resources.AppCatalogResource;
-import 
org.apache.airavata.registry.core.app.catalog.resources.GatewayClientCredentialResource;
-import org.apache.airavata.registry.cpi.AppCatalogException;
-import org.apache.airavata.registry.cpi.GwyClientCredential;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-public class GwyClientCredentialImpl implements GwyClientCredential {
-    private final static Logger logger = 
LoggerFactory.getLogger(GwyClientCredentialImpl.class);
-
-    @Override
-    public Map.Entry<String, String> generateNewGatewayClientCredential(String 
gatewayId) throws AppCatalogException {
-        try {
-            GatewayClientCredentialResource gatewayClientCredentialResource = 
new GatewayClientCredentialResource();
-            
gatewayClientCredentialResource.setClientKey(UUID.randomUUID().toString());
-            
gatewayClientCredentialResource.setClientSecret(UUID.randomUUID().toString());
-            gatewayClientCredentialResource.setGatewayId(gatewayId);
-            gatewayClientCredentialResource.save();
-
-            Map.Entry<String, String> apiCred = new 
AbstractMap.SimpleEntry<>(gatewayClientCredentialResource.getClientKey(),
-                    gatewayClientCredentialResource.getClientSecret());
-            return apiCred;
-        } catch (AppCatalogException e) {
-            logger.error("Error while creating new gateway client 
credential...", e);
-            throw new AppCatalogException(e);
-        }
-    }
-
-    @Override
-    public Map.Entry<String, String>  getGatewayClientCredential(String 
clientKey) throws AppCatalogException {
-        try {
-            GatewayClientCredentialResource gatewayClientCredentialResource = 
new GatewayClientCredentialResource();
-            gatewayClientCredentialResource = 
(GatewayClientCredentialResource)gatewayClientCredentialResource.get(clientKey);
-            if(gatewayClientCredentialResource != null) {
-                Map.Entry<String, String> apiCred = new 
AbstractMap.SimpleEntry<>(gatewayClientCredentialResource.getClientKey(),
-                        gatewayClientCredentialResource.getClientSecret());
-                return apiCred;
-            }else{
-                return null;
-            }
-        } catch (AppCatalogException e) {
-            logger.error("Error while retrieving gateway client 
credential...", e);
-            throw new AppCatalogException(e);
-        }
-    }
-
-    @Override
-    public void removeGatewayClientCredential(String clientKey) throws 
AppCatalogException {
-        try {
-            GatewayClientCredentialResource gatewayClientCredentialResource = 
new GatewayClientCredentialResource();
-            gatewayClientCredentialResource.remove(clientKey);
-        } catch (AppCatalogException e) {
-            logger.error("Error while removing gateway client credential...", 
e);
-            throw new AppCatalogException(e);
-        }
-    }
-
-    @Override
-    public Map<String, String> getAllGatewayClientCredentials(String 
gatewayId) throws AppCatalogException {
-        try {
-            GatewayClientCredentialResource gatewayClientCredentialResource = 
new GatewayClientCredentialResource();
-            List<AppCatalogResource> gatewayClientCredentialResources = 
gatewayClientCredentialResource
-                    
.get(AppCatAbstractResource.GatewayClientCredentialConstants.GATEWAY_ID, 
gatewayId);
-            Map<String, String> returnMap = new HashMap<>();
-            if(gatewayClientCredentialResources != null && 
!gatewayClientCredentialResources.isEmpty()) {
-                gatewayClientCredentialResources.stream().forEach(cred->{
-                    GatewayClientCredentialResource gCred = 
(GatewayClientCredentialResource)cred;
-                    returnMap.put(gCred.getClientKey(), 
gCred.getClientSecret());
-                });
-                return returnMap;
-            }else{
-                return null;
-            }
-        } catch (AppCatalogException e) {
-            logger.error("Error while retrieving gateway client 
credentials...", e);
-            throw new AppCatalogException(e);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayClientCredential.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayClientCredential.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayClientCredential.java
deleted file mode 100644
index ae270ae..0000000
--- 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayClientCredential.java
+++ /dev/null
@@ -1,63 +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.registry.core.app.catalog.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "GATEWAY_CLIENT_CREDENTIAL")
-public class GatewayClientCredential implements Serializable {
-    @Id
-    @Column(name = "CLIENT_KEY")
-    private String clientKey;
-
-    @Column(name = "CLIENT_SECRET")
-    private String clientSecret;
-
-    @Column(name = "GATEWAY_ID")
-    private String gatewayId;
-
-    public String getClientKey() {
-        return clientKey;
-    }
-
-    public void setClientKey(String clientKey) {
-        this.clientKey = clientKey;
-    }
-
-    public String getClientSecret() {
-        return clientSecret;
-    }
-
-    public void setClientSecret(String clientSecret) {
-        this.clientSecret = clientSecret;
-    }
-
-    public String getGatewayId() {
-        return gatewayId;
-    }
-
-    public void setGatewayId(String gatewayId) {
-        this.gatewayId = gatewayId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayClientCredentialResource.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayClientCredentialResource.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayClientCredentialResource.java
deleted file mode 100644
index 7321600..0000000
--- 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayClientCredentialResource.java
+++ /dev/null
@@ -1,389 +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.registry.core.app.catalog.resources;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.registry.core.app.catalog.model.ComputeResource;
-import 
org.apache.airavata.registry.core.app.catalog.model.GatewayClientCredential;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils;
-import 
org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator;
-import 
org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.model.Gateway;
-import org.apache.airavata.registry.cpi.AppCatalogException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class GatewayClientCredentialResource extends AppCatAbstractResource {
-       private final static Logger logger = 
LoggerFactory.getLogger(GatewayClientCredentialResource.class);
-       private String clientKey;
-       private String clientSecret;
-       private String gatewayId;
-       private String userName;
-
-       public String getClientKey() {
-               return clientKey;
-       }
-
-       public void setClientKey(String clientKey) {
-               this.clientKey = clientKey;
-       }
-
-       public String getClientSecret() {
-               return clientSecret;
-       }
-
-       public void setClientSecret(String clientSecret) {
-               this.clientSecret = clientSecret;
-       }
-
-       public String getGatewayId() {
-               return gatewayId;
-       }
-
-       public void setGatewayId(String gatewayId) {
-               this.gatewayId = gatewayId;
-       }
-
-       public String getUserName() {
-               return userName;
-       }
-
-       public void setUserName(String userName) {
-               this.userName = userName;
-       }
-
-       @Override
-       public void remove(Object identifier) throws AppCatalogException {
-               EntityManager em = null;
-               try {
-                       em = AppCatalogJPAUtils.getEntityManager();
-                       em.getTransaction().begin();
-                       AppCatalogQueryGenerator generator = new 
AppCatalogQueryGenerator(GATEWAY_CLIENT_CREDENTIAL);
-                       
generator.setParameter(GatewayClientCredentialConstants.CLIENT_KEY, identifier);
-                       Query q = generator.deleteQuery(em);
-                       q.executeUpdate();
-                       em.getTransaction().commit();
-            if (em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-               } catch (ApplicationSettingsException e) {
-                       logger.error(e.getMessage(), e);
-                       throw new AppCatalogException(e);
-               } finally {
-                       if (em != null && em.isOpen()) {
-                               if (em.getTransaction().isActive()) {
-                                       em.getTransaction().rollback();
-                               }
-                               em.close();
-                       }
-               }
-       }
-       
-       @Override
-       public AppCatalogResource get(Object identifier) throws 
AppCatalogException {
-               EntityManager em = null;
-               try {
-                       em = AppCatalogJPAUtils.getEntityManager();
-                       em.getTransaction().begin();
-                       AppCatalogQueryGenerator generator = new 
AppCatalogQueryGenerator(GATEWAY_CLIENT_CREDENTIAL);
-                       
generator.setParameter(GatewayClientCredentialConstants.CLIENT_KEY, identifier);
-                       Query q = generator.selectQuery(em);
-                       GatewayClientCredential gatewayClientCredential = 
(GatewayClientCredential) q.getSingleResult();
-                       GatewayClientCredentialResource 
gatewayClientCredentialResource = (GatewayClientCredentialResource)
-                                       
AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_CLIENT_CREDENTIAL,
 gatewayClientCredential);
-                       em.getTransaction().commit();
-            if (em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-                       return gatewayClientCredentialResource;
-               } catch (ApplicationSettingsException e) {
-                       logger.error(e.getMessage(), e);
-                       throw new AppCatalogException(e);
-               } finally {
-                       if (em != null && em.isOpen()) {
-                               if (em.getTransaction().isActive()) {
-                                       em.getTransaction().rollback();
-                               }
-                               em.close();
-                       }
-               }
-       }
-       
-       @Override
-       public List<AppCatalogResource> get(String fieldName, Object value) 
throws AppCatalogException {
-               List<AppCatalogResource> gatewayClientCredentialResources = new 
ArrayList<AppCatalogResource>();
-               EntityManager em = null;
-               try {
-                       em = AppCatalogJPAUtils.getEntityManager();
-                       em.getTransaction().begin();
-                       AppCatalogQueryGenerator generator = new 
AppCatalogQueryGenerator(GATEWAY_CLIENT_CREDENTIAL);
-                       Query q;
-                       if 
((fieldName.equals(GatewayClientCredentialConstants.GATEWAY_ID))) {
-                               generator.setParameter(fieldName, value);
-                               q = generator.selectQuery(em);
-                               List<?> results = q.getResultList();
-                               for (Object result : results) {
-                                       GatewayClientCredential 
gatewayClientCredential = (GatewayClientCredential) result;
-                                       GatewayClientCredentialResource 
gatewayClientCredentialResource = (GatewayClientCredentialResource)
-                                                       
AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_CLIENT_CREDENTIAL,
 gatewayClientCredential);
-                                       
gatewayClientCredentialResources.add(gatewayClientCredentialResource);
-                               }
-                       } else {
-                               em.getTransaction().commit();
-                if (em.isOpen()) {
-                    if (em.getTransaction().isActive()){
-                        em.getTransaction().rollback();
-                    }
-                    em.close();
-                }
-                               logger.error("Unsupported field name for 
Gateway Client Credential Resource.", new IllegalArgumentException());
-                               throw new IllegalArgumentException("Unsupported 
field name for Gateway Client Credential Resource.");
-                       }
-                       em.getTransaction().commit();
-            if (em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-               } catch (ApplicationSettingsException e) {
-                       logger.error(e.getMessage(), e);
-                       throw new AppCatalogException(e);
-               } finally {
-                       if (em != null && em.isOpen()) {
-                               if (em.getTransaction().isActive()) {
-                                       em.getTransaction().rollback();
-                               }
-                               em.close();
-                       }
-               }
-               return gatewayClientCredentialResources;
-       }
-
-    @Override
-    public List<AppCatalogResource> getAll() throws AppCatalogException {
-        List<AppCatalogResource> computeResourceResources = new 
ArrayList<AppCatalogResource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new 
AppCatalogQueryGenerator(COMPUTE_RESOURCE);
-            Query q = generator.selectQuery(em);
-            List<?> results = q.getResultList();
-            for (Object result : results) {
-                ComputeResource computeResource = (ComputeResource) result;
-                GatewayClientCredentialResource computeResourceResource = 
(GatewayClientCredentialResource) 
AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, 
computeResource);
-                computeResourceResources.add(computeResourceResource);
-            }
-            em.getTransaction().commit();
-            if (em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return computeResourceResources;
-    }
-
-    @Override
-    public List<String> getAllIds() throws AppCatalogException {
-        List<String> gatewayClientCredentials = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new 
AppCatalogQueryGenerator(GATEWAY_CLIENT_CREDENTIAL);
-            Query q = generator.selectQuery(em);
-            List<?> results = q.getResultList();
-            for (Object result : results) {
-                GatewayClientCredential gatewayClientCredential = 
(GatewayClientCredential) result;
-                
gatewayClientCredentials.add(gatewayClientCredential.getClientKey());
-            }
-            em.getTransaction().commit();
-            if (em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return gatewayClientCredentials;
-    }
-
-    @Override
-       public List<String> getIds(String fieldName, Object value) throws 
AppCatalogException {
-               List<String> computeResourceResourceIDs = new 
ArrayList<String>();
-               EntityManager em = null;
-               try {
-                       em = AppCatalogJPAUtils.getEntityManager();
-                       em.getTransaction().begin();
-                       AppCatalogQueryGenerator generator = new 
AppCatalogQueryGenerator(GATEWAY_CLIENT_CREDENTIAL);
-                       Query q;
-                       if 
((fieldName.equals(GatewayClientCredentialConstants.GATEWAY_ID))) {
-                               generator.setParameter(fieldName, value);
-                               q = generator.selectQuery(em);
-                               List<?> results = q.getResultList();
-                               for (Object result : results) {
-                                       GatewayClientCredential 
gatewayClientCredential = (GatewayClientCredential) result;
-                                       
computeResourceResourceIDs.add(gatewayClientCredential.getClientKey());
-                               }
-                       } else {
-                               em.getTransaction().commit();
-                if (em.isOpen()) {
-                    if (em.getTransaction().isActive()){
-                        em.getTransaction().rollback();
-                    }
-                    em.close();
-                }
-                               logger.error("Unsupported field name for 
Gateway Client Credential Resource.", new IllegalArgumentException());
-                               throw new IllegalArgumentException("Unsupported 
field name for Gateway Client Credential Resource.");
-                       }
-                       em.getTransaction().commit();
-            if (em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-               } catch (ApplicationSettingsException e) {
-                       logger.error(e.getMessage(), e);
-                       throw new AppCatalogException(e);
-               } finally {
-                       if (em != null && em.isOpen()) {
-                               if (em.getTransaction().isActive()) {
-                                       em.getTransaction().rollback();
-                               }
-                               em.close();
-                       }
-               }
-               return computeResourceResourceIDs;
-       }
-       
-       @Override
-       public void save() throws AppCatalogException {
-               EntityManager em = null;
-               try {
-                       em = AppCatalogJPAUtils.getEntityManager();
-                       GatewayClientCredential existingGatewayClientCredential 
= em.find(GatewayClientCredential.class, clientKey);
-            if (em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-
-                       GatewayClientCredential gatewayClientCredential;
-                       em = AppCatalogJPAUtils.getEntityManager();
-                       em.getTransaction().begin();
-                       if (existingGatewayClientCredential == null) {
-                               gatewayClientCredential = new 
GatewayClientCredential();
-                       } else {
-                               gatewayClientCredential = 
existingGatewayClientCredential;
-                       }
-                       gatewayClientCredential.setClientKey(clientKey);
-                       gatewayClientCredential.setClientSecret(clientSecret);
-                       gatewayClientCredential.setGatewayId(gatewayId);
-                       if (existingGatewayClientCredential == null) {
-                               em.persist(gatewayClientCredential);
-                       } else {
-                               em.merge(gatewayClientCredential);
-                       }
-                       em.getTransaction().commit();
-            if (em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-               } catch (Exception e) {
-                       logger.error(e.getMessage(), e);
-                       throw new AppCatalogException(e);
-               } finally {
-                       if (em != null && em.isOpen()) {
-                               if (em.getTransaction().isActive()) {
-                                       em.getTransaction().rollback();
-                               }
-                               em.close();
-                       }
-               }
-       }
-       
-       @Override
-       public boolean isExists(Object identifier) throws AppCatalogException {
-               EntityManager em = null;
-               try {
-                       em = AppCatalogJPAUtils.getEntityManager();
-                       GatewayClientCredential gatewayClientCredential = 
em.find(GatewayClientCredential.class, identifier);
-            if (em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-                       return gatewayClientCredential != null;
-               } catch (ApplicationSettingsException e) {
-                       logger.error(e.getMessage(), e);
-                       throw new AppCatalogException(e);
-               } finally {
-                       if (em != null && em.isOpen()) {
-                               if (em.getTransaction().isActive()) {
-                                       em.getTransaction().rollback();
-                               }
-                               em.close();
-                       }
-               }
-       }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
index 7f711c9..ef14eed 100644
--- 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
@@ -377,13 +377,6 @@ public class AppCatalogJPAUtils {
                     logger.error("Object should be a Module Load Cmd.", new 
IllegalArgumentException());
                     throw new IllegalArgumentException("Object should be a 
Module Load Cmd.");
                 }
-            case GATEWAY_CLIENT_CREDENTIAL:
-                if (o instanceof GatewayClientCredential) {
-                    return 
createGatewayClientCredential((GatewayClientCredential) o);
-                } else {
-                    logger.error("Object should be a Gateway Client 
Credential.", new IllegalArgumentException());
-                    throw new IllegalArgumentException("Object should be a 
Gateway Client Credential.");
-                }
             default:
                 logger.error("Illegal data type..", new 
IllegalArgumentException());
                 throw new IllegalArgumentException("Illegal data type..");
@@ -848,16 +841,6 @@ public class AppCatalogJPAUtils {
         return resource;
     }
 
-    private static AppCatalogResource 
createGatewayClientCredential(GatewayClientCredential o) {
-        GatewayClientCredentialResource resource = new 
GatewayClientCredentialResource();
-        if (o != null) {
-            resource.setClientKey(o.getClientKey());
-            resource.setClientSecret(o.getClientSecret());
-            resource.setGatewayId(o.getGatewayId());
-        }
-        return resource;
-    }
-
     private static AppCatalogResource createGatewayProfile(GatewayProfile o) {
         GatewayProfileResource resource = new GatewayProfileResource();
         if (o != null) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java
index df66757..b26560a 100644
--- 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java
@@ -64,5 +64,4 @@ public enum AppCatalogResourceType {
        LOCAL_DATA_MOVEMENT,
     MODULE_LOAD_CMD,
     ClOUD_SUBMISSION,
-    GATEWAY_CLIENT_CREDENTIAL,
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml 
b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
index 150cf55..e502ae2 100644
--- a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
+++ b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
@@ -63,7 +63,6 @@
         
<class>org.apache.airavata.registry.core.app.catalog.model.LocalSubmission</class>
         
<class>org.apache.airavata.registry.core.app.catalog.model.LocalDataMovement</class>
         
<class>org.apache.airavata.registry.core.app.catalog.model.Configuration</class>
-        
<class>org.apache.airavata.registry.core.app.catalog.model.GatewayClientCredential</class>
         <exclude-unlisted-classes>true</exclude-unlisted-classes>
     </persistence-unit>
     <persistence-unit name="experiment_data">

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql 
b/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
index 96e0839..61d06a2 100644
--- a/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
+++ b/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
@@ -508,14 +508,6 @@ CREATE TABLE CONFIGURATION
         PRIMARY KEY(CONFIG_KEY, CONFIG_VAL)
 );
 
-CREATE TABLE GATEWAY_CLIENT_CREDENTIAL
-(
-        CLIENT_KEY VARCHAR(255),
-        CLIENT_SECRET VARCHAR(255),
-        GATEWAY_ID VARCHAR(255),
-        PRIMARY KEY(CLIENT_KEY)
-);
-
 INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) 
VALUES('app_catalog_version', '0.16');
 
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql 
b/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
index 34a0e9a..545ca5c 100644
--- a/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
+++ b/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
@@ -504,13 +504,5 @@ CREATE TABLE CONFIGURATION
           PRIMARY KEY(CONFIG_KEY, CONFIG_VAL)
 );
 
-CREATE TABLE GATEWAY_CLIENT_CREDENTIAL
-(
-        CLIENT_KEY VARCHAR(255),
-        CLIENT_SECRET VARCHAR(255),
-        GATEWAY_ID VARCHAR(255),
-        PRIMARY KEY(CLIENT_KEY)
-);
-
 INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) 
VALUES('app_catalog_version', '0.16');
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/GatewayClientCredentialTest.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/GatewayClientCredentialTest.java
 
b/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/GatewayClientCredentialTest.java
deleted file mode 100644
index a73db33..0000000
--- 
a/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/GatewayClientCredentialTest.java
+++ /dev/null
@@ -1,69 +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.app.catalog;
-
-import junit.framework.Assert;
-import org.apache.airavata.app.catalog.util.Initialize;
-import 
org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.*;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Map;
-
-public class GatewayClientCredentialTest {
-    private static Initialize initialize;
-    private static AppCatalog appcatalog;
-    private static final Logger logger = 
LoggerFactory.getLogger(GatewayClientCredentialTest.class);
-
-    @Before
-    public void setUp() {
-        try {
-            initialize = new Initialize("appcatalog-derby.sql");
-            initialize.initializeDB();
-            appcatalog = RegistryFactory.getAppCatalog();
-        } catch (AppCatalogException e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        System.out.println("********** TEAR DOWN ************");
-        initialize.stopDerbyServer();
-    }
-
-    @Test
-    public void gatewayProfileTest() throws Exception {
-        GwyClientCredential gatewayClientCredential = 
appcatalog.getGatewayClientCredential();
-        Map.Entry<String, String> cred = 
gatewayClientCredential.generateNewGatewayClientCredential("default");
-        Assert.assertNotNull(cred.getKey());
-        gatewayClientCredential.removeGatewayClientCredential(cred.getKey());
-        
Assert.assertNull(gatewayClientCredential.getAllGatewayClientCredentials("default"));
-        
appcatalog.getGatewayClientCredential().generateNewGatewayClientCredential("default");
-        
Assert.assertNotNull(gatewayClientCredential.getAllGatewayClientCredentials("default"));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/421a4414/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/AppCatalog.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/AppCatalog.java
 
b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/AppCatalog.java
index dc2132d..0f7c2c9 100644
--- 
a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/AppCatalog.java
+++ 
b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/AppCatalog.java
@@ -52,13 +52,6 @@ public interface AppCatalog {
     GwyResourceProfile getGatewayProfile() throws AppCatalogException;
 
     /**
-     * Get Gateway Client Credential Interface
-     * @return Gateway client credential interface
-     * @throws AppCatalogException
-     */
-    GwyClientCredential getGatewayClientCredential() throws 
AppCatalogException;
-
-    /**
      * Get workflow catalog interface
      * @return workflow catalog interface
      * @throws AppCatalogException

Reply via email to