airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1463010 - in /airavata/trunk/modules: registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ regi...
Date Sun, 31 Mar 2013 17:31:12 GMT
Author: samindaw
Date: Sun Mar 31 17:31:11 2013
New Revision: 1463010

URL: http://svn.apache.org/r1463010
Log:
setting ec2 type for host descriptor, remove application descriptors when deleting service/host
descriptors

Modified:
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1463010&r1=1463009&r2=1463010&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
Sun Mar 31 17:31:11 2013
@@ -454,10 +454,18 @@ public class AiravataJPARegistry extends
                 throw new DescriptorDoesNotExistsException(hostName);
             }
             gateway.removeHostDescriptor(hostName);
+            try {
+                //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 (Exception e) {
+				logger.error("Error while removing application descriptors bound to host "+hostName,
e);
+			}
         }
     }
 
-
 	@Override
 	public List<HostDescription> getHostDescriptors()
 			throws MalformedDescriptorException, RegistryException {
@@ -552,6 +560,15 @@ public class AiravataJPARegistry extends
                 throw new DescriptorDoesNotExistsException(serviceName);
             }
             gateway.removeServiceDescriptor(serviceName);
+            try {
+				//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);
+			}
         }
     }
 
@@ -704,6 +721,16 @@ public class AiravataJPARegistry extends
 		return map;
     }
 
+    private Map<String,ApplicationDescription> getApplicationDescriptorsFromHostName(String
hostName)throws RegistryException {
+        GatewayResource gateway = jpa.getGateway();
+		Map<String, ApplicationDescription> map=new HashMap<String,ApplicationDescription>();
+		List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(null,
hostName);
+		for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
+			map.put(resource.getServiceDescName(),createApplicationDescriptor(resource));
+		}
+		return map;
+    }
+    
     public Map<String[],ApplicationDescription> getApplicationDescriptors()throws MalformedDescriptorException,
RegistryException{
         if (descriptorRegistry != null){
             return descriptorRegistry.getApplicationDescriptors();

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java?rev=1463010&r1=1463009&r2=1463010&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
Sun Mar 31 17:31:11 2013
@@ -642,13 +642,18 @@ public class GatewayResource extends Abs
         EntityManager em = ResourceUtils.getEntityManager();
         em.getTransaction().begin();
         String qString = "SELECT p FROM Application_Descriptor p WHERE " +
-                "p.gateway_name =:gate_name and p.service_descriptor_ID =:service_name";
+                "p.gateway_name =:gate_name";
         if (hostName!=null){
         	qString+=" and p.host_descriptor_ID =:host_name";
         }
+        if (serviceName!=null){
+        	qString+=" and p.service_descriptor_ID =:service_name";
+        }
 		Query q = em.createQuery(qString);
         q.setParameter("gate_name", gatewayName);
-        q.setParameter("service_name", serviceName);
+        if (serviceName!=null){
+        	q.setParameter("service_name", serviceName);
+        }
         if (hostName!=null){
         	q.setParameter("host_name",hostName);
         }

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java?rev=1463010&r1=1463009&r2=1463010&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
(original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
Sun Mar 31 17:31:11 2013
@@ -65,6 +65,7 @@ public interface DescriptorRegistry exte
 	public ApplicationDescription getApplicationDescriptor(String serviceName, String hostname,
String applicationName)throws DescriptorDoesNotExistsException, MalformedDescriptorException,
RegistryException;
 	public ApplicationDescription getApplicationDescriptors(String serviceName, String hostname)throws
MalformedDescriptorException, RegistryException;
 	public Map<String,ApplicationDescription> getApplicationDescriptors(String serviceName)throws
MalformedDescriptorException, RegistryException;
+	//public Map<String,ApplicationDescription> getApplicationDescriptorsFromHostName(String
hostName)throws MalformedDescriptorException, RegistryException;
 	public Map<String[],ApplicationDescription> getApplicationDescriptors()throws MalformedDescriptorException,
RegistryException;
 	public void removeApplicationDescriptor(String serviceName, String hostName, String applicationName)throws
DescriptorDoesNotExistsException, RegistryException;
 	public ResourceMetadata getApplicationDescriptorMetadata(String serviceName, String hostName,
String applicationName)throws DescriptorDoesNotExistsException, RegistryException;

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java?rev=1463010&r1=1463009&r2=1463010&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
Sun Mar 31 17:31:11 2013
@@ -160,7 +160,6 @@ public class HostDescriptionDialog exten
         }else if (host instanceof UnicoreHostType){
         	((UnicoreHostType)hostDescription.getType()).addUnicoreHostAddress(this.gateKeeperTextField.getText());
             ((UnicoreHostType)hostDescription.getType()).addGridFTPEndPoint(this.gridFTPTextField.getText());
-
         }
         saveHostDescription();
         close();
@@ -449,15 +448,16 @@ public class HostDescriptionDialog exten
 			}else if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_SSH)){
 				getHostDescription().getType().changeType(SSHHostType.type);
 				infoPanel2.add(createPanelWithMessage("No configurations needed."));
-			}
-			else if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_GLOBUS)){
+			}else if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_GLOBUS)){
 				getHostDescription().getType().changeType(GlobusHostType.type);
 				infoPanel2.add(createGlobusRemoteProtocolPanel());
 			}else if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_UNICORE)){
 				getHostDescription().getType().changeType(UnicoreHostType.type);
 				infoPanel2.add(createUnicoreRemoteProtocolPanel());
-			}
-			else{
+			}else if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_AMAZON_EC2)){
+				getHostDescription().getType().changeType(Ec2HostType.type);
+				infoPanel2.add(createPanelWithMessage("No configurations needed."));
+			}else{
 				infoPanel2.add(createPanelWithMessage("Not supported."));
 			}
 			infoPanel2.getContentPanel().setBorder(BorderFactory.createEtchedBorder());



Mime
View raw message