airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1382939 [1/2] - in /incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main: java/org/apache/airavata/persistance/registry/jpa/ java/org/apache/airavata/persistance/registry/jpa/resources/ resources/META-INF/
Date Mon, 10 Sep 2012 15:25:16 GMT
Author: lahiru
Date: Mon Sep 10 15:25:15 2012
New Revision: 1382939

URL: http://svn.apache.org/viewvc?rev=1382939&view=rev
Log:
applying patch from chathuri for AIRAVATA-562

Modified:
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java Mon Sep 10 15:25:15 2012
@@ -24,9 +24,11 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.persistance.registry.jpa.model.Gateway;
 import org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker;
 import org.apache.airavata.persistance.registry.jpa.model.Users;
+import org.apache.airavata.persistance.registry.jpa.resources.AbstractResource;
 import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource;
 import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
 import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
@@ -40,8 +42,12 @@ public class ResourceUtils {
     protected static EntityManagerFactory factory;
     protected static EntityManager em;
 
+    /**
+     * @param gatewayName
+     * @return
+     */
     public static Resource createGateway(String gatewayName) {
-        if(!isGatewayExist(gatewayName)){
+        if (!isGatewayExist(gatewayName)) {
             GatewayResource gatewayResource = new GatewayResource();
             gatewayResource.setGatewayName(gatewayName);
             return gatewayResource;
@@ -50,25 +56,35 @@ public class ResourceUtils {
 
     }
 
+    /**
+     * @param gatewayName
+     * @return
+     */
     public static boolean isGatewayExist(String gatewayName) {
         factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
         em = factory.createEntityManager();
         em.getTransaction().begin();
-        Query q = em.createQuery("SELECT p FROM Gateway p WHERE p.gateway_name =:gate_name");
-        q.setParameter("gate_name", gatewayName);
+        QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
+        generator.setParameter(AbstractResource.GatewayConstants.GATEWAY_NAME, gatewayName);
+        Query q = generator.selectQuery(em);
         Gateway gateway = (Gateway) q.getSingleResult();
         em.getTransaction().commit();
         em.close();
         return gateway != null;
     }
 
+    /**
+     * @param gatewayName
+     * @return
+     */
     public static boolean removeGateway(String gatewayName) {
         try {
             factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
             em = factory.createEntityManager();
             em.getTransaction().begin();
-            Query q = em.createQuery("Delete p FROM Gateway p WHERE p.gateway_name =:gate_name");
-            q.setParameter("gate_name", gatewayName);
+            QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
+            generator.setParameter(AbstractResource.GatewayConstants.GATEWAY_NAME, gatewayName);
+            Query q = generator.deleteQuery(em);
             q.executeUpdate();
             em.getTransaction().commit();
             em.close();
@@ -81,53 +97,69 @@ public class ResourceUtils {
 
     }
 
+    /**
+     * @param gatewayResource
+     * @param userResource
+     */
     public static void addGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
-          try{
-              factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
-              em = factory.createEntityManager();
-              em.getTransaction().begin();
-              Gateway gateway = new Gateway();
-              gateway.setGateway_name(gatewayResource.getGatewayName());
-              Users user = new Users();
-              user.setUser_name(userResource.getUserName());
-              Gateway_Worker gatewayWorker = new Gateway_Worker();
-              gatewayWorker.setGateway(gateway);
-              gatewayWorker.setUser(user);
-              em.persist(gatewayWorker);
-              em.getTransaction().commit();
-              em.close();
-          }   catch (Exception e){
-                e.printStackTrace();
-          }
+        try {
+            factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+            em = factory.createEntityManager();
+            em.getTransaction().begin();
+            Gateway gateway = new Gateway();
+            gateway.setGateway_name(gatewayResource.getGatewayName());
+            Users user = new Users();
+            user.setUser_name(userResource.getUserName());
+            Gateway_Worker gatewayWorker = new Gateway_Worker();
+            gatewayWorker.setGateway(gateway);
+            gatewayWorker.setUser(user);
+            em.persist(gatewayWorker);
+            em.getTransaction().commit();
+            em.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
     }
 
+    /**
+     * @param gatewayResource
+     * @param userResource
+     * @return
+     */
     public static boolean removeGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
-        try{
+        try {
             factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
             em = factory.createEntityManager();
             em.getTransaction().begin();
-            Query q = em.createQuery("Delete p FROM Gateway_Worker p WHERE p.gateway_name =:gate_name and p.user_name =:usr_name");
-            q.setParameter("gate_name", gatewayResource.getGatewayName());
-            q.setParameter("usr_name", userResource.getUserName());
+            QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY_WORKER);
+            generator.setParameter(AbstractResource.GatewayWorkerConstants.GATEWAY_NAME,
+                    gatewayResource.getGatewayName());
+            generator.setParameter(AbstractResource.UserConstants.USERNAME, userResource.getUserName());
+            Query q = generator.deleteQuery(em);
             q.executeUpdate();
             em.getTransaction().commit();
             em.close();
             return true;
-        }   catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
             return false;
         }
 
     }
 
-    public static List<ConfigurationResource> getConfigurations (String configKey){
+    /**
+     * @param configKey
+     * @return
+     */
+    public static List<ConfigurationResource> getConfigurations(String configKey) {
         List<ConfigurationResource> list = new ArrayList<ConfigurationResource>();
         factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
         em = factory.createEntityManager();
         em.getTransaction().begin();
-        Query q = em.createQuery("SELECT p FROM Configuration p WHERE p.config_key = :confKey");
-        q.setParameter("confKey", configKey);
+        QueryGenerator generator = new QueryGenerator(AbstractResource.CONFIGURATION);
+        generator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configKey);
+        Query q = generator.selectQuery(em);
         List<?> resultList = q.getResultList();
         if (resultList.size() != 0) {
             for (Object result : resultList) {
@@ -140,37 +172,78 @@ public class ResourceUtils {
         return list;
     }
 
-    public static ConfigurationResource getConfiguration(String configKey){
-    	List<ConfigurationResource> configurations = getConfigurations(configKey);
-    	return (configurations!=null && configurations.size()>0)? configurations.get(0):null;
-    }
-    
-    public static boolean isConfigurationExist(String configKey){
-    	List<ConfigurationResource> configurations = getConfigurations(configKey);
-    	return (configurations!=null && configurations.size()>0);
-    }
-    
-    public static ConfigurationResource createConfiguration(String configKey){
-    	ConfigurationResource config = new ConfigurationResource();
-    	config.setConfigKey(configKey);
-    	return config;
-    }
-    
-	private static ConfigurationResource createConfigurationResourceObject(
-			Object result) {
-		Configuration configuration = (Configuration) result;
-		ConfigurationResource configurationResource = new ConfigurationResource(configuration.getConfig_ID());
-		configurationResource.setConfigKey(configuration.getConfig_key());
-		configurationResource.setConfigVal(configuration.getConfig_val());
-		configurationResource.setExpireDate(configuration.getExpire_date());
-		return configurationResource;
-	}
-
-    public static void removeConfiguration(String configkey, String configValue){
+    /**
+     * @param configKey
+     * @return
+     */
+    public static ConfigurationResource getConfiguration(String configKey) {
+        List<ConfigurationResource> configurations = getConfigurations(configKey);
+        return (configurations != null && configurations.size() > 0) ? configurations.get(0) : null;
+    }
+
+    /**
+     * @param configKey
+     * @return
+     */
+    public static boolean isConfigurationExist(String configKey) {
+        List<ConfigurationResource> configurations = getConfigurations(configKey);
+        return (configurations != null && configurations.size() > 0);
+    }
+
+    /**
+     * @param configKey
+     * @return
+     */
+    public static ConfigurationResource createConfiguration(String configKey) {
+        ConfigurationResource config = new ConfigurationResource();
+        config.setConfigKey(configKey);
+        return config;
+    }
+
+    /**
+     * @param result
+     * @return
+     */
+    private static ConfigurationResource createConfigurationResourceObject(
+            Object result) {
+        Configuration configuration = (Configuration) result;
+        ConfigurationResource configurationResource = new ConfigurationResource(configuration.getConfig_ID());
+        configurationResource.setConfigKey(configuration.getConfig_key());
+        configurationResource.setConfigVal(configuration.getConfig_val());
+        configurationResource.setExpireDate(configuration.getExpire_date());
+        return configurationResource;
+    }
+
+    /**
+     * @param configkey
+     * @param configValue
+     */
+    public static void removeConfiguration(String configkey, String configValue) {
+        factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+        em = factory.createEntityManager();
+        em.getTransaction().begin();
+        QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
+        queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
+        queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_VAL, configValue);
+        Query q = queryGenerator.deleteQuery(em);
+        q.executeUpdate();
+        em.getTransaction().commit();
+        em.close();
 
     }
-    
-    public static void removeConfiguration(String configkey){
 
+    /**
+     * @param configkey
+     */
+    public static void removeConfiguration(String configkey) {
+        factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+        em = factory.createEntityManager();
+        em.getTransaction().begin();
+        QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
+        queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
+        Query q = queryGenerator.deleteQuery(em);
+        q.executeUpdate();
+        em.getTransaction().commit();
+        em.close();
     }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java Mon Sep 10 15:25:15 2012
@@ -46,13 +46,13 @@ public abstract class AbstractResource i
     public static final String EXPERIMENT = "Experiment";
 
     //Gateway Table
-    protected final class GatewayConstants {
+    public final class GatewayConstants {
         public static final String GATEWAY_NAME = "gateway_name";
         public static final String GATEWAY_OWNER = "owner";
     }
 
     //Configuration Table
-    protected final class ConfigurationConstants{
+    public final class ConfigurationConstants {
         public static final String CONFIG_ID = "config_ID";
         public static final String CONFIG_KEY = "config_key";
         public static final String CONFIG_VAL = "config_val";
@@ -61,20 +61,19 @@ public abstract class AbstractResource i
 
 
     //Users table
-    protected final class UserConstants{
+    public final class UserConstants {
         public static final String USERNAME = "user_name";
         public static final String PASSWORD = "password";
-
     }
 
     //Gateway_Worker table
-    protected final class GatewayWorkerConstants{
+    public final class GatewayWorkerConstants {
         public static final String USERNAME = "user_name";
         public static final String GATEWAY_NAME = "gateway_name";
     }
 
     //Project table
-    protected final class ProjectConstants {
+    public final class ProjectConstants {
         public static final String PROJECT_ID = "project_ID";
         public static final String GATEWAY_NAME = "gateway_name";
         public static final String USERNAME = "user_name";
@@ -82,7 +81,7 @@ public abstract class AbstractResource i
     }
 
     //Published_Workflow table
-    protected final class PublishedWorkflowConstants {
+    public final class PublishedWorkflowConstants {
         public static final String GATEWAY_NAME = "gateway_name";
         public static final String CREATED_USER = "created_user";
         public static final String PUBLISH_WORKFLOW_NAME = "publish_workflow_name";
@@ -93,7 +92,7 @@ public abstract class AbstractResource i
     }
 
     //User_Workflow table
-    protected final class UserWorkflowConstants {
+    public final class UserWorkflowConstants {
         public static final String GATEWAY_NAME = "gateway_name";
         public static final String OWNER = "owner";
         public static final String TEMPLATE_NAME = "template_name";
@@ -103,7 +102,7 @@ public abstract class AbstractResource i
     }
 
     //Host_Descriptor table
-    protected final class  HostDescriptorConstants{
+    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";
@@ -111,7 +110,7 @@ public abstract class AbstractResource i
     }
 
     //Service_Descriptor table
-    protected final class  ServiceDescriptorConstants{
+    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";
@@ -119,7 +118,7 @@ public abstract class AbstractResource i
     }
 
     //Application_Descriptor table
-    protected final class ApplicationDescriptorConstants{
+    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";
@@ -129,7 +128,7 @@ public abstract class AbstractResource i
     }
 
     //Experiment table
-    protected final class ExperimentConstants{
+    public final class ExperimentConstants {
         public static final String PROJECT_ID = "project_ID";
         public static final String USERNAME = "user_name";
         public static final String GATEWAY_NAME = "gateway_name";
@@ -153,13 +152,13 @@ public abstract class AbstractResource i
         em.close();
 
     }
-    
-	public boolean isExists(ResourceType type, Object name) {
-		try {
-			return get(type, name)!=null;
-		} catch (Exception e) {
-			return false;
-		}
-	}
+
+    public boolean isExists(ResourceType type, Object name) {
+        try {
+            return get(type, name) != null;
+        } catch (Exception e) {
+            return false;
+        }
+    }
 
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java Mon Sep 10 15:25:15 2012
@@ -36,76 +36,133 @@ public class ApplicationDescriptorResour
     private String content;
     private String hostDescName;
     private String serviceDescName;
-    
-    public ApplicationDescriptorResource(String name) {
-        this.setName(name);
-    }
-    
-    public ApplicationDescriptorResource(String name, String gatewayName, String hostDescName, String serviceDescName) {
+
+    /**
+     *
+     * @param name application descriptor name
+     * @param gatewayName  gateway name
+     * @param hostDescName host descriptor name
+     * @param serviceDescName service descriptor name
+     * returns ApplicationDescriptorResource
+     */
+    public ApplicationDescriptorResource(String name, String gatewayName,
+                                         String hostDescName, String serviceDescName) {
         this.setName(name);
         this.gatewayName = gatewayName;
         this.hostDescName = hostDescName;
         this.serviceDescName = serviceDescName;
     }
 
+    /**
+     *
+     */
     public ApplicationDescriptorResource() {
     }
 
+    /**
+     *
+     * @return gateway name
+     */
     public String getGatewayName() {
         return gatewayName;
     }
 
+    /**
+     *
+     * @param gatewayName gateway name
+     */
     public void setGatewayName(String gatewayName) {
         this.gatewayName = gatewayName;
     }
 
-    public String getUpdatedUser() {
-        return updatedUser;
-    }
-
+    /**
+     *
+     * @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) {
         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) {
         throw new UnsupportedOperationException();
     }
 
     /**
      * key should be gateway_name, application_descriptor_ID, host_descriptor_ID, service_descriptor_ID
-     * @param keys
+     *
+     * @param keys primary keys of the Application_descriptor table
      */
     public void removeMe(Object[] keys) {
         begin();
@@ -119,14 +176,23 @@ public class ApplicationDescriptorResour
         end();
     }
 
+    /**
+     *
+     * 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) {
         throw new UnsupportedOperationException();
     }
 
     /**
      * keys should contain gateway_name, application_descriptor_ID, host_descriptor_ID, service_descriptor_ID
-     * @param keys
-     * @return
+     *
+     * @param keys names
+     * @return list of ApplicationDescriptorResources
      */
     public List<Resource> populate(Object[] keys) {
         List<Resource> list = new ArrayList<Resource>();
@@ -137,17 +203,28 @@ public class ApplicationDescriptorResour
         queryGenerator.setParameter(ApplicationDescriptorConstants.HOST_DESC_ID, keys[2]);
         queryGenerator.setParameter(ApplicationDescriptorConstants.SERVICE_DESC_ID, keys[3]);
         Query q = queryGenerator.selectQuery(em);
-        Application_Descriptor applicationDescriptor = (Application_Descriptor)q.getSingleResult();
-        ApplicationDescriptorResource applicationDescriptorResource = (ApplicationDescriptorResource)Utils.getResource(ResourceType.APPLICATION_DESCRIPTOR, applicationDescriptor);
+        Application_Descriptor applicationDescriptor = (Application_Descriptor) q.getSingleResult();
+        ApplicationDescriptorResource applicationDescriptorResource =
+                (ApplicationDescriptorResource) Utils.getResource(
+                        ResourceType.APPLICATION_DESCRIPTOR, applicationDescriptor);
         end();
         list.add(applicationDescriptorResource);
         return list;
     }
 
+    /**
+     * 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) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     *  save application descriptor to database
+     */
     public void save() {
         begin();
         Application_Descriptor applicationDescriptor = new Application_Descriptor();
@@ -166,11 +243,22 @@ public class ApplicationDescriptorResour
 
     }
 
+    /**
+     * 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) {
         throw new UnsupportedOperationException();
     }
 
-	public void setName(String name) {
-		this.name = name;
-	}
+    /**
+     *
+     * @param name application descriptor name
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java Mon Sep 10 15:25:15 2012
@@ -37,37 +37,57 @@ public class ConfigurationResource exten
     private String configVal;
     private Date expireDate;
 
+    /**
+     *
+     */
     public ConfigurationResource() {
     }
 
+    /**
+     *
+     * @param configID configuration ID
+     */
     public ConfigurationResource(int configID) {
         this.configID = configID;
     }
 
+    /**
+     * Since Configuration does not depend on any other data structures at the
+     * system, this method is not valid
+     * @param type child resource types
+     * @return UnsupportedOperationException
+     */
     public Resource create(ResourceType type) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     * Since Configuration does not depend on any other data structures at the
+     * system, this method is not valid
+     * @param type child resource types
+     * @param name  name of the child resource
+     * throws UnsupportedOperationException
+     */
     public void remove(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
+
     /**
-     *  keys should be config key and config content
-     * @param keys
+     * Since Configuration does not depend on any other data structures at the
+     * system, this method is not valid
+     * @param type child resource types
+     * @param name  name of the child resource
+     * @return UnsupportedOperationException
      */
-    public void removeMe(Object[] keys) {
-
-    }
-
     public Resource get(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
     /**
      * key should be the configuration name
-     * @param keys
-     * @return
+     * @param keys names
+     * @return list of ConfigurationResources
      */
     public List<Resource> populate(Object[] keys) {
         List<Resource> list = new ArrayList<Resource>();
@@ -79,7 +99,8 @@ public class ConfigurationResource exten
         if (resultList.size() != 0) {
             for (Object result : resultList) {
                 Configuration configuration = (Configuration) result;
-                ConfigurationResource configurationResource = (ConfigurationResource)Utils.getResource(ResourceType.CONFIGURATION, configuration);
+                ConfigurationResource configurationResource =
+                        (ConfigurationResource)Utils.getResource(ResourceType.CONFIGURATION, configuration);
                 list.add(configurationResource);
             }
         }
@@ -88,23 +109,28 @@ public class ConfigurationResource exten
 
     }
 
-    public List<ConfigurationResource> getValues(){
-        return null;
-    }
-
+    /**
+     *
+     * Since Configuration does not depend on any other data structures at the
+     * system, this method is not valid
+     * @param type child resource types
+     * @return UnsupportedOperationException
+     */
     public List<Resource> get(ResourceType type) {
         throw new UnsupportedOperationException();
     }
 
-    public Date getExpireDate() {
-        return expireDate;
-
-    }
-
+    /**
+     *
+     * @param expireDate expire date of the configuration
+     */
     public void setExpireDate(Date expireDate) {
         this.expireDate = expireDate;
     }
 
+    /**
+     *  save configuration to database
+     */
     public void save() {
         begin();
         Configuration configuration = new Configuration();
@@ -118,26 +144,37 @@ public class ConfigurationResource exten
         end();
     }
 
+    /**
+     * Since Configuration does not depend on any other data structures at the
+     * system, this method is not valid
+     * @param type child resource types
+     * @param name of the child resource
+     * @return UnsupportedOperationException
+     */
     public boolean isExists(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
-    public int getConfigID() {
-        return configID;
-    }
-
-    public String getConfigKey() {
-        return configKey;
-    }
-
+    /**
+     *
+     * @return configuration value
+     */
     public String getConfigVal() {
         return configVal;
     }
 
+    /**
+     *
+     * @param configKey configuration key
+     */
     public void setConfigKey(String configKey) {
         this.configKey = configKey;
     }
 
+    /**
+     *
+     * @param configVal configuration value
+     */
     public void setConfigVal(String configVal) {
         this.configVal = configVal;
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java Mon Sep 10 15:25:15 2012
@@ -41,49 +41,72 @@ public class ExperimentResource extends 
     private GatewayResource gateway;
     private ProjectResource project;
 
+    /**
+     *
+     */
     public ExperimentResource() {
     }
 
-    public ExperimentResource(String expID) {
-        this.setExpID(expID);
-    }
-
-    public int getProjectID() {
-        return project.getId();
-    }
-
+    /**
+     *
+     * @return  experiment ID
+     */
     public String getExpID() {
         return expID;
     }
 
+    /**
+     *
+     * @return submitted date
+     */
     public Date getSubmittedDate() {
         return submittedDate;
     }
 
+    /**
+     *
+     * @param submittedDate  submitted date
+     */
     public void setSubmittedDate(Date submittedDate) {
         this.submittedDate = submittedDate;
     }
 
+    /**
+     * Since experiments are at the leaf level, this method is not
+     * valid for an experiment
+     * @param type  child resource types
+     * @return UnsupportedOperationException
+     */
     public Resource create(ResourceType type) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     * Since experiments are at the leaf level, this method is not
+     * valid for an experiment
+     * @param type  child resource types
+     * @param name name of the child resource
+     * @return UnsupportedOperationException
+     */
     public void remove(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
-    public void removeMe(Object[] keys) {
-
-    }
-
+    /**
+     * Since experiments are at the leaf level, this method is not
+     * valid for an experiment
+     * @param type  child resource types
+     * @param name name of the child resource
+     * @return UnsupportedOperationException
+     */
     public Resource get(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
     /**
      * key should be the experiment ID
-     * @param keys
-     * @return
+     * @param keys experiment ID
+     * @return ExperimentResource
      */
     public List<Resource> populate(Object[] keys) {
         List<Resource> list = new ArrayList<Resource>();
@@ -92,17 +115,27 @@ public class ExperimentResource extends 
         queryGenerator.setParameter(ExperimentConstants.EXPERIMENT_ID, keys[0]);
         Query q = queryGenerator.selectQuery(em);
         Experiment experiment = (Experiment)q.getSingleResult();
-        ExperimentResource experimentResource = (ExperimentResource)Utils.getResource(ResourceType.EXPERIMENT, experiment);
+        ExperimentResource experimentResource =
+                (ExperimentResource)Utils.getResource(ResourceType.EXPERIMENT, experiment);
         end();
         list.add(experimentResource);
         return list;
 
     }
 
+    /**
+     * Since experiments are at the leaf level, this method is not
+     * valid for an experiment
+     * @param type  child resource types
+     * @return UnsupportedOperationException
+     */
     public List<Resource> get(ResourceType type) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     * save experiment
+     */
     public void save() {
         begin();
         Experiment experiment = new Experiment();
@@ -112,7 +145,6 @@ public class ExperimentResource extends 
         user.setUser_name(getWorker().getUser());
         Gateway gateway = new Gateway();
         gateway.setGateway_name(getGateway().getGatewayName());
-
         experiment.setProject(project);
         experiment.setExperiment_ID(getExpID());
         experiment.setUser(user);
@@ -120,39 +152,72 @@ public class ExperimentResource extends 
         experiment.setSubmitted_date(submittedDate);
         em.persist(experiment);
         end();
-
-
     }
 
+    /**
+     * Since experiments are at the leaf level, this method is not
+     * valid for an experiment
+     * @param type  child resource types
+     * @param name name of the child resource
+     * @return UnsupportedOperationException
+     */
     public boolean isExists(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
-	public void setExpID(String expID) {
+    /**
+     *
+     * @param expID experiment ID
+     */
+    public void setExpID(String expID) {
 		this.expID = expID;
 	}
 
-	public GatewayResource getGateway() {
+    /**
+     *
+     * @return gatewayResource
+     */
+    public GatewayResource getGateway() {
 		return gateway;
 	}
 
-	public void setGateway(GatewayResource gateway) {
+    /**
+     *
+     * @param gateway gateway
+     */
+    public void setGateway(GatewayResource gateway) {
 		this.gateway = gateway;
 	}
 
-	public WorkerResource getWorker() {
+    /**
+     *
+     * @return worker for the gateway
+     */
+    public WorkerResource getWorker() {
 		return worker;
 	}
 
-	public void setWorker(WorkerResource worker) {
+    /**
+     *
+     * @param worker gateway worker
+     */
+    public void setWorker(WorkerResource worker) {
 		this.worker = worker;
 	}
 
-	public ProjectResource getProject() {
+    /**
+     *
+     * @return project
+     */
+    public ProjectResource getProject() {
 		return project;
 	}
 
-	public void setProject(ProjectResource project) {
+    /**
+     *
+     * @param project  project
+     */
+    public void setProject(ProjectResource project) {
 		this.project = project;
 	}
 }

Modified: incubator/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/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java Mon Sep 10 15:25:15 2012
@@ -34,13 +34,24 @@ public class GatewayResource extends Abs
     private String gatewayName;
     private String owner;
 
+    /**
+     *
+     * @param gatewayName gateway name
+     */
     public GatewayResource(String gatewayName) {
     	setGatewayName(gatewayName);
 	}
-    
+
+    /**
+     *
+     */
     public GatewayResource() {
 	}
-    
+
+    /**
+     *
+     * @return gateway name
+     */
     public String getGatewayName() {
         return gatewayName;
     }
@@ -49,14 +60,30 @@ public class GatewayResource extends Abs
         this.gatewayName = gatewayName;
     }
 
+    /**
+     *
+     * @return owner of the gateway
+     */
     public String getOwner() {
         return owner;
     }
 
+    /**
+     *
+     * @param owner owner of the gateway
+     */
     public void setOwner(String owner) {
         this.owner = owner;
     }
 
+    /**
+     * Gateway is at the root level.  So it can populate his child resources.
+     * Project, User, Published Workflows, User workflows, Host descriptors,
+     * Service Descriptors, Application descriptors and Experiments are all
+     * its children
+     * @param type resource type of the children
+     * @return specific child resource type
+     */
     public Resource create(ResourceType type) {
         switch (type) {
             case PROJECT:
@@ -84,7 +111,8 @@ public class GatewayResource extends Abs
                 serviceDescriptorResource.setGatewayName(gatewayName);
                 return serviceDescriptorResource;
             case APPLICATION_DESCRIPTOR:
-                ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource();
+                ApplicationDescriptorResource applicationDescriptorResource =
+                        new ApplicationDescriptorResource();
                 applicationDescriptorResource.setGatewayName(gatewayName);
                 return applicationDescriptorResource;
             case EXPERIMENT:
@@ -96,6 +124,11 @@ public class GatewayResource extends Abs
         }
     }
 
+    /**
+     * Child resources can be removed from a gateway
+     * @param type child resource type
+     * @param name child resource name
+     */
     public void remove(ResourceType type, Object name) {
         begin();
         Query q;
@@ -146,6 +179,12 @@ public class GatewayResource extends Abs
         }
     }
 
+    /**
+     * Gateway can get information of his children
+     * @param type child resource type
+     * @param name child resource name
+     * @return specific child resource type
+     */
     public Resource get(ResourceType type, Object name) {
         begin();
         QueryGenerator generator;
@@ -157,7 +196,8 @@ public class GatewayResource extends Abs
                 generator.setParameter(GatewayWorkerConstants.GATEWAY_NAME, gatewayName);
                 q = generator.selectQuery(em);
                 Users eUser = (Users) q.getSingleResult();
-                WorkerResource workerResource = (WorkerResource)Utils.getResource(ResourceType.GATEWAY_WORKER, eUser);
+                WorkerResource workerResource =
+                        (WorkerResource)Utils.getResource(ResourceType.GATEWAY_WORKER, eUser);
                 end();
                 return workerResource;
             case PUBLISHED_WORKFLOW:
@@ -166,7 +206,8 @@ public class GatewayResource extends Abs
                 generator.setParameter(PublishedWorkflowConstants.GATEWAY_NAME, gatewayName);
                 q = generator.selectQuery(em);
                 Published_Workflow ePub_workflow = (Published_Workflow) q.getSingleResult();
-                PublishWorkflowResource publishWorkflowResource = (PublishWorkflowResource)Utils.getResource(ResourceType.PUBLISHED_WORKFLOW, ePub_workflow);
+                PublishWorkflowResource publishWorkflowResource =
+                        (PublishWorkflowResource)Utils.getResource(ResourceType.PUBLISHED_WORKFLOW, ePub_workflow);
                 end();
                 return publishWorkflowResource;
             case HOST_DESCRIPTOR:
@@ -175,7 +216,8 @@ public class GatewayResource extends Abs
                 generator.setParameter(HostDescriptorConstants.GATEWAY_NAME, gatewayName);
                 q = generator.selectQuery(em);
                 Host_Descriptor eHostDesc = (Host_Descriptor) q.getSingleResult();
-                HostDescriptorResource hostDescriptorResource = (HostDescriptorResource)Utils.getResource(ResourceType.HOST_DESCRIPTOR, eHostDesc);
+                HostDescriptorResource hostDescriptorResource =
+                        (HostDescriptorResource)Utils.getResource(ResourceType.HOST_DESCRIPTOR, eHostDesc);
                 end();
                 return hostDescriptorResource;
             case EXPERIMENT:
@@ -184,7 +226,9 @@ public class GatewayResource extends Abs
                 generator.setParameter(ExperimentConstants.GATEWAY_NAME, gatewayName);
                 q = generator.selectQuery(em);
                 Experiment experiment = (Experiment)q.getSingleResult();
-                ExperimentResource experimentResource = (ExperimentResource)Utils.getResource(ResourceType.EXPERIMENT, experiment);
+                ExperimentResource experimentResource =
+                        (ExperimentResource)Utils.getResource(ResourceType.EXPERIMENT, experiment);
+                end();
                 return experimentResource;
             case SERVICE_DESCRIPTOR:
                 generator = new QueryGenerator(SERVICE_DESCRIPTOR);
@@ -192,17 +236,22 @@ public class GatewayResource extends Abs
                 generator.setParameter(ServiceDescriptorConstants.GATEWAY_NAME, gatewayName);
                 q = generator.selectQuery(em);
                 Service_Descriptor eServiceDesc = (Service_Descriptor) q.getSingleResult();
-                ServiceDescriptorResource serviceDescriptorResource = (ServiceDescriptorResource)Utils.getResource(ResourceType.SERVICE_DESCRIPTOR, eServiceDesc);
+                ServiceDescriptorResource serviceDescriptorResource =
+                        (ServiceDescriptorResource)Utils.getResource(ResourceType.SERVICE_DESCRIPTOR, eServiceDesc);
                 end();
                 return serviceDescriptorResource;
             default:
+                end();
                 throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
 
         }
-
-
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @return list of child resources
+     */
     public List<Resource> get(ResourceType type) {
         List<Resource> resourceList = new ArrayList<Resource>();
         begin();
@@ -218,7 +267,8 @@ public class GatewayResource extends Abs
                 if (results.size() != 0) {
                     for (Object result : results) {
                         Project project = (Project) result;
-                        ProjectResource projectResource = (ProjectResource)Utils.getResource(ResourceType.PROJECT, project);
+                        ProjectResource projectResource =
+                                (ProjectResource)Utils.getResource(ResourceType.PROJECT, project);
                         resourceList.add(projectResource);
                     }
                 }
@@ -231,7 +281,8 @@ public class GatewayResource extends Abs
                 if (results.size() != 0) {
                     for (Object result : results) {
                         Gateway_Worker gatewayWorker = (Gateway_Worker) result;
-                        WorkerResource workerResource = (WorkerResource)Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
+                        WorkerResource workerResource =
+                                (WorkerResource)Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
                         resourceList.add(workerResource);
                     }
                 }
@@ -244,7 +295,8 @@ public class GatewayResource extends Abs
                 if (results.size() != 0) {
                     for (Object result : results) {
                         Published_Workflow publishedWorkflow = (Published_Workflow) result;
-                        PublishWorkflowResource publishWorkflowResource = (PublishWorkflowResource)Utils.getResource(ResourceType.PUBLISHED_WORKFLOW, publishedWorkflow);
+                        PublishWorkflowResource publishWorkflowResource =
+                                (PublishWorkflowResource)Utils.getResource(ResourceType.PUBLISHED_WORKFLOW, publishedWorkflow);
                         resourceList.add(publishWorkflowResource);
                     }
                 }
@@ -257,7 +309,8 @@ public class GatewayResource extends Abs
                 if (results.size() != 0) {
                     for (Object result : results) {
                         Host_Descriptor hostDescriptor = (Host_Descriptor) result;
-                        HostDescriptorResource hostDescriptorResource = (HostDescriptorResource)Utils.getResource(ResourceType.HOST_DESCRIPTOR, hostDescriptor);
+                        HostDescriptorResource hostDescriptorResource =
+                                (HostDescriptorResource)Utils.getResource(ResourceType.HOST_DESCRIPTOR, hostDescriptor);
                         resourceList.add(hostDescriptorResource);
                     }
                 }
@@ -270,7 +323,8 @@ public class GatewayResource extends Abs
                 if (results.size() != 0) {
                     for (Object result : results) {
                         Service_Descriptor serviceDescriptor = (Service_Descriptor) result;
-                        ServiceDescriptorResource serviceDescriptorResource = (ServiceDescriptorResource)Utils.getResource(ResourceType.SERVICE_DESCRIPTOR, serviceDescriptor);
+                        ServiceDescriptorResource serviceDescriptorResource =
+                                (ServiceDescriptorResource)Utils.getResource(ResourceType.SERVICE_DESCRIPTOR, serviceDescriptor);
                         resourceList.add(serviceDescriptorResource);
                     }
                 }
@@ -283,7 +337,8 @@ public class GatewayResource extends Abs
                 if (results.size() != 0) {
                     for (Object result : results) {
                         Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
-                        ApplicationDescriptorResource applicationDescriptorResource = (ApplicationDescriptorResource)Utils.getResource(ResourceType.APPLICATION_DESCRIPTOR, applicationDescriptor);
+                        ApplicationDescriptorResource applicationDescriptorResource =
+                                (ApplicationDescriptorResource)Utils.getResource(ResourceType.APPLICATION_DESCRIPTOR, applicationDescriptor);
                         resourceList.add(applicationDescriptorResource);
                     }
                 }
@@ -296,7 +351,8 @@ public class GatewayResource extends Abs
                 if (results.size() != 0) {
                     for (Object result : results) {
                         Experiment experiment = (Experiment) result;
-                        ExperimentResource experimentResource = (ExperimentResource)Utils.getResource(ResourceType.EXPERIMENT, experiment);
+                        ExperimentResource experimentResource =
+                                (ExperimentResource)Utils.getResource(ResourceType.EXPERIMENT, experiment);
                         resourceList.add(experimentResource);
                     }
                 }
@@ -308,14 +364,24 @@ public class GatewayResource extends Abs
         return resourceList;
     }
 
+    /**
+     * save the gateway to the database
+     */
     public void save() {
         begin();
         Gateway gateway = new Gateway();
         gateway.setGateway_name(gatewayName);
+        gateway.setOwner(owner);
         em.persist(gateway);
         end();
     }
 
+    /**
+     * check whether child resource already exist in the database
+     * @param type child resource type
+     * @param name name of the child resource
+     * @return true or false
+     */
     public boolean isExists(ResourceType type, Object name) {
         begin();
         Query q;
@@ -375,24 +441,47 @@ public class GatewayResource extends Abs
         }
     }
 
+    /**
+     *
+     * @param descriptorName host descriptor name
+     * @return whether host descriptor already available
+     */
     public boolean isHostDescriptorExists(String descriptorName){
     	return isExists(ResourceType.HOST_DESCRIPTOR, descriptorName);
     }
-    
+
+    /**
+     *
+     * @param hostDescriptorName host descriptor name
+     * @return HostDescriptorResource
+     */
     public HostDescriptorResource createHostDescriptorResource(String hostDescriptorName){
     	HostDescriptorResource hdr = (HostDescriptorResource)create(ResourceType.HOST_DESCRIPTOR);
     	hdr.setHostDescName(hostDescriptorName);
     	return hdr;
     }
-    
+
+    /**
+     *
+     * @param hostDescriptorName host descriptor name
+     * @return HostDescriptorResource
+     */
     public HostDescriptorResource getHostDescriptorResource(String hostDescriptorName){
     	return (HostDescriptorResource)get(ResourceType.HOST_DESCRIPTOR,hostDescriptorName);
     }
-    
+
+    /**
+     *
+     * @param descriptorName host descriptor name
+     */
     public void removeHostDescriptor(String descriptorName){
     	remove(ResourceType.HOST_DESCRIPTOR, descriptorName);
     }
-    
+
+    /**
+     *
+     * @return list of host descriptors available for the gateway
+     */
     public List<HostDescriptorResource> getHostDescriptorResources(){
     	List<HostDescriptorResource> results=new ArrayList<HostDescriptorResource>();
     	List<Resource> list = get(ResourceType.HOST_DESCRIPTOR);
@@ -401,25 +490,48 @@ public class GatewayResource extends Abs
 		}
     	return results;
     }
-    
+
+    /**
+     *
+     * @param descriptorName service descriptor name
+     * @return whether service descriptor already available
+     */
     public boolean isServiceDescriptorExists(String descriptorName){
     	return isExists(ResourceType.SERVICE_DESCRIPTOR, descriptorName);
     }
-    
+
+    /**
+     *
+     * @param descriptorName  service descriptor name
+     * @return  ServiceDescriptorResource
+     */
     public ServiceDescriptorResource createServiceDescriptorResource(String descriptorName){
     	ServiceDescriptorResource hdr = (ServiceDescriptorResource)create(ResourceType.SERVICE_DESCRIPTOR);
     	hdr.setServiceDescName(descriptorName);
     	return hdr;
     }
-    
+
+    /**
+     *
+     * @param descriptorName   service descriptor name
+     * @return ServiceDescriptorResource
+     */
     public ServiceDescriptorResource getServiceDescriptorResource(String descriptorName){
     	return (ServiceDescriptorResource)get(ResourceType.SERVICE_DESCRIPTOR,descriptorName);
     }
-    
+
+    /**
+     *
+     * @param descriptorName Service descriptor name
+     */
     public void removeServiceDescriptor(String descriptorName){
     	remove(ResourceType.SERVICE_DESCRIPTOR, descriptorName);
     }
 
+    /**
+     *
+     * @return list of service descriptors for the gateway
+     */
     public List<ServiceDescriptorResource> getServiceDescriptorResources(){
     	List<ServiceDescriptorResource> results=new ArrayList<ServiceDescriptorResource>();
     	List<Resource> list = get(ResourceType.SERVICE_DESCRIPTOR);
@@ -428,25 +540,48 @@ public class GatewayResource extends Abs
 		}
     	return results;
     }
-    
+
+    /**
+     *
+     * @param descriptorName application descriptor name
+     * @return  whether application descriptor already available
+     */
     public boolean isApplicationDescriptorExists(String descriptorName){
     	return isExists(ResourceType.APPLICATION_DESCRIPTOR, descriptorName);
     }
-    
+
+    /**
+     *
+     * @param descriptorName  application descriptor name
+     * @return ApplicationDescriptorResource
+     */
     public ApplicationDescriptorResource createApplicationDescriptorResource(String descriptorName){
     	ApplicationDescriptorResource hdr = (ApplicationDescriptorResource)create(ResourceType.APPLICATION_DESCRIPTOR);
     	hdr.setName(descriptorName);
     	return hdr;
     }
-    
+
+    /**
+     *
+     * @param descriptorName application descriptor name
+     * @return ApplicationDescriptorResource
+     */
     public ApplicationDescriptorResource getApplicationDescriptorResource(String descriptorName){
     	return (ApplicationDescriptorResource)get(ResourceType.APPLICATION_DESCRIPTOR,descriptorName);
     }
-    
+
+    /**
+     *
+     * @param descriptorName  application descriptor name
+     */
     public void removeApplicationDescriptor(String descriptorName){
     	remove(ResourceType.APPLICATION_DESCRIPTOR, descriptorName);
     }
 
+    /**
+     *
+     * @return list of application descriptors for the gateway
+     */
     public List<ApplicationDescriptorResource> getApplicationDescriptorResources(){
     	List<ApplicationDescriptorResource> results=new ArrayList<ApplicationDescriptorResource>();
     	List<Resource> list = get(ResourceType.APPLICATION_DESCRIPTOR);
@@ -455,10 +590,17 @@ public class GatewayResource extends Abs
 		}
     	return results;
     }
-    
+
+    /**
+     *
+     * @param serviceName service descriptor name
+     * @param hostName host descriptor name
+     * @return  list of application descriptors for the gateway
+     */
     public List<ApplicationDescriptorResource> getApplicationDescriptorResources(String serviceName,String hostName){
         begin();
-        String qString = "SELECT p FROM Application_Descriptor p WHERE p.gateway_name =:gate_name and p.service_descriptor_ID =:service_name";
+        String qString = "SELECT p FROM Application_Descriptor p WHERE " +
+                "p.gateway_name =:gate_name and p.service_descriptor_ID =:service_name";
         if (hostName!=null){
         	qString+=" and p.host_descriptor_ID =:host_name";
         }
@@ -473,8 +615,12 @@ public class GatewayResource extends Abs
         if (results.size() != 0) {
             for (Object result : results) {
                 Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
-                ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID(),applicationDescriptor.getGateway().getGateway_name(),
-                        applicationDescriptor.getHost_descriptor_ID(), applicationDescriptor.getService_descriptor_ID());
+                ApplicationDescriptorResource applicationDescriptorResource =
+                        new ApplicationDescriptorResource(
+                                applicationDescriptor.getApplication_descriptor_ID(),
+                                applicationDescriptor.getGateway().getGateway_name(),
+                                applicationDescriptor.getHost_descriptor_ID(),
+                                applicationDescriptor.getService_descriptor_ID());
                 applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
                 applicationDescriptorResource.setUpdatedUser(applicationDescriptor.getUser().getUser_name());
                 resourceList.add(applicationDescriptorResource);
@@ -483,23 +629,43 @@ public class GatewayResource extends Abs
         end();
         return resourceList;
     }
-    
+
+    /**
+     *
+     * @param workflowTemplateName published workflow template name
+     * @return boolean - whether workflow with the same name exists
+     */
     public boolean isPublishedWorkflowExists(String workflowTemplateName){
     	return isExists(ResourceType.PUBLISHED_WORKFLOW, workflowTemplateName);
     }
-    
+
+    /**
+     *
+     * @param workflowTemplateName published workflow template name
+     * @return publish workflow resource
+     */
     public PublishWorkflowResource createPublishedWorkflow(String workflowTemplateName){
-    	PublishWorkflowResource publishedWorkflowResource = (PublishWorkflowResource)create(ResourceType.PUBLISHED_WORKFLOW);
+    	PublishWorkflowResource publishedWorkflowResource =
+                (PublishWorkflowResource)create(ResourceType.PUBLISHED_WORKFLOW);
     	publishedWorkflowResource.setName(workflowTemplateName);
     	publishedWorkflowResource.setPath("/");
     	publishedWorkflowResource.setVersion("1.0");
     	return publishedWorkflowResource;
     }
-    
+
+    /**
+     *
+     * @param workflowTemplateName published workflow template name
+     * @return publish workflow resource
+     */
     public PublishWorkflowResource getPublishedWorkflow(String workflowTemplateName){
     	return (PublishWorkflowResource)get(ResourceType.PUBLISHED_WORKFLOW,workflowTemplateName);
     }
-    
+
+    /**
+     *
+     * @return list of publish workflows for the gateway
+     */
     public List<PublishWorkflowResource> getPublishedWorkflows(){
     	List<PublishWorkflowResource> result=new ArrayList<PublishWorkflowResource>();
     	List<Resource> list = get(ResourceType.PUBLISHED_WORKFLOW);
@@ -508,7 +674,11 @@ public class GatewayResource extends Abs
 		}
     	return result;
     }
-    
+
+    /**
+     *
+     * @param workflowTemplateName published workflow template name
+     */
     public void removePublishedWorkflow(String workflowTemplateName){
     	remove(ResourceType.PUBLISHED_WORKFLOW, workflowTemplateName);
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java Mon Sep 10 15:25:15 2012
@@ -38,41 +38,73 @@ public class HostDescriptorResource exte
     private String userName;
     private String content;
 
-    public HostDescriptorResource(String hostDescName) {
-        this.setHostDescName(hostDescName);
-    }
-
+    /**
+     *
+     */
     public HostDescriptorResource() {
     }
 
+    /**
+     *
+     * @return user name
+     */
     public String getUserName() {
         return userName;
     }
 
+    /**
+     *
+     * @param userName user name
+     */
     public void setUserName(String userName) {
         this.userName = userName;
     }
 
+    /**
+     *
+     * @return  host descriptor name
+     */
     public String getHostDescName() {
         return hostDescName;
     }
 
+    /**
+     *
+     * @return gateway name
+     */
     public String getGatewayName() {
         return gatewayName;
     }
 
+    /**
+     *
+     * @return  content of the host descriptor
+     */
     public String getContent() {
         return content;
     }
 
+    /**
+     *
+     * @param gatewayName gateway name
+     */
     public void setGatewayName(String gatewayName) {
         this.gatewayName = gatewayName;
     }
 
+    /**
+     *
+     * @param content content of the host descriptor
+     */
     public void setContent(String content) {
         this.content = content;
     }
 
+    /**
+     * Host descriptor can create an application descriptor
+     * @param type child resource type
+     * @return child resource
+     */
     public Resource create(ResourceType type) {
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource();
@@ -83,18 +115,29 @@ public class HostDescriptorResource exte
         return null;
     }
 
+    /**
+     * Host descriptor by alone cannot remove any other resource types
+     * @param type child resource type
+     * @param name child resource name
+     */
     public void remove(ResourceType type, Object name) {
        throw new UnsupportedOperationException();
     }
 
+    /**
+     * Host descriptor by alone cannot get any other resource types
+     * @param type child resource type
+     * @param name child resource name
+     * @return UnsupportedOperationException
+     */
     public Resource get(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
     /**
      * key should be host_descriptor_name
-     * @param keys
-     * @return
+     * @param keys host descriptor names
+     * @return list of host descriptors
      */
     public List<Resource> populate(Object[] keys) {
         List<Resource> list = new ArrayList<Resource>();
@@ -104,12 +147,18 @@ public class HostDescriptorResource exte
         generator.setParameter(HostDescriptorConstants.HOST_DESC_ID, keys[1]);
         Query q = generator.selectQuery(em);
         Host_Descriptor hostDescriptor = (Host_Descriptor)q.getSingleResult();
-        HostDescriptorResource hostDescriptorResource = (HostDescriptorResource)Utils.getResource(ResourceType.HOST_DESCRIPTOR, hostDescriptor);
+        HostDescriptorResource hostDescriptorResource =
+                (HostDescriptorResource)Utils.getResource(ResourceType.HOST_DESCRIPTOR, hostDescriptor);
         end();
         list.add(hostDescriptorResource);
         return list;
     }
 
+    /**
+     * Host descriptors can get a list of application descriptors
+     * @param type child resource type
+     * @return list of child resources
+     */
     public List<Resource> get(ResourceType type) {
         List<Resource> resourceList = new ArrayList<Resource>();
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
@@ -122,7 +171,9 @@ public class HostDescriptorResource exte
             if (results.size() != 0) {
                 for (Object result : results) {
                     Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
-                    ApplicationDescriptorResource applicationDescriptorResource = (ApplicationDescriptorResource)Utils.getResource(ResourceType.APPLICATION_DESCRIPTOR, applicationDescriptor);
+                    ApplicationDescriptorResource applicationDescriptorResource =
+                            (ApplicationDescriptorResource)Utils.getResource(
+                                    ResourceType.APPLICATION_DESCRIPTOR, applicationDescriptor);
                     resourceList.add(applicationDescriptorResource);
                 }
             }
@@ -131,6 +182,9 @@ public class HostDescriptorResource exte
         return resourceList;
     }
 
+    /**
+     * save host descriptor to the database
+     */
     public void save() {
         begin();
         Host_Descriptor hostDescriptor = new Host_Descriptor();
@@ -147,11 +201,21 @@ public class HostDescriptorResource exte
 
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @param name child resource name
+     * @return boolean whether the child resource already exists
+     */
     public boolean isExists(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
-	public void setHostDescName(String hostDescName) {
+    /**
+     *
+     * @param hostDescName host descriptor name
+     */
+    public void setHostDescName(String hostDescName) {
 		this.hostDescName = hostDescName;
 	}
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java Mon Sep 10 15:25:15 2012
@@ -40,19 +40,29 @@ public class ProjectResource extends Abs
     private GatewayResource gateway;
     private WorkerResource worker;
 
+    /**
+     *
+     */
     public ProjectResource() {
     }
 
-    public ProjectResource(int id) {
-        this.id = id;
-    }
-
+    /**
+     *
+     * @param worker gateway worker
+     * @param gateway gateway
+     * @param id project id
+     */
     public ProjectResource(WorkerResource worker, GatewayResource gateway, int id) {
         this.setWorker(worker);
         this.setGateway(gateway);
         this.id = id;
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @return child resource
+     */
     public Resource create(ResourceType type) {
         if (type == ResourceType.EXPERIMENT) {
             ExperimentResource experimentResource = new ExperimentResource();
@@ -65,6 +75,11 @@ public class ProjectResource extends Abs
         }
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @param name child resource name
+     */
     public void remove(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.EXPERIMENT) {
@@ -78,6 +93,12 @@ public class ProjectResource extends Abs
         end();
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @param name child resource name
+     * @return child resource
+     */
     public Resource get(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.EXPERIMENT) {
@@ -87,13 +108,19 @@ public class ProjectResource extends Abs
         	generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
         	Query q = generator.selectQuery(em);
             Experiment experiment = (Experiment) q.getSingleResult();
-            ExperimentResource experimentResource = (ExperimentResource)Utils.getResource(ResourceType.EXPERIMENT, experiment);
+            ExperimentResource experimentResource = (ExperimentResource)
+                    Utils.getResource(ResourceType.EXPERIMENT, experiment);
             end();
             return experimentResource;
         }
         return null;
     }
 
+    /**
+     *
+     * @param keys project name
+     * @return project resource
+     */
     public List<Resource> populate(Object[] keys) {
         List<Resource> list = new ArrayList<Resource>();
         begin();
@@ -104,7 +131,8 @@ public class ProjectResource extends Abs
         if (resultList.size() != 0) {
             for (Object result : resultList) {
                 Project project = (Project) result;
-                ProjectResource projectResource = (ProjectResource)Utils.getResource(ResourceType.PROJECT, project);
+                ProjectResource projectResource = (ProjectResource)
+                        Utils.getResource(ResourceType.PROJECT, project);
                 list.add(projectResource);
             }
         }
@@ -112,6 +140,11 @@ public class ProjectResource extends Abs
         return list;
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @return list of child resources
+     */
     public List<Resource> get(ResourceType type) {
         List<Resource> resourceList = new ArrayList<Resource>();
         begin();
@@ -123,7 +156,8 @@ public class ProjectResource extends Abs
             if (results.size() != 0) {
                 for (Object result : results) {
                     Experiment experiment = (Experiment) result;
-                    ExperimentResource experimentResource = (ExperimentResource)Utils.getResource(ResourceType.USER, experiment);
+                    ExperimentResource experimentResource = (ExperimentResource)
+                            Utils.getResource(ResourceType.USER, experiment);
                     resourceList.add(experimentResource);
                 }
             }
@@ -132,6 +166,9 @@ public class ProjectResource extends Abs
         return resourceList;
     }
 
+    /**
+     * save project to the database
+     */
     public void save() {
         begin();
         Project project = new Project();
@@ -150,49 +187,96 @@ public class ProjectResource extends Abs
 
     }
 
+    /**
+     *
+     * @return project name
+     */
     public String getName() {
         return name;
     }
 
+    /**
+     *
+     * @param name  project name
+     */
     public void setName(String name) {
         this.name = name;
     }
 
+    /**
+     *
+     * @return project ID
+     */
     public int getId() {
         return id;
     }
 
-	public WorkerResource getWorker() {
+    /**
+     *
+     * @return gateway worker
+     */
+    public WorkerResource getWorker() {
 		return worker;
 	}
 
-	public void setWorker(WorkerResource worker) {
+    /**
+     *
+     * @param worker gateway worker
+     */
+    public void setWorker(WorkerResource worker) {
 		this.worker = worker;
 	}
 
-	public GatewayResource getGateway() {
+    /**
+     *
+     * @return gateway resource
+     */
+    public GatewayResource getGateway() {
 		return gateway;
 	}
 
-	public void setGateway(GatewayResource gateway) {
+    /**
+     *
+     * @param gateway gateway resource
+     */
+    public void setGateway(GatewayResource gateway) {
 		this.gateway = gateway;
 	}
 
-	public boolean isExperimentExists(String experimentId){
+    /**
+     *
+     * @param experimentId experiment ID
+     * @return whether the experiment exist
+     */
+    public boolean isExperimentExists(String experimentId){
 		return isExists(ResourceType.EXPERIMENT, experimentId);
 	}
-	
-	public ExperimentResource createExperiment(String experimentId){
+
+    /**
+     *
+     * @param experimentId experiment ID
+     * @return  experiment resource
+     */
+    public ExperimentResource createExperiment(String experimentId){
 		ExperimentResource experimentResource = (ExperimentResource)create(ResourceType.EXPERIMENT);
 		experimentResource.setExpID(experimentId);
 		return experimentResource;
 	}
-	
+
+    /**
+     *
+     * @param experimentId experiment ID
+     * @return experiment resource
+     */
 	public ExperimentResource getExperiment(String experimentId){
 		return (ExperimentResource)get(ResourceType.EXPERIMENT,experimentId);
 	}
-	
-	public List<ExperimentResource> getExperiments(){
+
+    /**
+     *
+     * @return  list of experiments
+     */
+    public List<ExperimentResource> getExperiments(){
 		List<Resource> list = get(ResourceType.EXPERIMENT);
 		List<ExperimentResource> result=new ArrayList<ExperimentResource>();
 		for (Resource resource : list) {
@@ -200,8 +284,12 @@ public class ProjectResource extends Abs
 		}
 		return result;
 	}
-	
-	public void removeExperiment(String experimentId){
+
+    /**
+     *
+     * @param experimentId experiment ID
+     */
+    public void removeExperiment(String experimentId){
 		remove(ResourceType.EXPERIMENT, experimentId);
 	}
 

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java Mon Sep 10 15:25:15 2012
@@ -41,69 +41,144 @@ public class PublishWorkflowResource ext
     private String createdUser;
     private String path;
 
+    /**
+     *
+     */
     public PublishWorkflowResource() {
     }
 
+    /**
+     *
+     * @param gateway gateway resource
+     */
     public PublishWorkflowResource(GatewayResource gateway) {
         this.gateway = gateway;
     }
 
+    /**
+     *
+     * @return created user
+     */
     public String getCreatedUser() {
         return createdUser;
     }
 
+    /**
+     *
+     * @return path of the workflow
+     */
     public String getPath() {
         return path;
     }
 
+    /**
+     *
+     * @param createdUser  created user
+     */
     public void setCreatedUser(String createdUser) {
         this.createdUser = createdUser;
     }
 
+    /**
+     *
+     * @param path path of the workflow
+     */
     public void setPath(String path) {
         this.path = path;
     }
 
+    /**
+     *
+     * @return name of the publish workflow
+     */
     public String getName() {
         return name;
     }
 
+    /**
+     *
+     * @return version
+     */
     public String getVersion() {
         return version;
     }
 
+    /**
+     *
+     * @return published date
+     */
     public Date getPublishedDate() {
         return publishedDate;
     }
 
+    /**
+     *
+     * @return content of the workflow
+     */
     public String getContent() {
         return content;
     }
 
+    /**
+     *
+     * @param version version of the workflow
+     */
     public void setVersion(String version) {
         this.version = version;
     }
 
+    /**
+     *
+     * @param publishedDate published date of the workflow
+     */
     public void setPublishedDate(Date publishedDate) {
         this.publishedDate = publishedDate;
     }
 
+    /**
+     *
+     * @param content content of the workflow
+     */
     public void setContent(String content) {
         this.content = content;
     }
 
+    /**
+     * Since published workflows are at the leaf level of the
+     * data structure, this method is not valid
+     * @param type type of the child resource
+     * @return UnsupportedOperationException
+     */
     public Resource create(ResourceType type) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     * Since published workflows are at the leaf level of the
+     * data structure, this method is not valid
+     * @param type type of the child resource
+     * @param name name of the child resource
+     */
     public void remove(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     * Since published workflows are at the leaf level of the
+     * data structure, this method is not valid
+     * @param type type of the child resource
+     * @param name name of the child resource
+     * @return UnsupportedOperationException
+     */
     public Resource get(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     *
+     * @param keys object list including gateway name and published workflow name
+     * @return published workflow resource
+     */
     public List<Resource> populate(Object[] keys) {
         List<Resource> list = new ArrayList<Resource>();
         begin();
@@ -112,16 +187,26 @@ public class PublishWorkflowResource ext
         generator.setParameter(PublishedWorkflowConstants.PUBLISH_WORKFLOW_NAME, keys[1]);
         Query q = generator.selectQuery(em);
         Published_Workflow publishedWorkflow = (Published_Workflow)q.getSingleResult();
-        PublishWorkflowResource publishWorkflowResource = (PublishWorkflowResource)Utils.getResource(ResourceType.PUBLISHED_WORKFLOW, publishedWorkflow);
+        PublishWorkflowResource publishWorkflowResource = (PublishWorkflowResource)
+                Utils.getResource(ResourceType.PUBLISHED_WORKFLOW, publishedWorkflow);
         end();
         list.add(publishWorkflowResource);
         return list;
     }
 
+    /**
+     * since published workflows are at the leaf level of the
+     * data structure, this method is not valid
+     * @param type type of the child resource
+     * @return UnsupportedOperationException
+     */
     public List<Resource> get(ResourceType type) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     * save published workflow to the database
+     */
     public void save() {
         begin();
         Published_Workflow publishedWorkflow = new Published_Workflow();
@@ -140,19 +225,38 @@ public class PublishWorkflowResource ext
     }
 
 
+    /**
+     * Since published workflows are at the leaf level of the
+     * data structure, this method is not valid
+     * @param type type of the child resource
+     * @param name name of the child resource
+     * @return UnsupportedOperationException
+     */
     public boolean isExists(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
-	public GatewayResource getGateway() {
+    /**
+     *
+     * @return gateway resource
+     */
+    public GatewayResource getGateway() {
 		return gateway;
 	}
 
-	public void setGateway(GatewayResource gateway) {
+    /**
+     *
+     * @param gateway gateway resource
+     */
+    public void setGateway(GatewayResource gateway) {
 		this.gateway = gateway;
 	}
 
-	public void setName(String name) {
+    /**
+     *
+     * @param name published workflow name
+     */
+    public void setName(String name) {
 		this.name = name;
 	}
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java Mon Sep 10 15:25:15 2012
@@ -20,7 +20,6 @@
 */
 package org.apache.airavata.persistance.registry.jpa.resources;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
@@ -33,42 +32,84 @@ public class UserResource extends Abstra
     private String gatewayName;
     private ProjectResource projectResource;
 
+    /**
+     *
+     */
     public UserResource() {
     }
 
+    /**
+     *
+     * @param userName user name
+     */
     public void setUserName(String userName) {
         this.userName = userName;
     }
 
+    /**
+     *
+     * @return user name
+     */
     public String getUserName() {
         return userName;
     }
 
+    /**
+     *
+     * @return gateway name
+     */
     public String getGatewayName() {
         return gatewayName;
     }
 
+    /**
+     *
+     * @param gatewayName gateway name
+     */
     public void setGatewayName(String gatewayName) {
         this.gatewayName = gatewayName;
     }
 
+    /**
+     * User is a hypothical data structure.
+     * @param type child resource type
+     * @return child resource
+     */
     public Resource create(ResourceType type) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @param name child resource name
+     */
     public void remove(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @param name child resource name
+     * @return UnsupportedOperationException
+     */
     public Resource get(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @return UnsupportedOperationException
+     */
     public List<Resource> get(ResourceType type) {
-        List<Resource> resourceList = new ArrayList<Resource>();
-        return resourceList;
+        throw new UnsupportedOperationException();
     }
 
+    /**
+     * save user to the database
+     */
     public void save() {
         begin();
         Users user = new Users();
@@ -78,22 +119,44 @@ public class UserResource extends Abstra
         end();
     }
 
+    /**
+     *
+     * @param type child resource type
+     * @param name child resource name
+     * @return UnsupportedOperationException
+     */
     public boolean isExists(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     *
+     * @return project resource
+     */
     public ProjectResource getProjectResource() {
         return projectResource;
     }
 
+    /**
+     *
+     * @param projectResource project resource
+     */
     public void setProjectResource(ProjectResource projectResource) {
         this.projectResource = projectResource;
     }
 
+    /**
+     *
+     * @return  password
+     */
     public String getPassword() {
         return password;
     }
 
+    /**
+     *
+     * @param password  password
+     */
     public void setPassword(String password) {
         this.password = password;
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java Mon Sep 10 15:25:15 2012
@@ -96,7 +96,7 @@ public class UserWorkflowResource extend
     /**
      *
      * @param keys should be in the order of gateway_name,user_name and user_workflow_name
-     * @return
+     * @return resource list
      */
     public List<Resource> populate(Object[] keys) {
         List<Resource> list = new ArrayList<Resource>();
@@ -107,7 +107,8 @@ public class UserWorkflowResource extend
         queryGenerator.setParameter(UserWorkflowConstants.TEMPLATE_NAME, keys[2]);
         Query q = queryGenerator.selectQuery(em);
         User_Workflow userWorkflow = (User_Workflow)q.getSingleResult();
-        UserWorkflowResource userWorkflowResource = (UserWorkflowResource)Utils.getResource(ResourceType.USER_WORKFLOW, userWorkflow);
+        UserWorkflowResource userWorkflowResource = (UserWorkflowResource)Utils.getResource(
+                ResourceType.USER_WORKFLOW, userWorkflow);
         end();
         list.add(userWorkflowResource);
         return list;



Mime
View raw message