Author: lahiru
Date: Fri Dec 27 21:15:16 2013
New Revision: 1553744

URL: http://svn.apache.org/r1553744
Log:
dding orchestrator registry.

Added:
    
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java
Modified:
    
airavata/sandbox/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    
airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
    
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
    
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java

Modified: 
airavata/sandbox/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: 
http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1553744&r1=1553743&r2=1553744&view=diff
==============================================================================
--- 
airavata/sandbox/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
 (original)
+++ 
airavata/sandbox/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
 Fri Dec 27 21:15:16 2013
@@ -33,6 +33,7 @@ import java.util.Map;
 import java.util.regex.Pattern;
 
 import org.apache.airavata.common.exception.AiravataConfigurationException;
+import org.apache.airavata.common.utils.AiravataJobState;
 import org.apache.airavata.common.utils.DBUtil;
 import org.apache.airavata.common.utils.Version;
 import org.apache.airavata.commons.gfac.type.ApplicationDescription;
@@ -2585,4 +2586,48 @@ public class AiravataJPARegistry extends
                throw new RegistryException("Error while accesing registrty 
settings ", e);
                }
     }
+
+    /**
+     *These are the methods inherited from Orchestrator Registry
+     */
+
+     public List<URI> getLiveGFacURIs() throws RegistryException {
+        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    public boolean storeExperiment(String userName, String experimentID) 
throws RegistryException {
+        return false;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    public boolean changeStatus(String userName, String experimentID, 
AiravataJobState state) throws RegistryException {
+        return false;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    public AiravataJobState getState(String experimentID) throws 
RegistryException {
+        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    public List<String> getAllJobsWithState(AiravataJobState state) throws 
RuntimeException {
+        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    public List<String> getAllAcceptedJobs() throws RegistryException {
+        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    public String fetchAJob() throws RegistryException {
+        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    public List<String> getAllHangedJobs() throws RegistryException {
+        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    public int getHangedJobCount() throws RegistryException {
+        return 0;  //To change body of implemented methods use File | Settings 
| File Templates.
+    }
+
+    public boolean resetHangedJob(String experimentID) throws 
RegistryException {
+        return false;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
 }

Modified: 
airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
URL: 
http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql?rev=1553744&r1=1553743&r2=1553744&view=diff
==============================================================================
--- 
airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
 (original)
+++ 
airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
 Fri Dec 27 21:15:16 2013
@@ -21,7 +21,7 @@
 create table Gateway
 (
         gateway_name varchar(255),
-             owner varchar(255),
+           owner varchar(255),
         PRIMARY KEY (gateway_name)
 );
 
@@ -34,6 +34,15 @@ create table Configuration
         PRIMARY KEY(config_key, config_val, category_id)
 );
 
+create table GFacInstance
+(
+        instance_id varchar(255),
+        url varchar(255),
+        last_update TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        current_load varchar (255),
+        PRIMARY KEY(instance_id,url)
+);
+
 INSERT INTO Configuration (config_key, config_val, expire_date, category_id) 
VALUES('registry.version', '0.11', CURRENT_TIMESTAMP ,'SYSTEM');
 
 create table Users

Modified: 
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
URL: 
http://svn.apache.org/viewvc/airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java?rev=1553744&r1=1553743&r2=1553744&view=diff
==============================================================================
--- 
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
 (original)
+++ 
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
 Fri Dec 27 21:15:16 2013
@@ -27,7 +27,7 @@ import java.net.URI;
 import java.util.Observable;
 
 
-public abstract class AiravataRegistry2 extends Observable implements 
DescriptorRegistry, ProjectsRegistry, PublishedWorkflowRegistry, 
UserWorkflowRegistry, ConfigurationRegistry, ProvenanceRegistry, UserRegistry, 
CredentialRegistry{
+public abstract class AiravataRegistry2 extends Observable implements 
DescriptorRegistry, ProjectsRegistry, PublishedWorkflowRegistry, 
UserWorkflowRegistry, ConfigurationRegistry, 
ProvenanceRegistry,OrchestratorRegistry, UserRegistry, CredentialRegistry{
        private Gateway gateway;
        private AiravataUser user;
        

Added: 
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java
URL: 
http://svn.apache.org/viewvc/airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java?rev=1553744&view=auto
==============================================================================
--- 
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java
 (added)
+++ 
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/OrchestratorRegistry.java
 Fri Dec 27 21:15:16 2013
@@ -0,0 +1,108 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.registry.api;
+
+import org.apache.airavata.common.utils.AiravataJobState;
+import org.apache.airavata.registry.api.exception.RegistryException;
+
+import java.util.List;
+
+public interface OrchestratorRegistry extends AiravataSubRegistry {
+
+    /**
+     * This method will add an entry to job management table in database
+     * With the default initial status of ACCEPTED
+     * @param userName
+     * @param experimentID
+     * @return
+     * @throws RegistryException
+     */
+    boolean storeExperiment(String userName,String experimentID)throws 
RegistryException;
+
+    /**
+     * This can be used to change the status to any valid status
+     * @param userName
+     * @param experimentID
+     * @param state
+     * @return
+     * @throws RegistryException
+     */
+    boolean changeStatus(String userName,String experimentID,AiravataJobState 
state)throws RegistryException;
+
+
+    /**
+     * This method can be used to seek the status of a given experiment
+     * @param experimentID
+     * @return
+     * @throws RegistryException
+     */
+    AiravataJobState getState(String experimentID)throws RegistryException;
+
+    /**
+     * This returns all the jobs with the given state
+     * @param state give any state user wants to retrieve all the experiment 
IDs
+     * @return
+     * @throws RuntimeException
+     */
+    List<String> getAllJobsWithState(AiravataJobState state) throws 
RuntimeException;
+
+    /**
+     * This will return list of experimentID of jobs which are in
+     * ACCEPTED state
+     * @return
+     * @throws RegistryException
+     */
+    List<String> getAllAcceptedJobs()throws RegistryException;
+
+    /**
+     * This will pick one job from jobs in ACCEPTED state and change its 
status to
+     * FETCHED
+     * @return experimentID
+     * @throws RegistryException
+     */
+    String fetchAJob()throws RegistryException;
+
+    /**
+     * This will return all the hanged jobs, the logic to determine
+     * whether job is hanged or not is depend on the implementation
+     * @return
+     * @throws RegistryException
+     */
+    List<String> getAllHangedJobs()throws RegistryException;
+
+    /**
+     * return the number of jobs hanged, it not normal that jobs are hanged
+     * all the time, so users can use this method before try to retrieve
+     * list of hanged jobs
+     * @return  number of hanged jobs
+     * @throws RegistryException
+     */
+    int getHangedJobCount()throws RegistryException;
+
+    /**
+     * reset hanged jobs based on previous state
+     * @param experimentID
+     * @return true if operation is successful
+     * @throws RegistryException
+     */
+    boolean resetHangedJob(String experimentID)throws RegistryException;
+
+}

Modified: 
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
URL: 
http://svn.apache.org/viewvc/airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java?rev=1553744&r1=1553743&r2=1553744&view=diff
==============================================================================
--- 
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
 (original)
+++ 
airavata/sandbox/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
 Fri Dec 27 21:15:16 2013
@@ -30,7 +30,7 @@ import org.apache.airavata.registry.api.
 import 
org.apache.airavata.registry.api.workflow.ApplicationJob.ApplicationJobStatus;
 import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus.State;
 
-public interface    ProvenanceRegistry extends AiravataSubRegistry{
+public interface ProvenanceRegistry extends AiravataSubRegistry{
 
        /*------------------------------------------- Experiment data 
---------------------------------------------*/
        


Reply via email to