airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1382939 [2/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
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.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/Utils.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/Utils.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
Mon Sep 10 15:25:15 2012
@@ -26,7 +26,13 @@ import org.apache.airavata.persistance.r
 
 
 public class Utils {
-    
+
+    /**
+     *
+     * @param type model type
+     * @param o model type instance
+     * @return corresponding resource object
+     */
     static Resource getResource(ResourceType type, Object o) {
         switch (type){
             case GATEWAY:
@@ -101,12 +107,22 @@ public class Utils {
 
     }
 
+    /**
+     *
+     * @param o  Gateway model object
+     * @return  GatewayResource object
+     */
     private static Resource createGateway(Gateway o) {
         GatewayResource gatewayResource = new GatewayResource();
         gatewayResource.setGatewayName(o.getGateway_name());
         return gatewayResource;
     }
 
+    /**
+     *
+     * @param o Project model object
+     * @return ProjectResource object
+     */
     private static Resource createProject(Project o) {
         ProjectResource projectResource = new ProjectResource();
         projectResource.setName(o.getProject_name());
@@ -120,6 +136,11 @@ public class Utils {
         return projectResource;
     }
 
+    /**
+     *
+     * @param o configuration model object
+     * @return configuration resource object
+     */
     private static Resource createConfiguration (Configuration o){
         ConfigurationResource configurationResource = new ConfigurationResource();
         configurationResource.setConfigKey(o.getConfig_key());
@@ -128,6 +149,11 @@ public class Utils {
         return configurationResource;
     }
 
+    /**
+     *
+     * @param o application descriptor model object
+     * @return  application descriptor resource object
+     */
     private static Resource createApplicationDescriptor(Application_Descriptor o) {
         ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource();
         applicationDescriptorResource.setName(o.getApplication_descriptor_ID());
@@ -139,6 +165,11 @@ public class Utils {
         return applicationDescriptorResource;
     }
 
+    /**
+     *
+     * @param o Experiment model object
+     * @return  Experiment resource object
+     */
     private static Resource createExperiment(Experiment o) {
         ExperimentResource experimentResource = new ExperimentResource();
         GatewayResource gatewayResource = (GatewayResource)createGateway(o.getGateway());
@@ -154,12 +185,21 @@ public class Utils {
         return experimentResource;
     }
 
+    /**
+     *
+     * @param o Gateway_Worker model object
+     * @return  Gateway_Worker resource object
+     */
     private static Resource createGatewayWorker(Gateway_Worker o) {
         GatewayResource gatewayResource = (GatewayResource)createGateway(o.getGateway());
-        WorkerResource workerResource = new WorkerResource(o.getUser().getUser_name(),gatewayResource);
-        return workerResource;
+        return new WorkerResource(o.getUser().getUser_name(),gatewayResource);
     }
 
+    /**
+     *
+     * @param o Host_Descriptor model object
+     * @return  HostDescriptor resource object
+     */
     private static Resource createHostDescriptor(Host_Descriptor o) {
         HostDescriptorResource hostDescriptorResource = new HostDescriptorResource();
         hostDescriptorResource.setGatewayName(o.getGateway().getGateway_name());
@@ -169,6 +209,11 @@ public class Utils {
         return hostDescriptorResource;
     }
 
+    /**
+     *
+     * @param o  Published_Workflow model object
+     * @return  Published Workflow resource object
+     */
     private static Resource createPublishWorkflow(Published_Workflow o) {
         PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource();
         GatewayResource gatewayResource = (GatewayResource)createGateway(o.getGateway());
@@ -182,6 +227,11 @@ public class Utils {
         return publishWorkflowResource;
     }
 
+    /**
+     *
+     * @param o Service_Descriptor model object
+     * @return ServiceDescriptor resource object
+     */
     private static Resource createServiceDescriptor(Service_Descriptor o) {
         ServiceDescriptorResource serviceDescriptorResource = new ServiceDescriptorResource();
         serviceDescriptorResource.setGatewayName(o.getGateway().getGateway_name());
@@ -191,6 +241,11 @@ public class Utils {
         return serviceDescriptorResource;
     }
 
+    /**
+     *
+     * @param o User_Workflow model object
+     * @return User_Workflow resource object
+     */
     private static Resource createUserWorkflow(User_Workflow o) {
         UserWorkflowResource userWorkflowResource = new UserWorkflowResource();
         userWorkflowResource.setName(o.getTemplate_name());
@@ -207,6 +262,11 @@ public class Utils {
         return userWorkflowResource;
     }
 
+    /**
+     *
+     * @param o  Users model object
+     * @return  UserResource object
+     */
     private static Resource createUser(Users o) {
         UserResource userResource = new UserResource();
         userResource.setUserName(o.getUser_name());

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.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/WorkerResource.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/WorkerResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
Mon Sep 10 15:25:15 2012
@@ -35,11 +35,21 @@ public class WorkerResource extends Abst
 	private String user;
 	private GatewayResource gateway;
 
-	public WorkerResource(String user, GatewayResource gateway) {
+    /**
+     *
+     * @param user username
+     * @param gateway  gatewayResource
+     */
+    public WorkerResource(String user, GatewayResource gateway) {
 		this.setUser(user);
 		this.gateway=gateway;
 	}
-	
+
+    /**
+     * Gateway worker can create child data structures such as projects and user workflows
+     * @param type child resource type
+     * @return  child resource
+     */
 	public Resource create(ResourceType type) {
 		Resource result = null;
 		switch (type) {
@@ -60,6 +70,11 @@ public class WorkerResource extends Abst
 		return result;
 	}
 
+    /**
+     *
+     * @param type child resource type
+     * @param name child resource name
+     */
 	public void remove(ResourceType type, Object name) {
 		begin();
         Query q;
@@ -94,6 +109,12 @@ public class WorkerResource extends Abst
 		end();
 	}
 
+    /**
+     *
+     * @param type child resource type
+     * @param name child resource name
+     * @return child resource
+     */
 	public Resource get(ResourceType type, Object name) {
 		Resource result = null;
 		begin();
@@ -107,8 +128,7 @@ public class WorkerResource extends Abst
                 generator.setParameter(ProjectConstants.GATEWAY_NAME, gateway.getGatewayName());
                 q = generator.selectQuery(em);
 	            Project project = (Project) q.getSingleResult();
-	            ProjectResource projectResource = (ProjectResource)Utils.getResource(ResourceType.PROJECT,
project);
-	            result=projectResource;
+                result= Utils.getResource(ResourceType.PROJECT, project);
 				break;
 			case USER_WORKFLOW:
                 generator = new QueryGenerator(USER_WORKFLOW);
@@ -117,8 +137,7 @@ public class WorkerResource extends Abst
                 generator.setParameter(UserWorkflowConstants.GATEWAY_NAME, gateway.getGatewayName());
                 q = generator.selectQuery(em);
 	            User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
-	            UserWorkflowResource userWorkflowResource = (UserWorkflowResource)Utils.getResource(ResourceType.USER_WORKFLOW,
userWorkflow);
-	            result=userWorkflowResource;
+                result= Utils.getResource(ResourceType.USER_WORKFLOW, userWorkflow);
 	            break;
 			case EXPERIMENT:
                 generator = new QueryGenerator(EXPERIMENT);
@@ -126,8 +145,7 @@ public class WorkerResource extends Abst
                 generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
                 q = generator.selectQuery(em);
 	            Experiment experiment = (Experiment) q.getSingleResult();
-	            ExperimentResource experimentResource = (ExperimentResource)Utils.getResource(ResourceType.EXPERIMENT,
experiment);
-	            result=experimentResource;
+                result= Utils.getResource(ResourceType.EXPERIMENT, experiment);
 				break;
 			default:
 				break;
@@ -136,7 +154,12 @@ public class WorkerResource extends Abst
 		return result;
 	}
 
-	public List<Resource> get(ResourceType type) {
+    /**
+     *
+     * @param type child resource type
+     * @return list of child resources
+     */
+    public List<Resource> get(ResourceType type) {
 		List<Resource> result = new ArrayList<Resource>();
 		begin();
         QueryGenerator generator;
@@ -182,6 +205,9 @@ public class WorkerResource extends Abst
 		return result;
 	}
 
+    /**
+     * save gateway worker to database
+     */
 	public void save() {
         begin();
         Gateway_Worker gatewayWorker = new Gateway_Worker();
@@ -195,41 +221,80 @@ public class WorkerResource extends Abst
         end();
 	}
 
+    /**
+     *
+     * @return user name
+     */
 	public String getUser() {
 		return user;
 	}
 
-	public void setUser(String user) {
+    /**
+     *
+     * @param user user name
+     */
+    public void setUser(String user) {
 		this.user = user;
 	}
 
+    /**
+     *
+     * @return gateway resource
+     */
     public GatewayResource getGateway() {
         return gateway;
     }
 
+    /**
+     *
+     * @param gateway  gateway resource
+     */
     public void setGateway(GatewayResource gateway) {
         this.gateway = gateway;
     }
 
+    /**
+     *
+     * @param name  project name
+     * @return whether the project is available under the user
+     */
     public boolean isProjectExists(String name){
 		return isExists(ResourceType.PROJECT, name);
 	}
-	
+
+    /**
+     *
+     * @param name project name
+     * @return project resource for the user
+     */
 	public ProjectResource createProject(String name){
 		ProjectResource project=(ProjectResource)create(ResourceType.PROJECT);
 		project.setName(name);
 		return project;
 	}
-	
+
+    /**
+     *
+     * @param name project name
+     * @return project resource
+     */
 	public ProjectResource getProject(String name){
 		return (ProjectResource)get(ResourceType.PROJECT, name);
 	}
-	
+
+    /**
+     *
+     * @param name project name
+     */
 	public void removeProject(String name){
 		remove(ResourceType.PROJECT, name);
 	}
-	
-	public List<ProjectResource> getProjects(){
+
+    /**
+     *
+     * @return  list of projects for the user
+     */
+    public List<ProjectResource> getProjects(){
 		List<ProjectResource> result=new ArrayList<ProjectResource>();
 		List<Resource> list = get(ResourceType.PROJECT);
 		for (Resource resource : list) {
@@ -237,26 +302,49 @@ public class WorkerResource extends Abst
 		}
 		return result;
 	}
-	
+
+    /**
+     *
+     * @param templateName user workflow template
+     * @return whether the workflow is already exists under the given user
+     */
 	public boolean isWorkflowTemplateExists(String templateName){
 		return isExists(ResourceType.USER_WORKFLOW, templateName);
 	}
-	
+
+    /**
+     *
+     * @param templateName user workflow template
+     * @return user workflow resource
+     */
 	public UserWorkflowResource createWorkflowTemplate(String templateName){
 		UserWorkflowResource workflow=(UserWorkflowResource)create(ResourceType.USER_WORKFLOW);
 		workflow.setName(templateName);
 		return workflow;
 	}
-	
+
+    /**
+     *
+     * @param templateName user workflow template
+     * @return user workflow resource
+     */
 	public UserWorkflowResource getWorkflowTemplate(String templateName){
 		return (UserWorkflowResource)get(ResourceType.USER_WORKFLOW, templateName);
 	}
-	
-	public void removeWorkflowTemplate(String templateName){
+
+    /**
+     *
+     * @param templateName user workflow template
+     */
+    public void removeWorkflowTemplate(String templateName){
 		remove(ResourceType.USER_WORKFLOW, templateName);
 	}
-	
-	public List<UserWorkflowResource> getWorkflowTemplates(){
+
+    /**
+     *
+     * @return list of user workflows for the given user
+     */
+    public List<UserWorkflowResource> getWorkflowTemplates(){
 		List<UserWorkflowResource> result=new ArrayList<UserWorkflowResource>();
 		List<Resource> list = get(ResourceType.USER_WORKFLOW);
 		for (Resource resource : list) {
@@ -264,15 +352,29 @@ public class WorkerResource extends Abst
 		}
 		return result;
 	}
-	
+
+    /**
+     *
+     * @param name experiment name
+     * @return whether experiment is already exist for the given user
+     */
 	public boolean isExperimentExists(String name){
 		return isExists(ResourceType.EXPERIMENT, name);
 	}
-	
-	public ExperimentResource getExperiment(String name){
+
+    /**
+     *
+     * @param name experiment name
+     * @return experiment resource
+     */
+    public ExperimentResource getExperiment(String name){
 		return (ExperimentResource)get(ResourceType.EXPERIMENT, name);
 	}
-	
+
+    /**
+     *
+     * @return list of experiments for the user
+     */
 	public List<ExperimentResource> getExperiments(){
 		List<ExperimentResource> result=new ArrayList<ExperimentResource>();
 		List<Resource> list = get(ResourceType.EXPERIMENT);
@@ -281,7 +383,11 @@ public class WorkerResource extends Abst
 		}
 		return result;
 	}
-	
+
+    /**
+     *
+     * @param experimentId  experiment name
+     */
 	public void removeExperiment(String experimentId){
 		remove(ResourceType.EXPERIMENT, experimentId);
 	}

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml?rev=1382939&r1=1382938&r2=1382939&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
Mon Sep 10 15:25:15 2012
@@ -57,8 +57,8 @@
             <property name="openjpa.ConnectionURL"
                       value="jdbc:mysql://localhost:3306/persitant_data" />
             <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver"
/>
-            <property name="openjpa.ConnectionUserName" value="root" />
-            <property name="openjpa.ConnectionPassword" value="root123" />
+            <property name="openjpa.ConnectionUserName" value="airavata" />
+            <property name="openjpa.ConnectionPassword" value="airavata" />
             <property name="openjpa.DynamicEnhancementAgent" value="true" />
             <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
             <property name="openjpa.Log" value="SQL=TRACE" />



Mime
View raw message