You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2014/07/22 18:51:35 UTC
[2/2] git commit: removing app catalog database from previous registry
removing app catalog database from previous registry
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/10103a44
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/10103a44
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/10103a44
Branch: refs/heads/master
Commit: 10103a44594ad0c4d11e7416da3e96d4991be4e1
Parents: d5b1b2d
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Tue Jul 22 12:51:27 2014 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Tue Jul 22 12:51:27 2014 -0400
----------------------------------------------------------------------
.../src/test/resources/registry-derby.sql | 35 -
.../src/test/resources/registry-derby.sql | 35 -
.../src/test/resources/registry-derby.sql | 35 -
.../persistance/registry/jpa/ResourceType.java | 3 -
.../registry/jpa/impl/AiravataJPARegistry.java | 682 +++++++++----------
.../jpa/model/Application_Descriptor.java | 110 ---
.../jpa/model/Application_Descriptor_PK.java | 65 --
.../registry/jpa/model/Host_Descriptor.java | 88 ---
.../registry/jpa/model/Host_Descriptor_PK.java | 64 --
.../registry/jpa/model/Service_Descriptor.java | 90 ---
.../jpa/model/Service_Descriptor_PK.java | 64 --
.../jpa/resources/AbstractResource.java | 29 -
.../ApplicationDescriptorResource.java | 283 --------
.../registry/jpa/resources/GatewayResource.java | 333 ---------
.../jpa/resources/HostDescriptorResource.java | 257 -------
.../resources/ServiceDescriptorResource.java | 185 -----
.../registry/jpa/resources/Utils.java | 81 ---
.../src/main/resources/META-INF/persistence.xml | 3 -
.../src/main/resources/registry-derby.sql | 35 -
.../src/main/resources/registry-mysql.sql | 35 -
.../jpa/ApplicationDescriptorResourceTest.java | 58 --
.../registry/jpa/GatewayResourceTest.java | 44 --
.../jpa/HostDescriptorResourceTest.java | 59 --
.../jpa/ServiceDescriptorResourceTest.java | 59 --
.../src/test/resources/registry-derby.sql | 35 -
25 files changed, 341 insertions(+), 2426 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/gfac/airavata-gfac-service/src/test/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/resources/registry-derby.sql b/modules/gfac/airavata-gfac-service/src/test/resources/registry-derby.sql
index 05c4667..9ed5ca9 100644
--- a/modules/gfac/airavata-gfac-service/src/test/resources/registry-derby.sql
+++ b/modules/gfac/airavata-gfac-service/src/test/resources/registry-derby.sql
@@ -101,41 +101,6 @@ CREATE TABLE USER_WORKFLOW
FOREIGN KEY (OWNER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
);
-CREATE TABLE HOST_DESCRIPTOR
-(
- GATEWAY_NAME VARCHAR(255),
- UPDATED_USER VARCHAR(255),
- HOST_DESCRIPTOR_ID VARCHAR(255),
- HOST_DESCRIPTOR_XML BLOB,
- PRIMARY KEY(GATEWAY_NAME, HOST_DESCRIPTOR_ID),
- FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
- FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE SERVICE_DESCRIPTOR
-(
- GATEWAY_NAME VARCHAR(255),
- UPDATED_USER VARCHAR(255),
- SERVICE_DESCRIPTOR_ID VARCHAR(255),
- SERVICE_DESCRIPTOR_XML BLOB,
- PRIMARY KEY(GATEWAY_NAME,SERVICE_DESCRIPTOR_ID),
- FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
- FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_DESCRIPTOR
-(
- GATEWAY_NAME VARCHAR(255),
- UPDATED_USER VARCHAR(255),
- APPLICATION_DESCRIPTOR_ID VARCHAR(255),
- HOST_DESCRIPTOR_ID VARCHAR(255),
- SERVICE_DESCRIPTOR_ID VARCHAR(255),
- APPLICATION_DESCRIPTOR_XML BLOB,
- PRIMARY KEY(GATEWAY_NAME,APPLICATION_DESCRIPTOR_ID),
- FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
- FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
CREATE TABLE EXPERIMENT
(
EXPERIMENT_ID VARCHAR(255),
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/orchestrator/airavata-orchestrator-service/src/test/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/registry-derby.sql b/modules/orchestrator/airavata-orchestrator-service/src/test/resources/registry-derby.sql
index 05c4667..9ed5ca9 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/registry-derby.sql
+++ b/modules/orchestrator/airavata-orchestrator-service/src/test/resources/registry-derby.sql
@@ -101,41 +101,6 @@ CREATE TABLE USER_WORKFLOW
FOREIGN KEY (OWNER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
);
-CREATE TABLE HOST_DESCRIPTOR
-(
- GATEWAY_NAME VARCHAR(255),
- UPDATED_USER VARCHAR(255),
- HOST_DESCRIPTOR_ID VARCHAR(255),
- HOST_DESCRIPTOR_XML BLOB,
- PRIMARY KEY(GATEWAY_NAME, HOST_DESCRIPTOR_ID),
- FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
- FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE SERVICE_DESCRIPTOR
-(
- GATEWAY_NAME VARCHAR(255),
- UPDATED_USER VARCHAR(255),
- SERVICE_DESCRIPTOR_ID VARCHAR(255),
- SERVICE_DESCRIPTOR_XML BLOB,
- PRIMARY KEY(GATEWAY_NAME,SERVICE_DESCRIPTOR_ID),
- FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
- FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_DESCRIPTOR
-(
- GATEWAY_NAME VARCHAR(255),
- UPDATED_USER VARCHAR(255),
- APPLICATION_DESCRIPTOR_ID VARCHAR(255),
- HOST_DESCRIPTOR_ID VARCHAR(255),
- SERVICE_DESCRIPTOR_ID VARCHAR(255),
- APPLICATION_DESCRIPTOR_XML BLOB,
- PRIMARY KEY(GATEWAY_NAME,APPLICATION_DESCRIPTOR_ID),
- FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
- FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
CREATE TABLE EXPERIMENT
(
EXPERIMENT_ID VARCHAR(255),
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/orchestrator/orchestrator-core/src/test/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/resources/registry-derby.sql b/modules/orchestrator/orchestrator-core/src/test/resources/registry-derby.sql
index 05c4667..9ed5ca9 100644
--- a/modules/orchestrator/orchestrator-core/src/test/resources/registry-derby.sql
+++ b/modules/orchestrator/orchestrator-core/src/test/resources/registry-derby.sql
@@ -101,41 +101,6 @@ CREATE TABLE USER_WORKFLOW
FOREIGN KEY (OWNER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
);
-CREATE TABLE HOST_DESCRIPTOR
-(
- GATEWAY_NAME VARCHAR(255),
- UPDATED_USER VARCHAR(255),
- HOST_DESCRIPTOR_ID VARCHAR(255),
- HOST_DESCRIPTOR_XML BLOB,
- PRIMARY KEY(GATEWAY_NAME, HOST_DESCRIPTOR_ID),
- FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
- FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE SERVICE_DESCRIPTOR
-(
- GATEWAY_NAME VARCHAR(255),
- UPDATED_USER VARCHAR(255),
- SERVICE_DESCRIPTOR_ID VARCHAR(255),
- SERVICE_DESCRIPTOR_XML BLOB,
- PRIMARY KEY(GATEWAY_NAME,SERVICE_DESCRIPTOR_ID),
- FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
- FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_DESCRIPTOR
-(
- GATEWAY_NAME VARCHAR(255),
- UPDATED_USER VARCHAR(255),
- APPLICATION_DESCRIPTOR_ID VARCHAR(255),
- HOST_DESCRIPTOR_ID VARCHAR(255),
- SERVICE_DESCRIPTOR_ID VARCHAR(255),
- APPLICATION_DESCRIPTOR_XML BLOB,
- PRIMARY KEY(GATEWAY_NAME,APPLICATION_DESCRIPTOR_ID),
- FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
- FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
CREATE TABLE EXPERIMENT
(
EXPERIMENT_ID VARCHAR(255),
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
index 1e0736b..07f423f 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
@@ -25,11 +25,8 @@ public enum ResourceType {
PROJECT,
USER,
PROJECT_USER,
- SERVICE_DESCRIPTOR,
PUBLISHED_WORKFLOW,
USER_WORKFLOW,
- HOST_DESCRIPTOR,
- APPLICATION_DESCRIPTOR,
CONFIGURATION,
GATEWAY_WORKER,
EXPERIMENT,
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
index 1a56a49..ae28829 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
@@ -461,123 +461,123 @@ public class AiravataJPARegistry extends AiravataRegistry2{
/**---------------------------------Descriptor Registry----------------------------------**/
public boolean isHostDescriptorExists(String descriptorName)throws RegException {
- if (descriptorRegistry != null){
- return descriptorRegistry.isHostDescriptorExists(descriptorName);
- }
- try {
- return jpa.getGateway().isHostDescriptorExists(descriptorName);
- } catch (RegistryException e) {
- e.printStackTrace();
- }
+// if (descriptorRegistry != null){
+// return descriptorRegistry.isHostDescriptorExists(descriptorName);
+// }
+// try {
+// return jpa.getGateway().isHostDescriptorExists(descriptorName);
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
return false;
}
public void addHostDescriptor(HostDescription descriptor) throws RegException {
- if (descriptorRegistry != null) {
- descriptorRegistry.addHostDescriptor(descriptor);
- } else {
- try {
- GatewayResource gateway = jpa.getGateway();
- WorkerResource workerResource = jpa.getWorker();
- String hostName = descriptor.getType().getHostName();
- if (isHostDescriptorExists(hostName)) {
- throw new DescriptorAlreadyExistsException(hostName);
- }
- HostDescriptorResource hostDescriptorResource = gateway.createHostDescriptorResource(hostName);
- hostDescriptorResource.setUserName(workerResource.getUser());
- hostDescriptorResource.setContent(descriptor.toXML());
- hostDescriptorResource.save();
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null) {
+// descriptorRegistry.addHostDescriptor(descriptor);
+// } else {
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// WorkerResource workerResource = jpa.getWorker();
+// String hostName = descriptor.getType().getHostName();
+// if (isHostDescriptorExists(hostName)) {
+// throw new DescriptorAlreadyExistsException(hostName);
+// }
+// HostDescriptorResource hostDescriptorResource = gateway.createHostDescriptorResource(hostName);
+// hostDescriptorResource.setUserName(workerResource.getUser());
+// hostDescriptorResource.setContent(descriptor.toXML());
+// hostDescriptorResource.save();
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
}
public void updateHostDescriptor(HostDescription descriptor) throws RegException {
- if (descriptorRegistry != null) {
- descriptorRegistry.updateHostDescriptor(descriptor);
- } else {
- try {
- GatewayResource gateway = jpa.getGateway();
- String hostName = descriptor.getType().getHostName();
- if (!isHostDescriptorExists(hostName)) {
- throw new DescriptorDoesNotExistsException(hostName);
- }
- HostDescriptorResource hostDescriptorResource = gateway.getHostDescriptorResource(hostName);
- hostDescriptorResource.setContent(descriptor.toXML());
- hostDescriptorResource.save();
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null) {
+// descriptorRegistry.updateHostDescriptor(descriptor);
+// } else {
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// String hostName = descriptor.getType().getHostName();
+// if (!isHostDescriptorExists(hostName)) {
+// throw new DescriptorDoesNotExistsException(hostName);
+// }
+// HostDescriptorResource hostDescriptorResource = gateway.getHostDescriptorResource(hostName);
+// hostDescriptorResource.setContent(descriptor.toXML());
+// hostDescriptorResource.save();
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
}
public HostDescription getHostDescriptor(String hostName) throws RegException {
- if (descriptorRegistry != null) {
- return descriptorRegistry.getHostDescriptor(hostName);
- } else {
- try {
-
- GatewayResource gateway = jpa.getGateway();
- if (!isHostDescriptorExists(hostName)) {
- return null;
- }
- HostDescriptorResource hostDescriptorResource = gateway.getHostDescriptorResource(hostName);
- return createHostDescriptor(hostDescriptorResource);
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null) {
+// return descriptorRegistry.getHostDescriptor(hostName);
+// } else {
+// try {
+//
+// GatewayResource gateway = jpa.getGateway();
+// if (!isHostDescriptorExists(hostName)) {
+// return null;
+// }
+// HostDescriptorResource hostDescriptorResource = gateway.getHostDescriptorResource(hostName);
+// return createHostDescriptor(hostDescriptorResource);
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
return null;
}
- private HostDescription createHostDescriptor(
- HostDescriptorResource hostDescriptorResource)
- throws MalformedDescriptorException {
- try {
- return HostDescription.fromXML(hostDescriptorResource.getContent());
- } catch (XmlException e) {
- throw new MalformedDescriptorException(hostDescriptorResource.getHostDescName(),e);
- }
- }
+// private HostDescription createHostDescriptor(
+// HostDescriptorResource hostDescriptorResource)
+// throws MalformedDescriptorException {
+// try {
+// return HostDescription.fromXML(hostDescriptorResource.getContent());
+// } catch (XmlException e) {
+// throw new MalformedDescriptorException(hostDescriptorResource.getHostDescName(),e);
+// }
+// }
public void removeHostDescriptor(String hostName) throws RegException {
- if (descriptorRegistry != null) {
- descriptorRegistry.removeHostDescriptor(hostName);
- } else {
- try {
- GatewayResource gateway = jpa.getGateway();
- if (!isHostDescriptorExists(hostName)) {
- throw new DescriptorDoesNotExistsException(hostName);
- }
- gateway.removeHostDescriptor(hostName);
- //we need to delete the application descriptors bound to this host
- Map<String, ApplicationDescription> applicationDescriptors = getApplicationDescriptorsFromHostName(hostName);
- for (String serviceName : applicationDescriptors.keySet()) {
- removeApplicationDescriptor(serviceName, hostName, applicationDescriptors.get(serviceName).getType().getApplicationName().getStringValue());
- }
- } catch (RegistryException e) {
- logger.error("Error while removing application descriptors bound to host " + hostName, e);
- }
- }
+// if (descriptorRegistry != null) {
+// descriptorRegistry.removeHostDescriptor(hostName);
+// } else {
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// if (!isHostDescriptorExists(hostName)) {
+// throw new DescriptorDoesNotExistsException(hostName);
+// }
+// gateway.removeHostDescriptor(hostName);
+// //we need to delete the application descriptors bound to this host
+// Map<String, ApplicationDescription> applicationDescriptors = getApplicationDescriptorsFromHostName(hostName);
+// for (String serviceName : applicationDescriptors.keySet()) {
+// removeApplicationDescriptor(serviceName, hostName, applicationDescriptors.get(serviceName).getType().getApplicationName().getStringValue());
+// }
+// } catch (RegistryException e) {
+// logger.error("Error while removing application descriptors bound to host " + hostName, e);
+// }
+// }
}
@Override
public List<HostDescription> getHostDescriptors()
throws MalformedDescriptorException, RegException {
- if (descriptorRegistry != null) {
- return descriptorRegistry.getHostDescriptors();
- }
- try {
- GatewayResource gateway = jpa.getGateway();
- List<HostDescription> list = new ArrayList<HostDescription>();
- List<HostDescriptorResource> hostDescriptorResources = gateway.getHostDescriptorResources();
- for (HostDescriptorResource resource : hostDescriptorResources) {
- list.add(createHostDescriptor(resource));
- }
- return list;
- } catch (RegistryException e) {
- logger.error("Error while getting host descriptors ", e);
- }
+// if (descriptorRegistry != null) {
+// return descriptorRegistry.getHostDescriptors();
+// }
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// List<HostDescription> list = new ArrayList<HostDescription>();
+// List<HostDescriptorResource> hostDescriptorResources = gateway.getHostDescriptorResources();
+// for (HostDescriptorResource resource : hostDescriptorResources) {
+// list.add(createHostDescriptor(resource));
+// }
+// return list;
+// } catch (RegistryException e) {
+// logger.error("Error while getting host descriptors ", e);
+// }
return null;
}
@@ -590,124 +590,124 @@ public class AiravataJPARegistry extends AiravataRegistry2{
}
public boolean isServiceDescriptorExists(String descriptorName)throws RegException {
- if (descriptorRegistry != null) {
- return descriptorRegistry.isServiceDescriptorExists(descriptorName);
- }
- try {
- return jpa.getGateway().isServiceDescriptorExists(descriptorName);
- } catch (RegistryException e) {
- e.printStackTrace();
- }
+// if (descriptorRegistry != null) {
+// return descriptorRegistry.isServiceDescriptorExists(descriptorName);
+// }
+// try {
+// return jpa.getGateway().isServiceDescriptorExists(descriptorName);
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
return false;
}
public void addServiceDescriptor(ServiceDescription descriptor) throws RegException {
- if (descriptorRegistry != null) {
- descriptorRegistry.addServiceDescriptor(descriptor);
- }else {
- try {
- GatewayResource gateway = jpa.getGateway();
- WorkerResource workerResource = jpa.getWorker();
- String serviceName = descriptor.getType().getName();
- if (isServiceDescriptorExists(serviceName)){
- throw new DescriptorAlreadyExistsException(serviceName);
- }
- ServiceDescriptorResource serviceDescriptorResource = gateway.createServiceDescriptorResource(serviceName);
- serviceDescriptorResource.setUserName(workerResource.getUser());
- serviceDescriptorResource.setContent(descriptor.toXML());
- serviceDescriptorResource.save();
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null) {
+// descriptorRegistry.addServiceDescriptor(descriptor);
+// }else {
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// WorkerResource workerResource = jpa.getWorker();
+// String serviceName = descriptor.getType().getName();
+// if (isServiceDescriptorExists(serviceName)){
+// throw new DescriptorAlreadyExistsException(serviceName);
+// }
+// ServiceDescriptorResource serviceDescriptorResource = gateway.createServiceDescriptorResource(serviceName);
+// serviceDescriptorResource.setUserName(workerResource.getUser());
+// serviceDescriptorResource.setContent(descriptor.toXML());
+// serviceDescriptorResource.save();
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
}
public void updateServiceDescriptor(ServiceDescription descriptor) throws RegException {
- if (descriptorRegistry != null) {
- descriptorRegistry.updateServiceDescriptor(descriptor);
- }else {
- try {
- GatewayResource gateway = jpa.getGateway();
- String serviceName = descriptor.getType().getName();
- if (!isServiceDescriptorExists(serviceName)){
- throw new DescriptorDoesNotExistsException(serviceName);
- }
- ServiceDescriptorResource serviceDescriptorResource = gateway.getServiceDescriptorResource(serviceName);
- serviceDescriptorResource.setContent(descriptor.toXML());
- serviceDescriptorResource.save();
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null) {
+// descriptorRegistry.updateServiceDescriptor(descriptor);
+// }else {
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// String serviceName = descriptor.getType().getName();
+// if (!isServiceDescriptorExists(serviceName)){
+// throw new DescriptorDoesNotExistsException(serviceName);
+// }
+// ServiceDescriptorResource serviceDescriptorResource = gateway.getServiceDescriptorResource(serviceName);
+// serviceDescriptorResource.setContent(descriptor.toXML());
+// serviceDescriptorResource.save();
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
}
public ServiceDescription getServiceDescriptor(String serviceName) throws RegException, MalformedDescriptorException {
- if (descriptorRegistry != null) {
- return descriptorRegistry.getServiceDescriptor(serviceName);
- } else {
- try {
- GatewayResource gateway = jpa.getGateway();
- if (!gateway.isServiceDescriptorExists(serviceName)) {
- return null;
- }
- ServiceDescriptorResource serviceDescriptorResource = gateway.getServiceDescriptorResource(serviceName);
- return createServiceDescriptor(serviceDescriptorResource);
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null) {
+// return descriptorRegistry.getServiceDescriptor(serviceName);
+// } else {
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// if (!gateway.isServiceDescriptorExists(serviceName)) {
+// return null;
+// }
+// ServiceDescriptorResource serviceDescriptorResource = gateway.getServiceDescriptorResource(serviceName);
+// return createServiceDescriptor(serviceDescriptorResource);
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
return null;
}
- private ServiceDescription createServiceDescriptor(
- ServiceDescriptorResource serviceDescriptorResource)
- throws MalformedDescriptorException {
- try {
- return ServiceDescription.fromXML(serviceDescriptorResource.getContent());
- } catch (XmlException e) {
- throw new MalformedDescriptorException(serviceDescriptorResource.getServiceDescName(),e);
- }
- }
+// private ServiceDescription createServiceDescriptor(
+// ServiceDescriptorResource serviceDescriptorResource)
+// throws MalformedDescriptorException {
+// try {
+// return ServiceDescription.fromXML(serviceDescriptorResource.getContent());
+// } catch (XmlException e) {
+// throw new MalformedDescriptorException(serviceDescriptorResource.getServiceDescName(),e);
+// }
+// }
public void removeServiceDescriptor(String serviceName) throws RegException {
- if (descriptorRegistry != null) {
- descriptorRegistry.removeServiceDescriptor(serviceName);
- } else {
- try {
- GatewayResource gateway = jpa.getGateway();
- if (!isServiceDescriptorExists(serviceName)) {
- throw new DescriptorDoesNotExistsException(serviceName);
- }
- gateway.removeServiceDescriptor(serviceName);
- //we need to delete the application descriptors bound to this service
- Map<String, ApplicationDescription> applicationDescriptors = getApplicationDescriptors(serviceName);
- for (String hostName : applicationDescriptors.keySet()) {
- removeApplicationDescriptor(serviceName, hostName, applicationDescriptors.get(hostName).getType().getApplicationName().getStringValue());
- }
- } catch (Exception e) {
- logger.error("Error while removing application descriptors bound to service " + serviceName, e);
- }
- }
+// if (descriptorRegistry != null) {
+// descriptorRegistry.removeServiceDescriptor(serviceName);
+// } else {
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// if (!isServiceDescriptorExists(serviceName)) {
+// throw new DescriptorDoesNotExistsException(serviceName);
+// }
+// gateway.removeServiceDescriptor(serviceName);
+// //we need to delete the application descriptors bound to this service
+// Map<String, ApplicationDescription> applicationDescriptors = getApplicationDescriptors(serviceName);
+// for (String hostName : applicationDescriptors.keySet()) {
+// removeApplicationDescriptor(serviceName, hostName, applicationDescriptors.get(hostName).getType().getApplicationName().getStringValue());
+// }
+// } catch (Exception e) {
+// logger.error("Error while removing application descriptors bound to service " + serviceName, e);
+// }
+// }
}
@Override
public List<ServiceDescription> getServiceDescriptors()
throws MalformedDescriptorException, RegException {
List<ServiceDescription> list=new ArrayList<ServiceDescription>();
- if (descriptorRegistry != null) {
- return descriptorRegistry.getServiceDescriptors();
- }else {
- try {
- GatewayResource gateway = jpa.getGateway();
- List<ServiceDescriptorResource> serviceDescriptorResources = gateway.getServiceDescriptorResources();
- for (ServiceDescriptorResource resource : serviceDescriptorResources) {
- list.add(createServiceDescriptor(resource));
- }
- return list;
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null) {
+// return descriptorRegistry.getServiceDescriptors();
+// }else {
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// List<ServiceDescriptorResource> serviceDescriptorResources = gateway.getServiceDescriptorResources();
+// for (ServiceDescriptorResource resource : serviceDescriptorResources) {
+// list.add(createServiceDescriptor(resource));
+// }
+// return list;
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
return list;
}
@@ -727,15 +727,15 @@ public class AiravataJPARegistry extends AiravataRegistry2{
public boolean isApplicationDescriptorExists(String serviceName,
String hostName,
String descriptorName)throws RegException {
- if (descriptorRegistry != null) {
- return descriptorRegistry.isApplicationDescriptorExists(serviceName, hostName, descriptorName);
- }else {
- try {
- return jpa.getGateway().isApplicationDescriptorExists(createAppName(serviceName, hostName, descriptorName));
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null) {
+// return descriptorRegistry.isApplicationDescriptorExists(serviceName, hostName, descriptorName);
+// }else {
+// try {
+// return jpa.getGateway().isApplicationDescriptorExists(createAppName(serviceName, hostName, descriptorName));
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
return false;
}
@@ -750,178 +750,178 @@ public class AiravataJPARegistry extends AiravataRegistry2{
}
public void addApplicationDescriptor(String serviceName, String hostName, ApplicationDescription descriptor) throws RegException {
- if (descriptorRegistry != null) {
- descriptorRegistry.addApplicationDescriptor(serviceName, hostName, descriptor);
- } else {
- if (serviceName == null || hostName == null) {
- throw new InsufficientDataException("Service name or Host name cannot be null");
- }
- try {
-
- GatewayResource gateway = jpa.getGateway();
- WorkerResource workerResource = jpa.getWorker();
- String applicationName = descriptor.getType().getApplicationName().getStringValue();
- applicationName = createAppName(serviceName, hostName, applicationName);
- if (isApplicationDescriptorExists(serviceName, hostName, descriptor.getType().getApplicationName().getStringValue())) {
- throw new DescriptorAlreadyExistsException(applicationName);
- }
- ApplicationDescriptorResource applicationDescriptorResource = gateway.createApplicationDescriptorResource(applicationName);
- applicationDescriptorResource.setUpdatedUser(workerResource.getUser());
- applicationDescriptorResource.setServiceDescName(serviceName);
- applicationDescriptorResource.setHostDescName(hostName);
- applicationDescriptorResource.setContent(descriptor.toXML());
- applicationDescriptorResource.save();
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null) {
+// descriptorRegistry.addApplicationDescriptor(serviceName, hostName, descriptor);
+// } else {
+// if (serviceName == null || hostName == null) {
+// throw new InsufficientDataException("Service name or Host name cannot be null");
+// }
+// try {
+//
+// GatewayResource gateway = jpa.getGateway();
+// WorkerResource workerResource = jpa.getWorker();
+// String applicationName = descriptor.getType().getApplicationName().getStringValue();
+// applicationName = createAppName(serviceName, hostName, applicationName);
+// if (isApplicationDescriptorExists(serviceName, hostName, descriptor.getType().getApplicationName().getStringValue())) {
+// throw new DescriptorAlreadyExistsException(applicationName);
+// }
+// ApplicationDescriptorResource applicationDescriptorResource = gateway.createApplicationDescriptorResource(applicationName);
+// applicationDescriptorResource.setUpdatedUser(workerResource.getUser());
+// applicationDescriptorResource.setServiceDescName(serviceName);
+// applicationDescriptorResource.setHostDescName(hostName);
+// applicationDescriptorResource.setContent(descriptor.toXML());
+// applicationDescriptorResource.save();
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
}
public void udpateApplicationDescriptor(ServiceDescription serviceDescription,
HostDescription hostDescriptor,
ApplicationDescription descriptor) throws RegException {
- if (descriptorRegistry != null){
- descriptorRegistry.udpateApplicationDescriptor(serviceDescription,hostDescriptor,descriptor);
- } else {
- updateApplicationDescriptor(serviceDescription.getType().getName(),hostDescriptor.getType().getHostName(),descriptor);
- }
+// if (descriptorRegistry != null){
+// descriptorRegistry.udpateApplicationDescriptor(serviceDescription,hostDescriptor,descriptor);
+// } else {
+// updateApplicationDescriptor(serviceDescription.getType().getName(),hostDescriptor.getType().getHostName(),descriptor);
+// }
}
public void updateApplicationDescriptor(String serviceName, String hostName, ApplicationDescription descriptor) throws RegException {
- if (descriptorRegistry != null){
- descriptorRegistry.updateApplicationDescriptor(serviceName, hostName, descriptor);
- } else {
- if (serviceName==null || hostName==null){
- throw new InsufficientDataException("Service name or Host name cannot be null");
- }
- try {
- GatewayResource gateway = jpa.getGateway();
- String applicationName = descriptor.getType().getApplicationName().getStringValue();
- applicationName = createAppName(serviceName, hostName, applicationName);
- if (!isApplicationDescriptorExists(serviceName,hostName,descriptor.getType().getApplicationName().getStringValue())){
- throw new DescriptorDoesNotExistsException(applicationName);
- }
- ApplicationDescriptorResource serviceDescriptorResource = gateway.getApplicationDescriptorResource(applicationName);
- serviceDescriptorResource.setContent(descriptor.toXML());
- serviceDescriptorResource.save();
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null){
+// descriptorRegistry.updateApplicationDescriptor(serviceName, hostName, descriptor);
+// } else {
+// if (serviceName==null || hostName==null){
+// throw new InsufficientDataException("Service name or Host name cannot be null");
+// }
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// String applicationName = descriptor.getType().getApplicationName().getStringValue();
+// applicationName = createAppName(serviceName, hostName, applicationName);
+// if (!isApplicationDescriptorExists(serviceName,hostName,descriptor.getType().getApplicationName().getStringValue())){
+// throw new DescriptorDoesNotExistsException(applicationName);
+// }
+// ApplicationDescriptorResource serviceDescriptorResource = gateway.getApplicationDescriptorResource(applicationName);
+// serviceDescriptorResource.setContent(descriptor.toXML());
+// serviceDescriptorResource.save();
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
}
- private ApplicationDescription createApplicationDescriptor(
- ApplicationDescriptorResource applicationDescriptorResource)
- throws MalformedDescriptorException {
- try {
- return ApplicationDescription.fromXML(applicationDescriptorResource.getContent());
- } catch (XmlException e) {
- throw new MalformedDescriptorException(applicationDescriptorResource.getName(),e);
- }
- }
+// private ApplicationDescription createApplicationDescriptor(
+// ApplicationDescriptorResource applicationDescriptorResource)
+// throws MalformedDescriptorException {
+// try {
+// return ApplicationDescription.fromXML(applicationDescriptorResource.getContent());
+// } catch (XmlException e) {
+// throw new MalformedDescriptorException(applicationDescriptorResource.getName(),e);
+// }
+// }
public ApplicationDescription getApplicationDescriptor(String serviceName, String hostname, String applicationName)throws DescriptorDoesNotExistsException, MalformedDescriptorException, RegException {
- if (descriptorRegistry != null){
- return descriptorRegistry.getApplicationDescriptor(serviceName, hostname, applicationName);
- }
- if (serviceName==null || hostname==null){
- throw new InsufficientDataException("Service name or Host name cannot be null");
- }
- GatewayResource gateway = jpa.getGateway();
- if (!isApplicationDescriptorExists(serviceName,hostname,applicationName)){
- throw new DescriptorDoesNotExistsException(createAppName(serviceName, hostname, applicationName));
- }
- try {
- return createApplicationDescriptor(gateway.getApplicationDescriptorResource(createAppName(serviceName, hostname, applicationName)));
- } catch (RegistryException e) {
- e.printStackTrace();
- }
+// if (descriptorRegistry != null){
+// return descriptorRegistry.getApplicationDescriptor(serviceName, hostname, applicationName);
+// }
+// if (serviceName==null || hostname==null){
+// throw new InsufficientDataException("Service name or Host name cannot be null");
+// }
+// GatewayResource gateway = jpa.getGateway();
+// if (!isApplicationDescriptorExists(serviceName,hostname,applicationName)){
+// throw new DescriptorDoesNotExistsException(createAppName(serviceName, hostname, applicationName));
+// }
+// try {
+// return createApplicationDescriptor(gateway.getApplicationDescriptorResource(createAppName(serviceName, hostname, applicationName)));
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
return null;
}
public ApplicationDescription getApplicationDescriptors(String serviceName, String hostname) throws RegException {
- if (descriptorRegistry != null) {
- return descriptorRegistry.getApplicationDescriptors(serviceName, hostname);
- }
- try {
- GatewayResource gateway = jpa.getGateway();
- List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(serviceName, hostname);
- if (applicationDescriptorResources.size() > 0) {
- return createApplicationDescriptor(applicationDescriptorResources.get(0));
- }
- } catch (RegistryException e) {
- e.printStackTrace();
- }
+// if (descriptorRegistry != null) {
+// return descriptorRegistry.getApplicationDescriptors(serviceName, hostname);
+// }
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(serviceName, hostname);
+// if (applicationDescriptorResources.size() > 0) {
+// return createApplicationDescriptor(applicationDescriptorResources.get(0));
+// }
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
return null;
}
public Map<String, ApplicationDescription> getApplicationDescriptors(String serviceName) throws RegException {
- if (descriptorRegistry != null) {
- return descriptorRegistry.getApplicationDescriptors(serviceName);
- }
Map<String, ApplicationDescription> map = new HashMap<String, ApplicationDescription>();
- try {
- GatewayResource gateway = jpa.getGateway();
-
- List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(serviceName, null);
- for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
- map.put(resource.getHostDescName(), createApplicationDescriptor(resource));
- }
- } catch (RegistryException e) {
- e.printStackTrace();
- }
+// if (descriptorRegistry != null) {
+// return descriptorRegistry.getApplicationDescriptors(serviceName);
+// }
+// try {
+// GatewayResource gateway = jpa.getGateway();
+//
+// List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(serviceName, null);
+// for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
+// map.put(resource.getHostDescName(), createApplicationDescriptor(resource));
+// }
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
return map;
}
private Map<String,ApplicationDescription> getApplicationDescriptorsFromHostName(String hostName)throws RegException {
Map<String, ApplicationDescription> map=new HashMap<String,ApplicationDescription>();
- try {
- GatewayResource gateway = jpa.getGateway();
- List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(null, hostName);
- for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
- map.put(resource.getServiceDescName(),createApplicationDescriptor(resource));
- }
- } catch (RegistryException e) {
- e.printStackTrace();
- }
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(null, hostName);
+// for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
+// map.put(resource.getServiceDescName(),createApplicationDescriptor(resource));
+// }
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
return map;
}
public Map<String[],ApplicationDescription> getApplicationDescriptors()throws MalformedDescriptorException, RegException {
Map<String[], ApplicationDescription> map=new HashMap<String[],ApplicationDescription>();
- if (descriptorRegistry != null){
- return descriptorRegistry.getApplicationDescriptors();
- }
- try {
-
- GatewayResource gateway = jpa.getGateway();
-
- List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources();
- for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
- map.put(new String[]{resource.getServiceDescName(),resource.getHostDescName()},createApplicationDescriptor(resource));
- }
- return map;
- } catch (RegistryException e) {
- e.printStackTrace();
- }
+// if (descriptorRegistry != null){
+// return descriptorRegistry.getApplicationDescriptors();
+// }
+// try {
+//
+// GatewayResource gateway = jpa.getGateway();
+//
+// List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources();
+// for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
+// map.put(new String[]{resource.getServiceDescName(),resource.getHostDescName()},createApplicationDescriptor(resource));
+// }
+// return map;
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
return map;
}
public void removeApplicationDescriptor(String serviceName, String hostName, String applicationName) throws RegException {
- if (descriptorRegistry != null){
- descriptorRegistry.removeApplicationDescriptor(serviceName, hostName, applicationName);
- } else {
- try {
- GatewayResource gateway = jpa.getGateway();
- String appName = createAppName(serviceName, hostName, applicationName);
- if (!isApplicationDescriptorExists(serviceName,hostName,applicationName)){
- throw new DescriptorDoesNotExistsException(appName);
- }
- gateway.removeApplicationDescriptor(appName);
- } catch (RegistryException e) {
- e.printStackTrace();
- }
- }
+// if (descriptorRegistry != null){
+// descriptorRegistry.removeApplicationDescriptor(serviceName, hostName, applicationName);
+// } else {
+// try {
+// GatewayResource gateway = jpa.getGateway();
+// String appName = createAppName(serviceName, hostName, applicationName);
+// if (!isApplicationDescriptorExists(serviceName,hostName,applicationName)){
+// throw new DescriptorDoesNotExistsException(appName);
+// }
+// gateway.removeApplicationDescriptor(appName);
+// } catch (RegistryException e) {
+// e.printStackTrace();
+// }
+// }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java
deleted file mode 100644
index 22a03de..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.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.persistance.registry.jpa.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@IdClass(Application_Descriptor_PK.class)
-@Table(name ="APPLICATION_DESCRIPTOR")
-public class Application_Descriptor implements Serializable {
- @Id
- @Column(name = "APPLICATION_DESCRIPTOR_ID")
- private String application_descriptor_ID;
- @Id
- @Column(name = "GATEWAY_NAME")
- private String gateway_name;
-
- @Column(name = "HOST_DESCRIPTOR_ID")
- private String host_descriptor_ID;
- @Column(name = "SERVICE_DESCRIPTOR_ID")
- private String service_descriptor_ID;
-
- @Lob
- @Column(name = "APPLICATION_DESCRIPTOR_XML")
- private byte[] application_descriptor_xml;
-
- @ManyToOne(cascade=CascadeType.PERSIST)
- @JoinColumn(name = "GATEWAY_NAME")
- private Gateway gateway;
-
- @ManyToOne(cascade=CascadeType.PERSIST)
- @JoinColumn(name = "UPDATED_USER", referencedColumnName = "USER_NAME")
- private Users user;
-
- public String getApplication_descriptor_ID() {
- return application_descriptor_ID;
- }
-
- public byte[] getApplication_descriptor_xml() {
- return application_descriptor_xml;
- }
-
- public Gateway getGateway() {
- return gateway;
- }
-
- public String getHost_descriptor_ID() {
- return host_descriptor_ID;
- }
-
- public String getService_descriptor_ID() {
- return service_descriptor_ID;
- }
-
- public void setHost_descriptor_ID(String host_descriptor_ID) {
- this.host_descriptor_ID = host_descriptor_ID;
- }
-
- public void setService_descriptor_ID(String service_descriptor_ID) {
- this.service_descriptor_ID = service_descriptor_ID;
- }
-
- public void setApplication_descriptor_ID(String application_descriptor_ID) {
- this.application_descriptor_ID = application_descriptor_ID;
- }
-
- public void setApplication_descriptor_xml(byte[] application_descriptor_xml) {
- this.application_descriptor_xml = application_descriptor_xml;
- }
-
- public void setGateway(Gateway gateway) {
- this.gateway = gateway;
- }
-
- public Users getUser() {
- return user;
- }
-
- public void setUser(Users user) {
- this.user = user;
- }
-
- public String getGateway_name() {
- return gateway_name;
- }
-
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor_PK.java
deleted file mode 100644
index b54cb4f..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor_PK.java
+++ /dev/null
@@ -1,65 +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.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class Application_Descriptor_PK implements Serializable {
- private String gateway_name;
- private String application_descriptor_ID;
-
- public Application_Descriptor_PK(String gateway_name, String application_descriptor_ID) {
- this.gateway_name = gateway_name;
- this.application_descriptor_ID = application_descriptor_ID;
- }
-
- public Application_Descriptor_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getGateway_name() {
- return gateway_name;
- }
-
- public String getApplication_descriptor_ID() {
- return application_descriptor_ID;
- }
-
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
- }
-
- public void setApplication_descriptor_ID(String application_descriptor_ID) {
- this.application_descriptor_ID = application_descriptor_ID;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
deleted file mode 100644
index de1f2da..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.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.persistance.registry.jpa.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name ="HOST_DESCRIPTOR")
-@IdClass(Host_Descriptor_PK.class)
-public class Host_Descriptor implements Serializable {
- @Id
- @Column(name = "HOST_DESCRIPTOR_ID")
- private String host_descriptor_ID;
- @Id
- @Column(name = "GATEWAY_NAME")
- private String gateway_name;
- @Lob
- @Column(name = "HOST_DESCRIPTOR_XML")
- private byte[] host_descriptor_xml;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "GATEWAY_NAME")
- private Gateway gateway;
-
- @ManyToOne (cascade=CascadeType.MERGE)
- @JoinColumn(name = "UPDATED_USER", referencedColumnName = "USER_NAME")
- private Users user;
-
- public String getHost_descriptor_ID() {
- return host_descriptor_ID;
- }
-
- public byte[] getHost_descriptor_xml() {
- return host_descriptor_xml;
- }
-
- public Gateway getGateway() {
- return gateway;
- }
-
- public String getGateway_name() {
- return gateway_name;
- }
-
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
- }
-
- public void setHost_descriptor_ID(String host_descriptor_ID) {
- this.host_descriptor_ID = host_descriptor_ID;
- }
-
- public void setHost_descriptor_xml(byte[] host_descriptor_xml) {
- this.host_descriptor_xml = host_descriptor_xml;
- }
-
- public void setGateway(Gateway gateway) {
- this.gateway = gateway;
- }
-
- public Users getUser() {
- return user;
- }
-
- public void setUser(Users user) {
- this.user = user;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor_PK.java
deleted file mode 100644
index 5d56d5f..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor_PK.java
+++ /dev/null
@@ -1,64 +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.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class Host_Descriptor_PK implements Serializable {
- private String gateway_name;
- private String host_descriptor_ID;
-
- public Host_Descriptor_PK() {
- ;
- }
-
- public Host_Descriptor_PK(String gateway_name, String host_descriptor_ID) {
- this.gateway_name = gateway_name;
- this.host_descriptor_ID = host_descriptor_ID;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getGateway_name() {
- return gateway_name;
- }
-
- public String getHost_descriptor_ID() {
- return host_descriptor_ID;
- }
-
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
- }
-
- public void setHost_descriptor_ID(String host_descriptor_ID) {
- this.host_descriptor_ID = host_descriptor_ID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
deleted file mode 100644
index ac0c872..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
+++ /dev/null
@@ -1,90 +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.persistance.registry.jpa.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name ="SERVICE_DESCRIPTOR")
-@IdClass(Service_Descriptor_PK.class)
-public class Service_Descriptor implements Serializable {
- @Id
- @Column(name = "SERVICE_DESCRIPTOR_ID")
- private String service_descriptor_ID;
- @Id
- @Column(name = "GATEWAY_NAME")
- private String gateway_name;
- @Lob
- @Column(name = "SERVICE_DESCRIPTOR_XML")
- private byte[] service_descriptor_xml;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "GATEWAY_NAME")
- private Gateway gateway;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "UPDATED_USER", referencedColumnName = "USER_NAME")
- private Users user;
-
- public String getService_descriptor_ID() {
- return service_descriptor_ID;
- }
-
- public byte[] getService_descriptor_xml() {
- return service_descriptor_xml;
- }
-
- public Gateway getGateway() {
- return gateway;
- }
-
- public void setService_descriptor_ID(String service_descriptor_ID) {
- this.service_descriptor_ID = service_descriptor_ID;
- }
-
- public void setService_descriptor_xml(byte[] service_descriptor_xml) {
- this.service_descriptor_xml = service_descriptor_xml;
- }
-
- public void setGateway(Gateway gateway) {
- this.gateway = gateway;
- }
-
- public Users getUser() {
- return user;
- }
-
- public void setUser(Users user) {
- this.user = user;
- }
-
- public String getGateway_name() {
- return gateway_name;
- }
-
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
- }
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor_PK.java
deleted file mode 100644
index 6952340..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor_PK.java
+++ /dev/null
@@ -1,64 +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.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class Service_Descriptor_PK implements Serializable {
- private String gateway_name;
- private String service_descriptor_ID;
-
- public Service_Descriptor_PK() {
- ;
- }
-
- public Service_Descriptor_PK(String gateway_name, String service_descriptor_ID) {
- this.gateway_name = gateway_name;
- this.service_descriptor_ID = service_descriptor_ID;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getGateway_name() {
- return gateway_name;
- }
-
- public String getService_descriptor_ID() {
- return service_descriptor_ID;
- }
-
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
- }
-
- public void setService_descriptor_ID(String service_descriptor_ID) {
- this.service_descriptor_ID = service_descriptor_ID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
index c16d8a5..449c072 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
@@ -37,9 +37,6 @@ public abstract class AbstractResource implements Resource {
public static final String PROJECT_USER = "ProjectUser";
public static final String PUBLISHED_WORKFLOW = "Published_Workflow";
public static final String USER_WORKFLOW = "User_Workflow";
- public static final String HOST_DESCRIPTOR = "Host_Descriptor";
- public static final String SERVICE_DESCRIPTOR = "Service_Descriptor";
- public static final String APPLICATION_DESCRIPTOR = "Application_Descriptor";
public static final String EXPERIMENT = "Experiment";
public static final String EXPERIMENT_CONFIG_DATA = "ExperimentConfigData";
public static final String EXPERIMENT_INPUT = "Experiment_Input";
@@ -125,32 +122,6 @@ public abstract class AbstractResource implements Resource {
public static final String WORKFLOW_GRAPH = "workflow_graph";
}
- // Host_Descriptor table
- public final class HostDescriptorConstants {
- public static final String GATEWAY_NAME = "gateway_name";
- public static final String UPDATED_USER = "updated_user";
- public static final String HOST_DESC_ID = "host_descriptor_ID";
- public static final String HOST_DESC_XML = "host_descriptor_xml";
- }
-
- // Service_Descriptor table
- public final class ServiceDescriptorConstants {
- public static final String GATEWAY_NAME = "gateway_name";
- public static final String UPDATED_USER = "updated_user";
- public static final String SERVICE_DESC_ID = "service_descriptor_ID";
- public static final String SERVICE_DESC_XML = "service_descriptor_xml";
- }
-
- // Application_Descriptor table
- public final class ApplicationDescriptorConstants {
- public static final String GATEWAY_NAME = "gateway_name";
- public static final String UPDATED_USER = "updated_user";
- public static final String APPLICATION_DESC_ID = "application_descriptor_ID";
- public static final String HOST_DESC_ID = "host_descriptor_ID";
- public static final String SERVICE_DESC_ID = "service_descriptor_ID";
- public static final String APPLICATION_DESC_XML = "application_descriptor_xml";
- }
-
// Experiment table
public final class ExperimentConstants {
public static final String PROJECT_ID = "projectID";
http://git-wip-us.apache.org/repos/asf/airavata/blob/10103a44/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
deleted file mode 100644
index 46d8d67..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
+++ /dev/null
@@ -1,283 +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.persistance.registry.jpa.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ApplicationDescriptorResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ApplicationDescriptorResource.class);
- private String name;
- private String gatewayName;
- private String updatedUser;
- private String content;
- private String hostDescName;
- private String serviceDescName;
-
- /**
- *
- * @param name application descriptor name
- * @param gatewayName gateway name
- * returns ApplicationDescriptorResource
- */
- public ApplicationDescriptorResource(String name, String gatewayName) {
- this.setName(name);
- this.gatewayName = gatewayName;
- }
-
- /**
- *
- */
- public ApplicationDescriptorResource() {
- }
-
- /**
- *
- * @return gateway name
- */
- public String getGatewayName() {
- return gatewayName;
- }
-
- /**
- *
- * @param gatewayName gateway name
- */
- public void setGatewayName(String gatewayName) {
- this.gatewayName = gatewayName;
- }
-
- /**
- *
- * @param updatedUser updated user
- */
- public void setUpdatedUser(String updatedUser) {
- this.updatedUser = updatedUser;
- }
-
- /**
- *
- * @return name of the application descriptor
- */
- public String getName() {
- return name;
- }
-
- /**
- *
- * @return content
- */
- public String getContent() {
- return content;
- }
-
- /**
- *
- * @return host descriptor name
- */
- public String getHostDescName() {
- return hostDescName;
- }
-
- /**
- *
- * @return service descriptor name
- */
- public String getServiceDescName() {
- return serviceDescName;
- }
-
- /**
- *
- * @param content content of the application descriptor
- */
- public void setContent(String content) {
- this.content = content;
- }
-
- /**
- *
- * @param hostDescName host descriptor name
- */
- public void setHostDescName(String hostDescName) {
- this.hostDescName = hostDescName;
- }
-
- /**
- *
- * @param serviceDescName service descriptor name
- */
- public void setServiceDescName(String serviceDescName) {
- this.serviceDescName = serviceDescName;
- }
-
- /**
- * Since application descriptors are at the leaf level, this method is not
- * valid for application descriptors
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported operation for application descriptor resource " +
- "since application descriptors could not create child resources.. ", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * Since application descriptors are at the leaf level, this method is not
- * valid for application descriptors
- * @param type child resource types
- * @param name name of the resource
- */
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported operation for application descriptor resource " +
- "since application descriptors could not remove child resources.. ", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * key should be gateway_name, application_descriptor_ID, host_descriptor_ID, service_descriptor_ID
- *
- * @param keys primary keys of the Application_descriptor table
- */
-// public void removeMe(Object[] keys) {
-// EntityManager em = ResourceUtils.getEntityManager();
-// em.getTransaction().begin();
-// QueryGenerator queryGenerator = new QueryGenerator(Application_Descriptor);
-// queryGenerator.setParameter(ApplicationDescriptorConstants.GATEWAY_NAME, keys[0]);
-// queryGenerator.setParameter(ApplicationDescriptorConstants.APPLICATION_DESC_ID, keys[1]);
-// queryGenerator.setParameter(ApplicationDescriptorConstants.HOST_DESC_ID, keys[2]);
-// queryGenerator.setParameter(ApplicationDescriptorConstants.SERVICE_DESC_ID, keys[3]);
-// Query q = queryGenerator.deleteQuery(em);
-// q.executeUpdate();
-// em.getTransaction().commit();
-// em.close();
-// }
-
- /**
- *
- * Since application descriptors are at the leaf level, this method is not
- * valid for application descriptors
- * @param type child resource types
- * @param name name of the resource
- * @return UnsupportedOperationException
- */
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported operation for application descriptor resource " +
- "since there are no child resources generated by application descriptors.. ", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- /**
- * Since application descriptors are at the leaf level, this method is not
- * valid for application descriptors
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported operation for application descriptor resource " +
- "since there are no child resources generated by application descriptors.. ", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * save application descriptor to database
- */
- public void save() throws RegistryException{
- EntityManager em = null;
- try{
- em = ResourceUtils.getEntityManager();
- Application_Descriptor existingAppDesc = em.find(Application_Descriptor.class, new Application_Descriptor_PK(gatewayName, name));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Application_Descriptor applicationDescriptor = new Application_Descriptor();
- applicationDescriptor.setApplication_descriptor_ID(getName());
-
- Gateway gateway = em.find(Gateway.class, gatewayName);
- Users user = em.find(Users.class, updatedUser);
- applicationDescriptor.setGateway(gateway);
- applicationDescriptor.setGateway_name(gateway.getGateway_name());
- applicationDescriptor.setUser(user);
- byte[] contentBytes = content.getBytes();
- applicationDescriptor.setApplication_descriptor_xml(contentBytes);
- applicationDescriptor.setService_descriptor_ID(serviceDescName);
- applicationDescriptor.setHost_descriptor_ID(hostDescName);
- if (existingAppDesc != null) {
- existingAppDesc.setUser(user);
- existingAppDesc.setGateway(gateway);
- existingAppDesc.setGateway_name(gateway.getGateway_name());
- existingAppDesc.setApplication_descriptor_xml(contentBytes);
- existingAppDesc.setHost_descriptor_ID(hostDescName);
- existingAppDesc.setService_descriptor_ID(serviceDescName);
- applicationDescriptor = em.merge(existingAppDesc);
- } else {
- em.persist(applicationDescriptor);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- /**
- * Since application descriptors are at the leaf level, this method is not
- * valid for application descriptors
- * @param type child resource types
- * @param name name of the resource
- * @return UnsupportedOperationException
- */
- public boolean isExists(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported operation for application descriptor resource " +
- "since there are no child resources generated by application descriptors.. ", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @param name application descriptor name
- */
- public void setName(String name) {
- this.name = name;
- }
-}