Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/AvroRpcWorkflowManagerClient.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/AvroRpcWorkflowManagerClient.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/AvroRpcWorkflowManagerClient.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/AvroRpcWorkflowManagerClient.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,254 @@
+/*
+ * 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.oodt.cas.workflow.system;
+
+import org.apache.avro.ipc.NettyTransceiver;
+import org.apache.avro.ipc.Transceiver;
+import org.apache.avro.ipc.specific.SpecificRequestor;
+import org.apache.oodt.cas.cli.CmdLineUtility;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.cas.workflow.util.AvroTypeFactory;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Logger;
+
+/**
+ * @author radu
+ *
+ * <p>
+ * The Avro RPC based workflow manager client.
+ * </p>
+ */
+public class AvroRpcWorkflowManagerClient implements WorkflowManagerClient {
+
+    private static Logger LOG = Logger
+            .getLogger(AvroRpcWorkflowManagerClient.class.getName());
+
+    Transceiver client;
+
+    org.apache.oodt.cas.workflow.struct.avrotypes.WorkflowManager proxy;
+
+    URL workflowManagerUrl;
+
+
+    public AvroRpcWorkflowManagerClient(URL url){
+        workflowManagerUrl = url;
+        try {
+            client = new NettyTransceiver(new 
InetSocketAddress(url.getHost(),url.getPort()));
+        proxy = 
SpecificRequestor.getClient(org.apache.oodt.cas.workflow.struct.avrotypes.WorkflowManager.class,
 client);
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    @Override
+    public boolean refreshRepository() throws Exception {
+            return proxy.refreshRepository();
+    }
+
+    @Override
+    public String executeDynamicWorkflow(List<String> taskIds, Metadata 
metadata) throws Exception {
+        return proxy.executeDynamicWorkflow(taskIds, 
AvroTypeFactory.getAvroMetadata(metadata));
+
+    }
+
+    @Override
+    public List getRegisteredEvents() throws Exception {
+        return proxy.getRegisteredEvents();
+    }
+
+    @Override
+    public WorkflowInstancePage getFirstPage() throws Exception {
+        return AvroTypeFactory.getWorkflowInstancePage(proxy.getFirstPage());
+    }
+
+    @Override
+    public WorkflowInstancePage getNextPage(WorkflowInstancePage currentPage) 
throws Exception {
+        return 
AvroTypeFactory.getWorkflowInstancePage(proxy.getNextPage(AvroTypeFactory.getAvroWorkflowInstancePage(currentPage)));
+    }
+
+    @Override
+    public WorkflowInstancePage getPrevPage(WorkflowInstancePage currentPage) 
throws Exception {
+        return 
AvroTypeFactory.getWorkflowInstancePage(proxy.getPrevPage(AvroTypeFactory.getAvroWorkflowInstancePage(currentPage)));
+    }
+
+    @Override
+    public WorkflowInstancePage getLastPage() throws Exception {
+        return AvroTypeFactory.getWorkflowInstancePage(proxy.getLastPage());
+    }
+
+    @Override
+    public WorkflowInstancePage paginateWorkflowInstances(int pageNum, String 
status) throws Exception {
+        return 
AvroTypeFactory.getWorkflowInstancePage(proxy.paginateWorkflowInstancesOfStatus(pageNum,
 status));
+    }
+
+    @Override
+    public WorkflowInstancePage paginateWorkflowInstances(int pageNum) throws 
Exception {
+        return 
AvroTypeFactory.getWorkflowInstancePage(proxy.paginateWorkflowInstances(pageNum));
+    }
+
+    @Override
+    public List getWorkflowsByEvent(String eventName) throws Exception {
+        return 
AvroTypeFactory.getWorkflows(proxy.getWorkflowsByEvent(eventName));
+    }
+
+    @Override
+    public Metadata getWorkflowInstanceMetadata(String wInstId) throws 
Exception {
+        return 
AvroTypeFactory.getMetadata(proxy.getWorkflowInstanceMetadata(wInstId));
+    }
+
+    @Override
+    public boolean setWorkflowInstanceCurrentTaskStartDateTime(String wInstId, 
String startDateTimeIsoStr) throws Exception {
+        return proxy.setWorkflowInstanceCurrentTaskStartDateTime(wInstId, 
startDateTimeIsoStr);
+    }
+
+    @Override
+    public double getWorkflowCurrentTaskWallClockMinutes(String 
workflowInstId) throws Exception {
+        return proxy.getWorkflowCurrentTaskWallClockMinutes(workflowInstId);
+    }
+
+    @Override
+    public double getWorkflowWallClockMinutes(String workflowInstId) throws 
Exception {
+        return proxy.getWorkflowWallClockMinutes(workflowInstId);
+    }
+
+    @Override
+    public boolean stopWorkflowInstance(String workflowInstId) throws 
Exception {
+        return proxy.stopWorkflowInstance(workflowInstId);
+    }
+
+    @Override
+    public boolean pauseWorkflowInstance(String workflowInstId) throws 
Exception {
+        return proxy.pauseWorkflowInstance(workflowInstId);
+    }
+
+    @Override
+    public boolean resumeWorkflowInstance(String workflowInstId) throws 
Exception {
+        return proxy.resumeWorkflowInstance(workflowInstId);
+    }
+
+    @Override
+    public boolean setWorkflowInstanceCurrentTaskEndDateTime(String wInstId, 
String endDateTimeIsoStr) throws Exception {
+        return proxy.setWorkflowInstanceCurrentTaskEndDateTime(wInstId, 
endDateTimeIsoStr);
+    }
+
+    @Override
+    public boolean updateWorkflowInstanceStatus(String workflowInstId, String 
status) throws Exception {
+        return proxy.updateWorkflowInstanceStatus(workflowInstId, status);
+    }
+
+    @Override
+    public boolean updateWorkflowInstance(WorkflowInstance instance) throws 
Exception {
+        return 
proxy.updateWorkflowInstance(AvroTypeFactory.getAvroWorkflowInstance(instance));
+    }
+
+    @Override
+    public boolean updateMetadataForWorkflow(String workflowInstId, Metadata 
metadata) throws Exception {
+        return proxy.updateMetadataForWorkflow(workflowInstId, 
AvroTypeFactory.getAvroMetadata(metadata));
+    }
+
+    @Override
+    public boolean sendEvent(String eventName, Metadata metadata) throws 
Exception {
+        return proxy.handleEvent(eventName, 
AvroTypeFactory.getAvroMetadata(metadata));
+    }
+
+    @Override
+    public WorkflowTask getTaskById(String taskId) throws Exception {
+        return AvroTypeFactory.getWorkflowTask(proxy.getTaskById(taskId));
+    }
+
+    @Override
+    public WorkflowCondition getConditionById(String conditionId) throws 
Exception {
+        return 
AvroTypeFactory.getWorkflowCondition(proxy.getConditionById(conditionId));
+    }
+
+    @Override
+    public WorkflowInstance getWorkflowInstanceById(String wInstId) throws 
Exception {
+        return 
AvroTypeFactory.getWorkflowInstance(proxy.getWorkflowInstanceById(wInstId));
+    }
+
+    @Override
+    public Workflow getWorkflowById(String workflowId) throws Exception {
+        return AvroTypeFactory.getWorkflow(proxy.getWorkflowById(workflowId));
+    }
+
+    @Override
+    public Vector getWorkflows() throws Exception {
+        Vector works = new Vector();
+
+        List<Workflow> worksList = 
AvroTypeFactory.getWorkflows(proxy.getWorkflows());
+        for (Workflow w : worksList){
+            works.add(w);
+        }
+        return works;
+    }
+
+    @Override
+    public int getNumWorkflowInstancesByStatus(String status) throws Exception 
{
+        return proxy.getNumWorkflowInstancesByStatus(status);
+    }
+
+    @Override
+    public int getNumWorkflowInstances() throws Exception {
+        return proxy.getNumWorkflowInstances();
+    }
+
+    @Override
+    public Vector getWorkflowInstancesByStatus(String status) throws Exception 
{
+        return (Vector) 
AvroTypeFactory.getWorkflowInstances(proxy.getWorkflowInstancesByStatus(status));
+
+    }
+
+    @Override
+    public Vector getWorkflowInstances() throws Exception {
+        List workflowInstances =  
AvroTypeFactory.getWorkflowInstances(proxy.getWorkflowInstances());
+        Vector vector = new Vector();
+        for (Object o : workflowInstances){
+            vector.add(o);
+        }
+        return vector;
+    }
+
+    @Override
+    public URL getWorkflowManagerUrl() {
+        return this.workflowManagerUrl;
+    }
+
+    @Override
+    public void setWorkflowManagerUrl(URL workflowManagerUrl) {
+        this.workflowManagerUrl = workflowManagerUrl;
+        try {
+            client = new NettyTransceiver(new 
InetSocketAddress(workflowManagerUrl.getPort()));
+            proxy = 
SpecificRequestor.getClient(org.apache.oodt.cas.workflow.struct.avrotypes.WorkflowManager.class,
 client);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+}

Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManager.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManager.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManager.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManager.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,31 @@
+package org.apache.oodt.cas.workflow.system;
+
+import org.apache.oodt.cas.workflow.structs.exceptions.EngineException;
+import 
org.apache.oodt.cas.workflow.structs.exceptions.InstanceRepositoryException;
+import org.apache.oodt.cas.workflow.structs.exceptions.RepositoryException;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * @author radu
+ *
+ *  Workflow manager interface, used for RPC implementatino.
+ */
+public interface WorkflowManager{
+
+    public static final String PROPERTIES_FILE_PROPERTY = 
"org.apache.oodt.cas.workflow.properties";
+    public static final String WORKFLOW_ENGINE_FACTORY_PROPERTY = 
"workflow.engine.factory";
+    public static final String ENGINE_RUNNER_FACTORY_PROPERTY = 
"workflow.engine.runner.factory";
+    public static final String WORKFLOW_REPOSITORY_FACTORY_PROPERTY = 
"workflow.repo.factory";
+    public static final int DEFAULT_WEB_SERVER_PORT = 9001;
+
+    /**
+     *
+     * @return shutdown was successful.
+     */
+    boolean shutdown();
+
+}

Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerClient.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerClient.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerClient.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerClient.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,132 @@
+/*
+ * 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.oodt.cas.workflow.system;
+
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ *
+ * @author radu
+ *
+ * <p>
+ * Base interface for client RPC implementation.
+ * </p>
+ */
+public interface WorkflowManagerClient {
+
+    boolean refreshRepository()
+            throws Exception;
+    String executeDynamicWorkflow(List<String> taskIds, Metadata metadata)
+            throws Exception;
+
+    List getRegisteredEvents() throws Exception;
+
+    WorkflowInstancePage getFirstPage() throws Exception;
+
+    WorkflowInstancePage getNextPage(WorkflowInstancePage currentPage)
+            throws Exception;
+
+    WorkflowInstancePage getPrevPage(WorkflowInstancePage currentPage)
+            throws Exception;
+
+    WorkflowInstancePage getLastPage() throws Exception;
+
+    WorkflowInstancePage paginateWorkflowInstances(int pageNum, String status) 
throws Exception;
+
+    WorkflowInstancePage paginateWorkflowInstances(int pageNum)
+            throws Exception;
+
+    List getWorkflowsByEvent(String eventName)
+            throws Exception;
+
+    Metadata getWorkflowInstanceMetadata(String wInstId)
+            throws Exception;
+
+    boolean setWorkflowInstanceCurrentTaskStartDateTime(
+            String wInstId, String startDateTimeIsoStr)
+            throws Exception;
+
+    double getWorkflowCurrentTaskWallClockMinutes(String workflowInstId)
+            throws Exception;
+
+    double getWorkflowWallClockMinutes(String workflowInstId)
+            throws Exception;
+
+    boolean stopWorkflowInstance(String workflowInstId)
+            throws Exception;
+
+    boolean pauseWorkflowInstance(String workflowInstId)
+            throws Exception;
+
+    boolean resumeWorkflowInstance(String workflowInstId)
+            throws Exception;
+
+    boolean setWorkflowInstanceCurrentTaskEndDateTime(
+            String wInstId, String endDateTimeIsoStr) throws Exception;
+
+    boolean updateWorkflowInstanceStatus(
+            String workflowInstId, String status) throws Exception;
+
+    boolean updateWorkflowInstance(WorkflowInstance instance)
+            throws Exception;
+
+    boolean updateMetadataForWorkflow(
+            String workflowInstId, Metadata metadata) throws Exception;
+
+    boolean sendEvent(String eventName, Metadata metadata)
+            throws Exception;
+
+    WorkflowTask getTaskById(String taskId) throws Exception;
+
+    WorkflowCondition getConditionById(String conditionId)
+            throws Exception;
+
+    WorkflowInstance getWorkflowInstanceById(String wInstId)
+            throws Exception;
+
+    Workflow getWorkflowById(String workflowId)
+            throws Exception;
+
+    Vector getWorkflows()
+            throws Exception;
+
+    int getNumWorkflowInstancesByStatus(String status)
+            throws Exception;
+
+    int getNumWorkflowInstances()
+            throws Exception;
+
+    Vector getWorkflowInstancesByStatus(String status)
+            throws Exception;
+
+    Vector getWorkflowInstances()
+            throws Exception;
+
+    URL getWorkflowManagerUrl();
+
+    void setWorkflowManagerUrl(URL workflowManagerUrl);
+}

Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerClientStarter.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerClientStarter.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerClientStarter.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerClientStarter.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,27 @@
+/*
+ * 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.oodt.cas.workflow.system;
+
+import org.apache.oodt.cas.cli.CmdLineUtility;
+
+public class WorkflowManagerClientStarter {
+    public static void main(String[] args) {
+        CmdLineUtility cmdLineUtility = new CmdLineUtility();
+        cmdLineUtility.run(args);
+    }
+}

Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerStarter.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerStarter.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerStarter.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/WorkflowManagerStarter.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,71 @@
+/*
+ * 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.oodt.cas.workflow.system;
+
+import org.apache.oodt.cas.workflow.system.rpc.RpcCommunicationFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class WorkflowManagerStarter {
+
+    private static final Logger LOG = 
Logger.getLogger(WorkflowManagerStarter.class.getName());
+
+    public static void loadProperties() throws FileNotFoundException, 
IOException {
+        String configFile = 
System.getProperty(WorkflowManager.PROPERTIES_FILE_PROPERTY);
+        if (configFile != null) {
+            LOG.log(Level.INFO,
+                    "Loading Workflow Manager Configuration Properties from: ["
+                            + configFile + "]");
+            System.getProperties().load(new FileInputStream(new File(
+                    configFile)));
+        }
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        int portNum = -1;
+        String usage = "WorkflowManager --portNum <port number for avro rpc 
service>\n";
+
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("--portNum")) {
+                portNum = Integer.parseInt(args[++i]);
+            }
+        }
+
+        if (portNum == -1) {
+            System.err.println(usage);
+            System.exit(1);
+        }
+
+        loadProperties();
+        WorkflowManager manager = 
RpcCommunicationFactory.createServer(portNum);
+
+        for (;;)
+            try {
+                Thread.currentThread().join();
+            } catch (InterruptedException ignore) {
+            }
+    }
+
+
+}

Modified: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java?rev=1703320&r1=1703319&r2=1703320&view=diff
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
 (original)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
 Wed Sep 16 03:11:50 2015
@@ -64,17 +64,13 @@ import com.google.common.base.Preconditi
  * @author mattmann (Chris Mattmann)
  * @author bfoster (Brian Foster)
  */
-public class XmlRpcWorkflowManager {
+public class XmlRpcWorkflowManager implements WorkflowManager {
 
    private static final Logger LOG = 
Logger.getLogger(XmlRpcWorkflowManager.class.getName());
 
-   public static final int DEFAULT_WEB_SERVER_PORT = 9001;
+
    public static final String XML_RPC_HANDLER_NAME = "workflowmgr";
 
-   public static final String PROPERTIES_FILE_PROPERTY = 
"org.apache.oodt.cas.workflow.properties";
-   public static final String WORKFLOW_ENGINE_FACTORY_PROPERTY = 
"workflow.engine.factory";
-   public static final String ENGINE_RUNNER_FACTORY_PROPERTY = 
"workflow.engine.runner.factory";
-   public static final String WORKFLOW_REPOSITORY_FACTORY_PROPERTY = 
"workflow.repo.factory";
 
    private final int webServerPort;
    private WebServer webServer;
@@ -103,6 +99,7 @@ public class XmlRpcWorkflowManager {
             + System.getProperty("user.name", "unknown"));
    }
 
+   @Override
    public boolean shutdown() {
       if (webServer != null) {
          webServer.shutdown();
@@ -603,31 +600,6 @@ public class XmlRpcWorkflowManager {
         return doUpdateWorkflowInstance(wInst);
     }
 
-    public static void main(String[] args) throws Exception {
-        int portNum = -1;
-        String usage = "XmlRpcWorkflowManager --portNum <port number for xml 
rpc service>\n";
-
-        for (int i = 0; i < args.length; i++) {
-            if (args[i].equals("--portNum")) {
-                portNum = Integer.parseInt(args[++i]);
-            }
-        }
-
-        if (portNum == -1) {
-            System.err.println(usage);
-            System.exit(1);
-        }
-
-        loadProperties();
-        XmlRpcWorkflowManager manager = new XmlRpcWorkflowManager(portNum);
-
-        for (;;)
-            try {
-                Thread.currentThread().join();
-            } catch (InterruptedException ignore) {
-            }
-    }
-
     public static void loadProperties() throws FileNotFoundException, 
IOException {
        String configFile = System.getProperty(PROPERTIES_FILE_PROPERTY);
        if (configFile != null) {

Modified: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java?rev=1703320&r1=1703319&r2=1703320&view=diff
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
 (original)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
 Wed Sep 16 03:11:50 2015
@@ -38,7 +38,6 @@ import org.apache.oodt.cas.workflow.stru
 import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
 import org.apache.oodt.cas.workflow.structs.Workflow;
 import org.apache.oodt.cas.workflow.util.XmlRpcStructFactory;
-import org.apache.oodt.cas.cli.CmdLineUtility;
 import org.apache.oodt.cas.metadata.Metadata;
 
 /**
@@ -50,7 +49,7 @@ import org.apache.oodt.cas.metadata.Meta
  * </p>
  * 
  */
-public class XmlRpcWorkflowManagerClient {
+public class XmlRpcWorkflowManagerClient implements WorkflowManagerClient {
 
     /* our xml rpc client */
     private XmlRpcClient client = null;
@@ -76,6 +75,7 @@ public class XmlRpcWorkflowManagerClient
         workflowManagerUrl = url;
     }
     
+    @Override
     public boolean refreshRepository()
         throws Exception {
         try {
@@ -90,6 +90,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+  @Override
   public String executeDynamicWorkflow(List<String> taskIds, Metadata metadata)
       throws Exception {
     Vector argList = new Vector();
@@ -114,6 +115,7 @@ public class XmlRpcWorkflowManagerClient
 
   }
 
+    @Override
     public List getRegisteredEvents() throws Exception {
         Vector argList = new Vector();
 
@@ -128,6 +130,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public WorkflowInstancePage getFirstPage() throws Exception {
         Vector argList = new Vector();
         Hashtable pageHash = null;
@@ -145,6 +148,7 @@ public class XmlRpcWorkflowManagerClient
         return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
     }
 
+    @Override
     public WorkflowInstancePage getNextPage(WorkflowInstancePage currentPage)
             throws Exception {
         Vector argList = new Vector();
@@ -165,6 +169,7 @@ public class XmlRpcWorkflowManagerClient
         return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
     }
 
+    @Override
     public WorkflowInstancePage getPrevPage(WorkflowInstancePage currentPage)
             throws Exception {
         Vector argList = new Vector();
@@ -185,6 +190,7 @@ public class XmlRpcWorkflowManagerClient
         return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
     }
 
+    @Override
     public WorkflowInstancePage getLastPage() throws Exception {
         Vector argList = new Vector();
         Hashtable pageHash = null;
@@ -202,6 +208,7 @@ public class XmlRpcWorkflowManagerClient
         return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
     }
 
+    @Override
     public WorkflowInstancePage paginateWorkflowInstances(int pageNum,
             String status) throws Exception {
         Vector argList = new Vector();
@@ -222,6 +229,7 @@ public class XmlRpcWorkflowManagerClient
         return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
     }
 
+    @Override
     public WorkflowInstancePage paginateWorkflowInstances(int pageNum)
             throws Exception {
         Vector argList = new Vector();
@@ -241,6 +249,7 @@ public class XmlRpcWorkflowManagerClient
         return XmlRpcStructFactory.getWorkflowInstancePageFromXmlRpc(pageHash);
     }
 
+    @Override
     public List getWorkflowsByEvent(String eventName) throws Exception {
         List workflows = new Vector();
         Vector workflowVector = new Vector();
@@ -269,6 +278,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public Metadata getWorkflowInstanceMetadata(String wInstId) throws 
Exception {
         Vector argList = new Vector();
         argList.add(wInstId);
@@ -289,6 +299,7 @@ public class XmlRpcWorkflowManagerClient
         return met;
     }
 
+    @Override
     public synchronized boolean setWorkflowInstanceCurrentTaskStartDateTime(
             String wInstId, String startDateTimeIsoStr) throws Exception {
         Vector argList = new Vector();
@@ -308,6 +319,7 @@ public class XmlRpcWorkflowManagerClient
 
     }
 
+    @Override
     public double getWorkflowCurrentTaskWallClockMinutes(String workflowInstId)
             throws Exception {
         Vector argList = new Vector();
@@ -325,6 +337,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public double getWorkflowWallClockMinutes(String workflowInstId)
             throws Exception {
         Vector argList = new Vector();
@@ -342,6 +355,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public synchronized boolean stopWorkflowInstance(String workflowInstId)
             throws Exception {
         Vector argList = new Vector();
@@ -359,6 +373,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public synchronized boolean pauseWorkflowInstance(String workflowInstId)
             throws Exception {
         Vector argList = new Vector();
@@ -376,6 +391,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public synchronized boolean resumeWorkflowInstance(String workflowInstId)
             throws Exception {
         Vector argList = new Vector();
@@ -393,6 +409,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public synchronized boolean setWorkflowInstanceCurrentTaskEndDateTime(
             String wInstId, String endDateTimeIsoStr) throws Exception {
         Vector argList = new Vector();
@@ -412,6 +429,7 @@ public class XmlRpcWorkflowManagerClient
 
     }
 
+    @Override
     public synchronized boolean updateWorkflowInstanceStatus(
             String workflowInstId, String status) throws Exception {
         Vector argList = new Vector();
@@ -431,6 +449,7 @@ public class XmlRpcWorkflowManagerClient
 
     }
 
+    @Override
     public synchronized boolean updateWorkflowInstance(WorkflowInstance 
instance)
             throws Exception {
         Vector argList = new Vector();
@@ -448,6 +467,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public synchronized boolean updateMetadataForWorkflow(
             String workflowInstId, Metadata metadata) throws Exception {
         Vector argList = new Vector();
@@ -467,6 +487,7 @@ public class XmlRpcWorkflowManagerClient
 
     }
 
+    @Override
     public boolean sendEvent(String eventName, Metadata metadata)
             throws Exception {
         Vector argList = new Vector();
@@ -485,6 +506,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public WorkflowTask getTaskById(String taskId) throws Exception {
         Vector argList = new Vector();
         argList.add(taskId);
@@ -502,6 +524,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public WorkflowCondition getConditionById(String conditionId)
             throws Exception {
         Vector argList = new Vector();
@@ -520,6 +543,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public WorkflowInstance getWorkflowInstanceById(String wInstId)
             throws Exception {
         Vector argList = new Vector();
@@ -541,6 +565,7 @@ public class XmlRpcWorkflowManagerClient
 
     }
 
+    @Override
     public Workflow getWorkflowById(String workflowId) throws Exception {
         Vector argList = new Vector();
         argList.add(workflowId);
@@ -559,6 +584,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public Vector getWorkflows() throws Exception {
         Vector argList = new Vector();
         Vector works = null;
@@ -591,6 +617,7 @@ public class XmlRpcWorkflowManagerClient
 
     }
 
+    @Override
     public int getNumWorkflowInstancesByStatus(String status) throws Exception{
         Vector argList = new Vector();
         argList.add(status);
@@ -610,6 +637,7 @@ public class XmlRpcWorkflowManagerClient
         return numInsts;
     }
 
+    @Override
     public int getNumWorkflowInstances() throws Exception{
         Vector argList = new Vector();
         int numInsts = -1;
@@ -628,6 +656,7 @@ public class XmlRpcWorkflowManagerClient
         return numInsts;
     }
 
+    @Override
     public Vector getWorkflowInstancesByStatus(String status) throws Exception 
{
         Vector argList = new Vector();
         argList.add(status);
@@ -658,6 +687,7 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
+    @Override
     public Vector getWorkflowInstances() throws Exception {
         Vector argList = new Vector();
         Vector insts = null;
@@ -687,14 +717,10 @@ public class XmlRpcWorkflowManagerClient
         }
     }
 
-    public static void main(String[] args) {
-       CmdLineUtility cmdLineUtility = new CmdLineUtility();
-       cmdLineUtility.run(args);
-    }
-
     /**
      * @return Returns the workflowManagerUrl.
      */
+    @Override
     public URL getWorkflowManagerUrl() {
         return workflowManagerUrl;
     }
@@ -703,6 +729,7 @@ public class XmlRpcWorkflowManagerClient
      * @param workflowManagerUrl
      *            The workflowManagerUrl to set.
      */
+    @Override
     public void setWorkflowManagerUrl(URL workflowManagerUrl) {
         this.workflowManagerUrl = workflowManagerUrl;
 

Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/AvroRpcWorkflowManagerFactory.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/AvroRpcWorkflowManagerFactory.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/AvroRpcWorkflowManagerFactory.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/AvroRpcWorkflowManagerFactory.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,50 @@
+/*
+ * 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.oodt.cas.workflow.system.rpc;
+
+import org.apache.oodt.cas.workflow.system.AvroRpcWorkflowManager;
+import org.apache.oodt.cas.workflow.system.AvroRpcWorkflowManagerClient;
+import org.apache.oodt.cas.workflow.system.WorkflowManager;
+import org.apache.oodt.cas.workflow.system.WorkflowManagerClient;
+
+import java.net.URL;
+
+public class AvroRpcWorkflowManagerFactory implements WorkflowManagerFactory {
+
+    private int port;
+
+    private URL url;
+
+    public void setPort(int port){
+        this.port = port;
+    }
+
+    public void setUrl(URL url){
+        this.url = url;
+    }
+
+    @Override
+    public WorkflowManager createServer() {
+        return new AvroRpcWorkflowManager(port);
+    }
+
+    @Override
+    public WorkflowManagerClient createClient() {
+        return new AvroRpcWorkflowManagerClient(url);
+    }
+}

Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/RpcCommunicationFactory.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/RpcCommunicationFactory.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/RpcCommunicationFactory.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/RpcCommunicationFactory.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,93 @@
+/*
+ * 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.oodt.cas.workflow.system.rpc;
+
+import org.apache.oodt.cas.workflow.system.WorkflowManager;
+import org.apache.oodt.cas.workflow.system.WorkflowManagerClient;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * @author radu
+ *
+ * Create instaces server/client for {@link WorkflowManager} and {@link 
WorkflowManagerClient}
+ */
+
+public class RpcCommunicationFactory {
+
+    private static String getRpcServerClassName(){
+        InputStream prpFileStream = 
RpcCommunicationFactory.class.getResourceAsStream("/workflow.properties");
+        Properties properties = new Properties();
+        try {
+            properties.load(prpFileStream);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return properties.getProperty("workflow.server.factory",
+                
"org.apache.oodt.cas.workflow.system.rpc.XmlRpcWorkflowManagerFactory");
+    }
+
+    private static String getRpcClientClassName(){
+        InputStream prpFileStream = 
RpcCommunicationFactory.class.getResourceAsStream("/workflow.properties");
+        Properties properties = new Properties();
+        try {
+            properties.load(prpFileStream);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return properties.getProperty("workflow.client.factory",
+                
"org.apache.oodt.cas.workflow.system.rpc.XmlRpcWorkflowManagerFactory");
+    }
+
+    public static WorkflowManager createServer(int port){
+        try {
+            WorkflowManagerFactory workflowManagerFactory =
+                    (WorkflowManagerFactory) 
Class.forName(getRpcServerClassName()).newInstance();
+            workflowManagerFactory.setPort(port);
+            return workflowManagerFactory.createServer();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static WorkflowManagerClient createClient(URL url){
+        try {
+            WorkflowManagerFactory workflowManagerFactory =
+                    (WorkflowManagerFactory) 
Class.forName(getRpcClientClassName()).newInstance();
+            workflowManagerFactory.setUrl(url);
+            return workflowManagerFactory.createClient();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
+}

Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/WorkflowManagerFactory.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/WorkflowManagerFactory.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/WorkflowManagerFactory.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/WorkflowManagerFactory.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,60 @@
+/*
+ * 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.oodt.cas.workflow.system.rpc;
+
+import org.apache.oodt.cas.workflow.system.WorkflowManager;
+import org.apache.oodt.cas.workflow.system.WorkflowManagerClient;
+
+import java.net.URL;
+
+/**
+ * @author radu
+ *
+ * Creates implementations for {@link WorkflowManager} and {@link 
WorkflowManagerClient}
+ */
+public interface WorkflowManagerFactory {
+    /**
+     *
+     * Sets port where {@link WorkflowManager} will be.
+     *
+     * @param port
+     */
+    public void setPort(int port);
+
+    /**
+     *
+     * Set url where {@link WorkflowManagerClient} will connect to.
+     *
+     * @param url
+     */
+    public void setUrl(URL url);
+
+    /**
+     *
+     * Create a instance of {@link WorkflowManager} with specified port.
+     *
+     * @return
+     */
+    public WorkflowManager createServer();
+
+    /**
+     * Create a instance of {@link WorkflowManager} with specified url.
+     * @return
+     */
+    public WorkflowManagerClient createClient();
+}

Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/XmlRpcWorkflowManagerFactory.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/XmlRpcWorkflowManagerFactory.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/XmlRpcWorkflowManagerFactory.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/system/rpc/XmlRpcWorkflowManagerFactory.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,48 @@
+/*
+ * 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.oodt.cas.workflow.system.rpc;
+
+import org.apache.oodt.cas.workflow.system.WorkflowManager;
+import org.apache.oodt.cas.workflow.system.WorkflowManagerClient;
+import org.apache.oodt.cas.workflow.system.XmlRpcWorkflowManager;
+import org.apache.oodt.cas.workflow.system.XmlRpcWorkflowManagerClient;
+
+import java.net.URL;
+
+public class XmlRpcWorkflowManagerFactory implements WorkflowManagerFactory {
+
+    private int port;
+
+    private URL url;
+
+    public void setPort(int port){
+        this.port = port;
+    }
+
+    public void setUrl(URL url){
+        this.url = url;
+    }
+
+    public WorkflowManager createServer(){
+        return new XmlRpcWorkflowManager(port);
+    }
+
+    public WorkflowManagerClient createClient(){
+        return new XmlRpcWorkflowManagerClient(url);
+    }
+}

Modified: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java?rev=1703320&r1=1703319&r2=1703320&view=diff
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java
 (original)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java
 Wed Sep 16 03:11:50 2015
@@ -29,7 +29,8 @@ import org.apache.oodt.cas.workflow.inst
 import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
 import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
 import org.apache.oodt.cas.workflow.structs.WorkflowStatus;
-import org.apache.oodt.cas.workflow.system.XmlRpcWorkflowManagerClient;
+import org.apache.oodt.cas.workflow.system.WorkflowManagerClient;
+import org.apache.oodt.cas.workflow.system.rpc.RpcCommunicationFactory;
 import org.apache.oodt.commons.date.DateUtils;
 
 /**
@@ -54,7 +55,7 @@ public class InstanceRepoCleaner {
   private static final Logger LOG = Logger.getLogger(InstanceRepoCleaner.class
       .getName());
 
-  private XmlRpcWorkflowManagerClient wm;
+  private WorkflowManagerClient wm;
 
   private LuceneWorkflowInstanceRepository rep;
 
@@ -62,7 +63,7 @@ public class InstanceRepoCleaner {
   }
 
   public InstanceRepoCleaner(String wmUrlStr) throws Exception {
-    this.wm = new XmlRpcWorkflowManagerClient(new URL(wmUrlStr));
+    this.wm = RpcCommunicationFactory.createClient(new URL(wmUrlStr));
   }
 
   public void setInstanceRepo(String idxPath) {

Added: 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/util/AvroTypeFactory.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/util/AvroTypeFactory.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/util/AvroTypeFactory.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/main/java/org/apache/oodt/cas/workflow/util/AvroTypeFactory.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,323 @@
+/*
+ * 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.oodt.cas.workflow.util;
+
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.struct.avrotypes.AvroWorkflowCondition;
+import org.apache.oodt.cas.workflow.struct.avrotypes.AvroWorkflow;
+import org.apache.oodt.cas.workflow.struct.avrotypes.AvroWorkflowTask;
+import org.apache.oodt.cas.workflow.struct.avrotypes.AvroWorkflowInstance;
+import org.apache.oodt.cas.workflow.struct.avrotypes.AvroWorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
+import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
+import org.apache.oodt.cas.workflow.structs.Priority;
+
+import java.util.*;
+
+
+/**
+ * @author radu
+ *
+ * Avro types factory for rpc communication between {@link 
org.apache.oodt.cas.workflow.system.AvroRpcWorkflowManager}
+ * and {@link org.apache.oodt.cas.workflow.system.AvroRpcWorkflowManagerClient}
+ *
+ */
+public class AvroTypeFactory {
+
+    public static AvroWorkflowCondition 
getAvroWorkflowCondition(WorkflowCondition workflowCondition){
+        AvroWorkflowCondition avroWorkflowCondition = new 
AvroWorkflowCondition();
+        
avroWorkflowCondition.setConditionName(workflowCondition.getConditionName());
+        
avroWorkflowCondition.setConditionId(workflowCondition.getConditionId());
+        
avroWorkflowCondition.setConditionInstanceClassName(workflowCondition.getConditionInstanceClassName());
+        avroWorkflowCondition.setOrder(workflowCondition.getOrder());
+        if (workflowCondition.getCondConfig() != null)
+            
avroWorkflowCondition.setCondConfig(getAvroCondConfig(workflowCondition.getCondConfig()));
+        
avroWorkflowCondition.setTimeoutSeconds(workflowCondition.getTimeoutSeconds());
+        avroWorkflowCondition.setOptional(workflowCondition.isOptional());
+        return avroWorkflowCondition;
+    }
+
+    private static Map getAvroCondConfig(WorkflowConditionConfiguration 
workflowConditionConfiguration){
+        Map avroCondConfig = new HashMap<String,String>();
+        if (workflowConditionConfiguration.getProperties().size() > 0)
+            for(Object key : 
workflowConditionConfiguration.getProperties().keySet()){
+                
avroCondConfig.put((String)key,workflowConditionConfiguration.getProperty((String)key));
+            }
+        return avroCondConfig;
+    }
+
+    public static WorkflowCondition getWorkflowCondition(AvroWorkflowCondition 
avroWorkflowCondition){
+        WorkflowCondition workflowCondition = new WorkflowCondition();
+        
workflowCondition.setConditionName(avroWorkflowCondition.getConditionName());
+        
workflowCondition.setConditionId(avroWorkflowCondition.getConditionId());
+        
workflowCondition.setConditionInstanceClassName(avroWorkflowCondition.getConditionInstanceClassName());
+        workflowCondition.setOrder(avroWorkflowCondition.getOrder());
+        if(avroWorkflowCondition.getCondConfig() != null)
+            
workflowCondition.setCondConfig(getWorkflowConditionConfiguration(avroWorkflowCondition.getCondConfig()));
+        
workflowCondition.setTimeoutSeconds(avroWorkflowCondition.getTimeoutSeconds());
+        workflowCondition.setOptional(avroWorkflowCondition.getOptional());
+        return workflowCondition;
+    }
+
+    private static WorkflowConditionConfiguration 
getWorkflowConditionConfiguration(Map avroCondConfig){
+        WorkflowConditionConfiguration workflowConditionConfiguration = new 
WorkflowConditionConfiguration();
+        if (avroCondConfig.size() > 0)
+            for (Object key : avroCondConfig.keySet()){
+                
workflowConditionConfiguration.addConfigProperty((String)key,(String)avroCondConfig.get(key));
+            }
+        return workflowConditionConfiguration;
+    }
+    // TO DO sa scot date dint avroWorkflowInstance
+
+    public static AvroWorkflowTask getAvroWorkflowTask(WorkflowTask 
workflowTask){
+        AvroWorkflowTask avroWorkflowTask = new AvroWorkflowTask();
+        avroWorkflowTask.setTaskId(workflowTask.getTaskId());
+        avroWorkflowTask.setTaskName(workflowTask.getTaskName());
+        if (workflowTask.getTaskConfig() != null)
+            
avroWorkflowTask.setTaskConfig(getAvroTaskConfig(workflowTask.getTaskConfig()));
+        if (workflowTask.getPreConditions() != null)
+            
avroWorkflowTask.setPreConditions(getAvroWorkflowConditions(workflowTask.getPreConditions()));
+        if (workflowTask.getPostConditions() != null)
+            
avroWorkflowTask.setPostConditions(getAvroWorkflowConditions(workflowTask.getPostConditions()));
+        
avroWorkflowTask.setTaskInstanceClassName(workflowTask.getTaskInstanceClassName());
+        avroWorkflowTask.setOrder(workflowTask.getOrder());
+        if(workflowTask.getRequiredMetFields() != null)
+        
avroWorkflowTask.setRequiredMetFields(workflowTask.getRequiredMetFields());
+        return avroWorkflowTask;
+
+    }
+
+    private static Map getAvroTaskConfig(WorkflowTaskConfiguration 
workflowConditionConfiguration){
+        Map avroCondConfig = new HashMap<String,String>();
+        if (workflowConditionConfiguration.getProperties().size() > 0)
+            for(Object key : 
workflowConditionConfiguration.getProperties().keySet()){
+                avroCondConfig.put((String) key, 
workflowConditionConfiguration.getProperty((String) key));
+            }
+        return avroCondConfig;
+    }
+
+    private static List<AvroWorkflowCondition> 
getAvroWorkflowConditions(List<WorkflowCondition> workflowConditions){
+        ArrayList<AvroWorkflowCondition> avroWorkflowConditions = new 
ArrayList<AvroWorkflowCondition>();
+        if (workflowConditions.size() > 0 )
+            for (WorkflowCondition wfc : workflowConditions){
+                avroWorkflowConditions.add(getAvroWorkflowCondition(wfc));
+            }
+        return avroWorkflowConditions;
+    }
+
+    public static WorkflowTask getWorkflowTask(AvroWorkflowTask 
avroWorkflowTask){
+        WorkflowTask workflowTask = new WorkflowTask();
+        workflowTask.setTaskId(avroWorkflowTask.getTaskId());
+        workflowTask.setTaskName(avroWorkflowTask.getTaskName());
+        if (workflowTask.getTaskConfig() != null)
+            
workflowTask.setTaskConfig(getTaskConfig(avroWorkflowTask.getTaskConfig()));
+        if (workflowTask.getPreConditions() != null)
+            
workflowTask.setPreConditions(getWorkflowConditions(avroWorkflowTask.getPreConditions()));
+        if (workflowTask.getPostConditions() != null)
+            
workflowTask.setPostConditions(getWorkflowConditions(avroWorkflowTask.getPostConditions()));
+        
workflowTask.setTaskInstanceClassName(avroWorkflowTask.getTaskInstanceClassName());
+        workflowTask.setOrder(avroWorkflowTask.getOrder());
+        if(workflowTask.getRequiredMetFields() != null)
+            
workflowTask.setRequiredMetFields(avroWorkflowTask.getRequiredMetFields());
+        return workflowTask;
+    }
+
+
+    private static WorkflowTaskConfiguration getTaskConfig(Map map){
+        WorkflowTaskConfiguration workflowTaskConfiguration = new 
WorkflowTaskConfiguration();
+        if(map.size() > 0){
+            for (Object key : map.keySet()){
+                
workflowTaskConfiguration.addConfigProperty((String)key,(String)map.get(key));
+            }
+        }
+        return workflowTaskConfiguration;
+    }
+
+    private static List<WorkflowCondition> 
getWorkflowConditions(List<AvroWorkflowCondition> avroWorkflowConditions) {
+        List<WorkflowCondition> workflowConditions = new 
ArrayList<WorkflowCondition>();
+        if (avroWorkflowConditions.size() > 0)
+            for (AvroWorkflowCondition awc : avroWorkflowConditions) {
+                workflowConditions.add(getWorkflowCondition(awc));
+            }
+        return workflowConditions;
+    }
+
+    public static AvroWorkflow getAvroWorkflow(Workflow workflow){
+        AvroWorkflow avroWorkflow = new AvroWorkflow();
+        avroWorkflow.setName(workflow.getName());
+        avroWorkflow.setId(workflow.getId());
+        if (workflow.getTasks() != null)
+            avroWorkflow.setTasks(getAvroWorkflowTasks(workflow.getTasks()));
+        if (workflow.getPreConditions() != null)
+            
avroWorkflow.setPreConditions(getAvroWorkflowConditions(workflow.getPreConditions()));
+        if (workflow.getPostConditions() != null)
+            
avroWorkflow.setPostConditions(getAvroWorkflowConditions(workflow.getPostConditions()));
+        return avroWorkflow;
+    }
+
+    private static List<AvroWorkflowTask> 
getAvroWorkflowTasks(List<WorkflowTask> workflowTasks){
+        List<AvroWorkflowTask> avroWorkflowTasks = new 
ArrayList<AvroWorkflowTask>();
+        if(workflowTasks.size() > 0)
+            for (WorkflowTask wt : workflowTasks){
+                avroWorkflowTasks.add(getAvroWorkflowTask(wt));
+            }
+        return avroWorkflowTasks;
+    }
+
+    public static Workflow getWorkflow(AvroWorkflow avroWorkflow){
+        Workflow workflow = new Workflow();
+        workflow.setName(avroWorkflow.getName());
+        workflow.setId(avroWorkflow.getId());
+        if(avroWorkflow.getTasks() != null)
+            workflow.setTasks(getWorkflowTasks(avroWorkflow.getTasks()));
+        if (avroWorkflow.getPreConditions() != null)
+            
workflow.setPreConditions(getWorkflowConditions(avroWorkflow.getPreConditions()));
+        if (avroWorkflow.getPostConditions() != null)
+            
workflow.setPostConditions(getWorkflowConditions(avroWorkflow.getPostConditions()));
+        return workflow;
+    }
+
+    private static List<WorkflowTask> getWorkflowTasks(List<AvroWorkflowTask> 
avroWorkflowTasks){
+        List<WorkflowTask> workflowTasks = new ArrayList<WorkflowTask>();
+        if(avroWorkflowTasks.size() > 0)
+            for (AvroWorkflowTask awt : avroWorkflowTasks){
+                workflowTasks.add(getWorkflowTask(awt));
+            }
+        return workflowTasks;
+    }
+
+    public static AvroWorkflowInstance 
getAvroWorkflowInstance(WorkflowInstance workflowInstance){
+        AvroWorkflowInstance avroWorkflowInstance = new AvroWorkflowInstance();
+        if (workflowInstance.getWorkflow() != null)
+            
avroWorkflowInstance.setWorkflow(getAvroWorkflow(workflowInstance.getWorkflow()));
+        avroWorkflowInstance.setId(workflowInstance.getId());
+        avroWorkflowInstance.setStatus(workflowInstance.getStatus());
+        
avroWorkflowInstance.setCurrentTaskId(workflowInstance.getCurrentTaskId());
+        
avroWorkflowInstance.setStartDateTimeIsoStr(workflowInstance.getStartDateTimeIsoStr());
+        
avroWorkflowInstance.setEndDateTimeIsoStr(workflowInstance.getEndDateTimeIsoStr());
+        
avroWorkflowInstance.setCurrentTaskStartDateTimeIsoStr(workflowInstance.getCurrentTaskStartDateTimeIsoStr());
+        
avroWorkflowInstance.setCurrentTaskEndDateTimeIsoStr(workflowInstance.getCurrentTaskEndDateTimeIsoStr());
+        if (workflowInstance.getSharedContext() != null)
+            
avroWorkflowInstance.setSharedContext(getAvroMetadata(workflowInstance.getSharedContext()));
+        if (workflowInstance.getPriority() != null)
+            
avroWorkflowInstance.setPriority(workflowInstance.getPriority().getValue());
+        return avroWorkflowInstance;
+    }
+
+    public static Map<String,String> getAvroMetadata(Metadata metadata){
+        Map<String,String> avroMetadata = new HashMap<String, String>();
+        if(metadata.getHashtable().size() > 0)
+            for (String key : metadata.getAllKeys()){
+                avroMetadata.put(key,metadata.getMetadata(key));
+            }
+        return avroMetadata;
+    }
+
+    public static WorkflowInstance getWorkflowInstance(AvroWorkflowInstance 
avroWorkflowInstance){
+        WorkflowInstance workflowInstance = new WorkflowInstance();
+        if(avroWorkflowInstance.getWorkflow() != null)
+            
workflowInstance.setWorkflow(getWorkflow(avroWorkflowInstance.getWorkflow()));
+        workflowInstance.setId(avroWorkflowInstance.getId());
+        workflowInstance.setStatus(avroWorkflowInstance.getStatus());
+        
workflowInstance.setCurrentTaskId(avroWorkflowInstance.getCurrentTaskId());
+        
workflowInstance.setStartDateTimeIsoStr(avroWorkflowInstance.getStartDateTimeIsoStr());
+        
workflowInstance.setEndDateTimeIsoStr(avroWorkflowInstance.getEndDateTimeIsoStr());
+        
workflowInstance.setCurrentTaskStartDateTimeIsoStr(avroWorkflowInstance.getCurrentTaskStartDateTimeIsoStr());
+        
workflowInstance.setCurrentTaskEndDateTimeIsoStr(avroWorkflowInstance.getCurrentTaskEndDateTimeIsoStr());
+        if (avroWorkflowInstance.getSharedContext() != null)
+            
workflowInstance.setSharedContext(getMetadata(avroWorkflowInstance.getSharedContext()));
+        if (avroWorkflowInstance.getPriority() != null)
+            
workflowInstance.setPriority(Priority.getPriority(avroWorkflowInstance.getPriority()));
+        return workflowInstance;
+    }
+
+    public static Metadata getMetadata(Map<String,String> avroMetadata){
+        Metadata metadata = new Metadata();
+        if (avroMetadata.size() > 0)
+            for (String key : avroMetadata.keySet()){
+                metadata.addMetadata(key,avroMetadata.get(key));
+            }
+        return metadata;
+    }
+
+    public static AvroWorkflowInstancePage 
getAvroWorkflowInstancePage(WorkflowInstancePage workflowInstancePage){
+        AvroWorkflowInstancePage avroWorkflowInstancePage = new 
AvroWorkflowInstancePage();
+        avroWorkflowInstancePage.setPageNum(workflowInstancePage.getPageNum());
+        
avroWorkflowInstancePage.setTotalPages(workflowInstancePage.getTotalPages());
+        
avroWorkflowInstancePage.setPageSize(workflowInstancePage.getPageSize());
+        if (workflowInstancePage.getPageWorkflows() != null)
+            
avroWorkflowInstancePage.setPageWorkflows(getAvroWorkflowInstances(workflowInstancePage.getPageWorkflows()));
+
+        return avroWorkflowInstancePage;
+    }
+
+    public static List<AvroWorkflow> getAvroWorkflows(List<Workflow> 
workflows){
+        List<AvroWorkflow> avroWorkflows = new ArrayList<AvroWorkflow>();
+        if (workflows != null && workflows.size() > 0) {
+            for (Workflow w : workflows){
+                avroWorkflows.add(getAvroWorkflow(w));
+            }
+        }
+        return avroWorkflows;
+    }
+
+    public static WorkflowInstancePage 
getWorkflowInstancePage(AvroWorkflowInstancePage avroWorkflowInstancePage){
+        WorkflowInstancePage workflowInstancePage = new WorkflowInstancePage();
+        workflowInstancePage.setPageNum(avroWorkflowInstancePage.getPageNum());
+        
workflowInstancePage.setTotalPages(avroWorkflowInstancePage.getTotalPages());
+        if (avroWorkflowInstancePage.getPageWorkflows() != null)
+            
workflowInstancePage.setPageWorkflows(getWorkflowInstances(avroWorkflowInstancePage.getPageWorkflows()));
+        return workflowInstancePage;
+    }
+
+    public static List<Workflow> getWorkflows(List<AvroWorkflow> avroWorkflow){
+        List<Workflow> workflows = new ArrayList<Workflow>();
+        if (avroWorkflow.size() > 0)
+            for (AvroWorkflow w : avroWorkflow){
+                workflows.add(getWorkflow(w));
+            }
+        return workflows;
+    }
+
+
+    public static List<AvroWorkflowInstance> 
getAvroWorkflowInstances(List<WorkflowInstance> workflowInstances){
+        List<AvroWorkflowInstance> avroWorkflowInstances = new 
ArrayList<AvroWorkflowInstance>();
+        if (workflowInstances != null && workflowInstances.size() > 0)
+            for (WorkflowInstance awi : workflowInstances){
+                
avroWorkflowInstances.add(AvroTypeFactory.getAvroWorkflowInstance(awi));
+            }
+        return avroWorkflowInstances;
+    }
+
+    public static List<WorkflowInstance> 
getWorkflowInstances(List<AvroWorkflowInstance> avroWorkflowInstances){
+        List<WorkflowInstance> workflowInstances = new 
ArrayList<WorkflowInstance>();
+        if (avroWorkflowInstances != null && avroWorkflowInstances.size() > 0)
+            for (AvroWorkflowInstance wi : avroWorkflowInstances){
+                workflowInstances.add(AvroTypeFactory.getWorkflowInstance(wi));
+            }
+        return workflowInstances;
+    }
+
+
+
+}

Modified: oodt/branches/avro_rpc/workflow/src/main/resources/workflow.properties
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/main/resources/workflow.properties?rev=1703320&r1=1703319&r2=1703320&view=diff
==============================================================================
--- oodt/branches/avro_rpc/workflow/src/main/resources/workflow.properties 
(original)
+++ oodt/branches/avro_rpc/workflow/src/main/resources/workflow.properties Wed 
Sep 16 03:11:50 2015
@@ -15,6 +15,12 @@
 #
 # Properties required to configure the Workflow Manager
 
+#Rpc workflow communication class
+workflow.server.factory = 
org.apache.oodt.cas.workflow.system.rpc.XmlRpcWorkflowManagerFactory
+workflow.client.factory = 
org.apache.oodt.cas.workflow.system.rpc.XmlRpcWorkflowManagerFactory
+#workflow.server.factory = 
org.apache.oodt.cas.workflow.system.AvroRpcWorkflowManagerFactory
+#workflow.client.factory = 
org.apache.oodt.cas.workflow.system.AvroRpcWorkflowManagerFactory
+
 # workflow repository factory
 workflow.repo.factory = 
org.apache.oodt.cas.workflow.repository.XMLWorkflowRepositoryFactory
 

Modified: 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/cli/TestWorkflowCli.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/cli/TestWorkflowCli.java?rev=1703320&r1=1703319&r2=1703320&view=diff
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/cli/TestWorkflowCli.java
 (original)
+++ 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/cli/TestWorkflowCli.java
 Wed Sep 16 03:11:50 2015
@@ -21,8 +21,8 @@ import org.apache.oodt.cas.cli.CmdLineUt
 import org.apache.oodt.cas.cli.util.OptionPropertyRegister;
 import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.workflow.repository.MockWorkflowRepository;
-import org.apache.oodt.cas.workflow.system.MockXmlRpcWorkflowManagerClient;
-import 
org.apache.oodt.cas.workflow.system.MockXmlRpcWorkflowManagerClient.MethodCallDetails;
+import org.apache.oodt.cas.workflow.system.MockWorkflowManagerClient;
+import 
org.apache.oodt.cas.workflow.system.MockWorkflowManagerClient.MethodCallDetails;
 
 //Google imports
 import com.google.common.collect.Lists;
@@ -47,7 +47,7 @@ public class TestWorkflowCli extends Tes
    }
 
    private CmdLineUtility cmdLineUtility;
-   private MockXmlRpcWorkflowManagerClient client;
+   private MockWorkflowManagerClient client;
 
    @Override
    public void setUp() throws Exception {

Modified: 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/cli/UseMockClientCmdLineActionStore.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/cli/UseMockClientCmdLineActionStore.java?rev=1703320&r1=1703319&r2=1703320&view=diff
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/cli/UseMockClientCmdLineActionStore.java
 (original)
+++ 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/cli/UseMockClientCmdLineActionStore.java
 Wed Sep 16 03:11:50 2015
@@ -24,22 +24,22 @@ import org.apache.oodt.cas.cli.action.Cm
 import org.apache.oodt.cas.cli.action.store.spring.SpringCmdLineActionStore;
 import org.apache.oodt.cas.cli.exception.CmdLineActionStoreException;
 import org.apache.oodt.cas.workflow.cli.action.WorkflowCliAction;
-import org.apache.oodt.cas.workflow.system.MockXmlRpcWorkflowManagerClient;
+import org.apache.oodt.cas.workflow.system.MockWorkflowManagerClient;
 
 /**
  * A {@link SpringCmdLineActionStore} which sets {@link WorkflowCliAction}s
- * to use a {@link MockXmlRpcWorkflowManagerClient}.
+ * to use a {@link MockWorkflowManagerClient}.
  *
  * @author bfoster (Brian Foster)
  */
 public class UseMockClientCmdLineActionStore extends SpringCmdLineActionStore {
 
-   private MockXmlRpcWorkflowManagerClient client;
+   private MockWorkflowManagerClient client;
 
    public UseMockClientCmdLineActionStore() {
       
super(System.getProperty("org.apache.oodt.cas.cli.action.spring.config"));
       try {
-         client = new MockXmlRpcWorkflowManagerClient();
+         client = new MockWorkflowManagerClient();
       } catch (Exception e) {
          throw new RuntimeException(e);
       }
@@ -55,7 +55,7 @@ public class UseMockClientCmdLineActionS
       return actions;
    }
 
-   public MockXmlRpcWorkflowManagerClient getClient() {
+   public MockWorkflowManagerClient getClient() {
       return client;
    }
 }

Added: 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/system/MockWorkflowManagerClient.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/system/MockWorkflowManagerClient.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/system/MockWorkflowManagerClient.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/system/MockWorkflowManagerClient.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,327 @@
+/*
+ * 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.oodt.cas.workflow.system;
+
+//JDK imports
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+
+//OODT imports
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.repository.MockWorkflowRepository;
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+
+//Google imports
+import com.google.common.collect.Lists;
+
+/**
+ * A Mock {@link AvroRpcWorkflowManagerClient}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class MockWorkflowManagerClient extends
+      AvroRpcWorkflowManagerClient {
+
+   private MethodCallDetails lastMethodCallDetails;
+   private MockWorkflowRepository workflowRepo;
+
+   public MockWorkflowManagerClient() throws MalformedURLException {
+      super(new URL("http://localhost:9000";));
+      workflowRepo = new MockWorkflowRepository();
+   }
+
+   public MethodCallDetails getLastMethodCallDetails() {
+      return lastMethodCallDetails;
+   }
+
+   public String executeDynamicWorkflow(List<String> taskIds, Metadata 
metadata)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails("executeDynamicWorkflow",
+            Lists.newArrayList(taskIds, metadata));
+      return "TestId1";
+   }
+
+   public List<String> getRegisteredEvents() throws Exception {
+      lastMethodCallDetails = new MethodCallDetails("getRegisteredEvents",
+            Lists.newArrayList());
+      return workflowRepo.getRegisteredEvents();
+   }
+
+   public WorkflowInstancePage getFirstPage() throws Exception {
+      lastMethodCallDetails = new MethodCallDetails("getFirstPage",
+            Lists.newArrayList());
+      WorkflowInstancePage page = new WorkflowInstancePage();
+      page.setPageNum(1);
+      page.setPageSize(0);
+      page.setTotalPages(0);
+      page.setPageWorkflows(Lists.newArrayList());
+      return page;
+   }
+
+   public WorkflowInstancePage getNextPage(WorkflowInstancePage currentPage)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails("getNextPage",
+            Lists.newArrayList((Object) currentPage));
+      WorkflowInstancePage page = new WorkflowInstancePage();
+      page.setPageNum(1);
+      page.setPageSize(0);
+      page.setTotalPages(0);
+      page.setPageWorkflows(Lists.newArrayList());
+      return page;
+   }
+
+   public WorkflowInstancePage getPrevPage(WorkflowInstancePage currentPage)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails("getPrevPage",
+            Lists.newArrayList((Object) currentPage));
+      WorkflowInstancePage page = new WorkflowInstancePage();
+      page.setPageNum(1);
+      page.setPageSize(0);
+      page.setTotalPages(0);
+      page.setPageWorkflows(Lists.newArrayList());
+      return page;
+   }
+
+   public WorkflowInstancePage getLastPage() throws Exception {
+      lastMethodCallDetails = new MethodCallDetails("getLastPage", null);
+      WorkflowInstancePage page = new WorkflowInstancePage();
+      page.setPageNum(1);
+      page.setPageSize(0);
+      page.setTotalPages(0);
+      page.setPageWorkflows(Lists.newArrayList());
+      return page;
+   }
+
+   public WorkflowInstancePage paginateWorkflowInstances(int pageNum,
+         String status) throws Exception {
+      lastMethodCallDetails = new 
MethodCallDetails("paginateWorkflowInstances",
+            Lists.newArrayList(pageNum, (Object) status));
+      WorkflowInstancePage page = new WorkflowInstancePage();
+      page.setPageNum(1);
+      page.setPageSize(0);
+      page.setTotalPages(0);
+      page.setPageWorkflows(Lists.newArrayList());
+      return page;
+   }
+
+   public WorkflowInstancePage paginateWorkflowInstances(int pageNum)
+         throws Exception {
+      lastMethodCallDetails = new 
MethodCallDetails("paginateWorkflowInstances",
+            Lists.newArrayList((Object) pageNum));
+      WorkflowInstancePage page = new WorkflowInstancePage();
+      page.setPageNum(1);
+      page.setPageSize(0);
+      page.setTotalPages(0);
+      page.setPageWorkflows(Lists.newArrayList());
+      return page;
+   }
+
+   public List<Workflow> getWorkflowsByEvent(String eventName) throws 
Exception {
+      lastMethodCallDetails = new MethodCallDetails("getWorkflowsByEvent",
+            Lists.newArrayList((Object) eventName));
+      return workflowRepo.getWorkflowsForEvent(eventName);
+   }
+
+   public Metadata getWorkflowInstanceMetadata(String wInstId) throws 
Exception {
+      lastMethodCallDetails = new 
MethodCallDetails("getWorkflowInstanceMetadata",
+            Lists.newArrayList((Object) wInstId));
+      return new Metadata();
+   }
+
+   public synchronized boolean setWorkflowInstanceCurrentTaskStartDateTime(
+         String wInstId, String startDateTimeIsoStr) throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "setWorkflowInstanceCurrentTaskStartDateTime",
+            Lists.newArrayList((Object) wInstId, startDateTimeIsoStr));
+      return true;
+   }
+
+   public double getWorkflowCurrentTaskWallClockMinutes(String workflowInstId)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getWorkflowCurrentTaskWallClockMinutes",
+            Lists.newArrayList((Object) workflowInstId));
+      return 0.0;
+   }
+
+   public double getWorkflowWallClockMinutes(String workflowInstId)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getWorkflowWallClockMinutes",
+            Lists.newArrayList((Object) workflowInstId));
+      return 0.0;
+   }
+
+   public synchronized boolean stopWorkflowInstance(String workflowInstId)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "stopWorkflowInstance",
+            Lists.newArrayList((Object) workflowInstId));
+      return true;
+   }
+
+   public synchronized boolean pauseWorkflowInstance(String workflowInstId)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "pauseWorkflowInstance",
+            Lists.newArrayList((Object) workflowInstId));
+      return true;
+   }
+
+   public synchronized boolean resumeWorkflowInstance(String workflowInstId)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "resumeWorkflowInstance",
+            Lists.newArrayList((Object) workflowInstId));
+      return true;
+   }
+
+   public synchronized boolean setWorkflowInstanceCurrentTaskEndDateTime(
+         String wInstId, String endDateTimeIsoStr) throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "setWorkflowInstanceCurrentTaskEndDateTime",
+            Lists.newArrayList((Object) wInstId, endDateTimeIsoStr));
+      return true;
+   }
+
+   public synchronized boolean updateWorkflowInstanceStatus(
+         String workflowInstId, String status) throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "updateWorkflowInstanceStatus",
+            Lists.newArrayList((Object) workflowInstId, status));
+      return true;
+   }
+
+   public synchronized boolean updateWorkflowInstance(WorkflowInstance 
instance)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "updateWorkflowInstance",
+            Lists.newArrayList((Object) instance));
+      return true;
+   }
+
+   public synchronized boolean updateMetadataForWorkflow(String workflowInstId,
+         Metadata metadata) throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "updateMetadataForWorkflow",
+            Lists.newArrayList((Object) workflowInstId, metadata));
+      return true;
+   }
+
+   public boolean sendEvent(String eventName, Metadata metadata)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "sendEvent",
+            Lists.newArrayList((Object) eventName, metadata));
+      return true;
+   }
+
+   public WorkflowTask getTaskById(String taskId) throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getTaskById",
+            Lists.newArrayList((Object) taskId));
+      return workflowRepo.getWorkflowTaskById(taskId);
+   }
+
+   public WorkflowCondition getConditionById(String conditionId)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getConditionById",
+            Lists.newArrayList((Object) conditionId));
+      return workflowRepo.getWorkflowConditionById(conditionId);
+   }
+
+   public WorkflowInstance getWorkflowInstanceById(String wInstId)
+         throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getWorkflowInstanceById",
+            Lists.newArrayList((Object) wInstId));
+      WorkflowInstance wInst = new WorkflowInstance();
+      wInst.setStatus("Running");
+      wInst.setId("TestId");
+      wInst.setWorkflow(workflowRepo.getWorkflowById(
+            MockWorkflowRepository.WORKFLOW1_ID));
+      wInst.setCurrentTaskId(MockWorkflowRepository.TASK1_ID);
+      return wInst;
+   }
+
+   public Workflow getWorkflowById(String workflowId) throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getWorkflowById",
+            Lists.newArrayList((Object) workflowId));
+      return workflowRepo.getWorkflowById(workflowId);
+   }
+
+   public Vector<Workflow> getWorkflows() throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getWorkflows",
+            Lists.newArrayList());
+      return new Vector<Workflow>(workflowRepo.getWorkflows());
+   }
+
+   public int getNumWorkflowInstancesByStatus(String status) throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getNumWorkflowInstancesByStatus",
+            Lists.newArrayList((Object) status));
+      return 1;
+   }
+
+   public int getNumWorkflowInstances() throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getNumWorkflowInstances",
+            Lists.newArrayList());
+      return 1;
+   }
+
+   public Vector<WorkflowInstance> getWorkflowInstancesByStatus(String status) 
throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getWorkflowInstancesByStatus",
+            Lists.newArrayList((Object) status));
+      return new Vector<WorkflowInstance>();
+   }
+
+   public Vector<WorkflowInstance> getWorkflowInstances() throws Exception {
+      lastMethodCallDetails = new MethodCallDetails(
+            "getWorkflowInstances",
+            Lists.newArrayList());
+      return new Vector<WorkflowInstance>();
+   }
+
+   public class MethodCallDetails {
+      private String methodName;
+      private List<Object> args;
+
+      public MethodCallDetails(String methodName, List<Object> args) {
+         this.methodName = methodName;
+         this.args = args;
+      }
+
+      public String getMethodName() {
+         return methodName;
+      }
+
+      public List<Object> getArgs() {
+         return args;
+      }
+   }
+}

Added: 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/system/TestAvroRpcWorkflowManager.java
URL: 
http://svn.apache.org/viewvc/oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/system/TestAvroRpcWorkflowManager.java?rev=1703320&view=auto
==============================================================================
--- 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/system/TestAvroRpcWorkflowManager.java
 (added)
+++ 
oodt/branches/avro_rpc/workflow/src/test/java/org/apache/oodt/cas/workflow/system/TestAvroRpcWorkflowManager.java
 Wed Sep 16 03:11:50 2015
@@ -0,0 +1,159 @@
+/*
+ * 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.oodt.cas.workflow.system;
+
+import junit.framework.TestCase;
+import org.apache.commons.io.FileUtils;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.system.rpc.RpcCommunicationFactory;
+import org.apache.oodt.cas.workflow.util.AvroTypeFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class TestAvroRpcWorkflowManager extends TestCase {
+
+    private static final int WM_PORT = 50002;
+
+    private AvroRpcWorkflowManager wmgr;
+
+    private String luceneCatLoc;
+
+    private static final Logger LOG = Logger
+            .getLogger(TestXmlRpcWorkflowManager.class.getName());
+
+    public void testGetWorkflowInstances() {
+
+        Vector workflowInsts = null;
+
+        int numInsts = -1;
+        while (numInsts != 2) {
+            try {
+                List list = 
AvroTypeFactory.getWorkflowInstances(wmgr.getWorkflowInstances());
+                workflowInsts = new Vector();
+                for (Object o : list){
+                    workflowInsts.add(o);
+                }
+            } catch (Exception e) {
+
+                e.printStackTrace();
+            }
+
+            assertNotNull(workflowInsts);
+            numInsts = workflowInsts.size();
+        }
+
+        assertEquals(2, workflowInsts.size());
+    }
+
+    protected void setUp() throws Exception {
+        startAvroRpcWorkflowManager();
+        startWorkflow();
+    }
+
+    protected void tearDown() throws Exception {
+
+    }
+
+    private void startWorkflow() {
+        WorkflowManagerClient client = null;
+        try {
+            client = new AvroRpcWorkflowManagerClient(new 
URL("http://localhost:";
+                    + WM_PORT));
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+
+        try {
+            client.sendEvent("long", new Metadata());
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+
+    }
+
+    private void startAvroRpcWorkflowManager() {
+        URL ulr = 
TestAvroRpcWorkflowManager.class.getResource("/workflow.properties");
+        System.setProperty("java.util.logging.config.file", new File(
+                "./src/main/resources/logging.properties").getAbsolutePath());
+
+        try {
+            FileInputStream fileInputStream = new 
FileInputStream(ulr.getPath());
+            System.getProperties().load(
+                    fileInputStream);
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+
+        try {
+            luceneCatLoc = File.createTempFile("blah", "txt").getParentFile()
+                    .getCanonicalPath();
+            luceneCatLoc = !luceneCatLoc.endsWith("/") ? luceneCatLoc + "/"
+                    : luceneCatLoc;
+            luceneCatLoc += "repo";
+            LOG.log(Level.INFO, "Lucene instance repository: [" + luceneCatLoc 
+ "]");
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+
+        if (new File(luceneCatLoc).exists()) {
+            // blow away lucene cat
+            LOG.log(Level.INFO, "Removing workflow instance repository: ["
+                    + luceneCatLoc + "]");
+            try {
+                FileUtils.deleteDirectory(new File(luceneCatLoc));
+            } catch (IOException e) {
+                fail(e.getMessage());
+            }
+        }
+
+        System
+                .setProperty("workflow.engine.instanceRep.factory",
+                        
"org.apache.oodt.cas.workflow.instrepo.LuceneWorkflowInstanceRepositoryFactory");
+        System
+                
.setProperty("org.apache.oodt.cas.workflow.instanceRep.lucene.idxPath",
+                        luceneCatLoc);
+
+        try {
+            System.setProperty("org.apache.oodt.cas.workflow.repo.dirs", 
"file://"
+                    + new 
File("./src/main/resources/examples").getCanonicalPath());
+            
System.setProperty("org.apache.oodt.cas.workflow.lifecycle.filePath",
+                    new 
File("./src/main/resources/examples/workflow-lifecycle.xml")
+                            .getCanonicalPath());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+
+        try {
+            wmgr = new AvroRpcWorkflowManager(WM_PORT);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+
+    }
+
+
+}


Reply via email to