You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2010/12/23 03:47:22 UTC
svn commit: r1052147 [7/12] - in /oodt/branches/wengine-branch/wengine: ./
src/ src/main/ src/main/assembly/ src/main/bin/ src/main/java/
src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/oodt/
src/main/java/org/apache/oodt/cas/ src...
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/AbstractCommunicationChannelServer.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/AbstractCommunicationChannelServer.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/AbstractCommunicationChannelServer.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/AbstractCommunicationChannelServer.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,501 @@
+/*
+ * 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.server.channel;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.page.PageInfo;
+import org.apache.oodt.cas.catalog.query.QueryExpression;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.engine.WorkflowEngine;
+import org.apache.oodt.cas.workflow.event.WorkflowEngineEvent;
+import org.apache.oodt.cas.workflow.instance.repo.WorkflowInstanceRepository;
+import org.apache.oodt.cas.workflow.model.WorkflowGraph;
+import org.apache.oodt.cas.workflow.model.WorkflowModel;
+import org.apache.oodt.cas.workflow.page.PageFilter;
+import org.apache.oodt.cas.workflow.page.QueryPage;
+import org.apache.oodt.cas.workflow.page.QueuePage;
+import org.apache.oodt.cas.workflow.page.RunnablesPage;
+import org.apache.oodt.cas.workflow.priority.Priority;
+import org.apache.oodt.cas.workflow.processor.ProcessorInfo;
+import org.apache.oodt.cas.workflow.processor.ProcessorSkeleton;
+import org.apache.oodt.cas.workflow.processor.ProcessorStub;
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+import org.apache.oodt.cas.workflow.util.Serializer;
+
+//JDK imports
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Communication Channel between for server to respond to client calls
+ * <p>
+ */
+public abstract class AbstractCommunicationChannelServer implements CommunicationChannelServer {
+
+ protected static Logger LOG = Logger.getLogger(AbstractCommunicationChannelServer.class.getName());
+
+ protected WorkflowEngine workflowEngine;
+ protected int port;
+ protected Serializer serializer;
+
+ public AbstractCommunicationChannelServer() {
+ this.serializer = new Serializer();
+ }
+
+ public void shutdown() throws Exception {
+ try {
+ this.workflowEngine.shutdown();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to shutdown engine : " + e.getMessage(), e);
+ throw new Exception("Failed to shutdown engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void pauseRunner() throws Exception {
+ try {
+ this.workflowEngine.pauseRunner();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to pause engine runner : " + e.getMessage(), e);
+ throw new Exception("Failed to pause engine runner : " + e.getMessage(), e);
+ }
+ }
+
+ public void resumeRunner() throws Exception {
+ try {
+ this.workflowEngine.resumeRunner();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to resume engine runner : " + e.getMessage(), e);
+ throw new Exception("Failed to resume engine runner : " + e.getMessage(), e);
+ }
+ }
+
+ public Date getLaunchDate() throws Exception {
+ try {
+ return this.workflowEngine.getLaunchDate();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed get launch date from engine : " + e.getMessage(), e);
+ throw new Exception("Failed get launch date from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void setWorkflowEngine(WorkflowEngine workflowEngine) {
+ this.workflowEngine = workflowEngine;
+ }
+
+ public void deleteWorkflow(String instanceId)
+ throws Exception {
+ try {
+ this.workflowEngine.deleteWorkflow(instanceId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to delete workflow '" + instanceId + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to delete workflow '" + instanceId + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public Metadata getInstanceMetadata(String jobId) throws Exception {
+ try {
+ return this.workflowEngine.getInstanceMetadata(jobId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get instance metadata for job '" + jobId + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get instance metadata for job '" + jobId + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public WorkflowInstanceRepository getInstanceRepository() throws Exception {
+ try {
+ return this.workflowEngine.getInstanceRepository();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get instance repo from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get instance repo from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public WorkflowModel getModel(String modelId) throws Exception {
+ try {
+ return this.workflowEngine.getModel(modelId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get model '" + modelId + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get model '" + modelId + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public List<WorkflowModel> getModels() throws Exception {
+ try {
+ return this.workflowEngine.getModels();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get models from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get models from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public WorkflowGraph getWorkflowGraph(String modelId) throws Exception {
+ try {
+ return this.workflowEngine.getWorkflowGraph(modelId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get graph '" + modelId + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get graph '" + modelId + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public List<WorkflowGraph> getWorkflowGraphs() throws Exception {
+ try {
+ return this.workflowEngine.getWorkflowGraphs();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get graphs from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get graphs from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public Set<String> getSupportedProcessorIds() throws Exception {
+ try {
+ return this.workflowEngine.getSupportedProcessorIds();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get supported processor ids from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get supported processor ids from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public ProcessorInfo getProcessorInfo(String instanceId, String modelId) throws Exception {
+ try {
+ return this.workflowEngine.getProcessorInfo(instanceId, modelId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get processor info for workflow [instanceid='" + instanceId + "',modelId='" + modelId + "'] from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get processor info for workflow [instanceid='" + instanceId + "',modelId='" + modelId + "'] from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public Metadata getWorkflowMetadata(String instanceId,
+ String modelId) throws Exception {
+ try {
+ return this.workflowEngine.getWorkflowMetadata(instanceId, modelId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get workflow metadata [instanceid='" + instanceId + "',modelId='" + modelId + "'] from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get workflow metadata [instanceid='" + instanceId + "',modelId='" + modelId + "'] from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void pauseWorkflow(String instanceId)
+ throws Exception {
+ try {
+ this.workflowEngine.pauseWorkflow(instanceId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to pause workflow '" + instanceId + "' : " + e.getMessage(), e);
+ throw new Exception("Failed to pause workflow '" + instanceId + "' : " + e.getMessage(), e);
+ }
+ }
+
+ public void resumeWorkflow(String instanceId)
+ throws Exception {
+ try {
+ this.workflowEngine.resumeWorkflow(instanceId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to resume workflow '" + instanceId + "' : " + e.getMessage(), e);
+ throw new Exception("Failed to resume workflow '" + instanceId + "' : " + e.getMessage(), e);
+ }
+ }
+
+ public void setWorkflowState(String instanceId,
+ String modelId, WorkflowState state) throws Exception {
+ try {
+ this.workflowEngine.setWorkflowState(instanceId, modelId, state);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to set state '" + state + "' for workflow [instanceid='" + instanceId + "',modelId='" + modelId + "'] in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to set state '" + state + "' for workflow [instanceid='" + instanceId + "',modelId='" + modelId + "'] in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void setWorkflowPriority(String instanceId, String modelId, Priority priority) throws Exception {
+ try {
+ this.workflowEngine.setWorkflowPriority(instanceId, modelId, priority);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to set priority '" + priority + "' for workflow [instanceid='" + instanceId + "',modelId='" + modelId + "'] in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to set priority '" + priority + "' for workflow [instanceid='" + instanceId + "',modelId='" + modelId + "'] in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata inputMetadata)
+ throws Exception {
+ try {
+ return this.workflowEngine.startWorkflow(workflow, inputMetadata);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to start workflow '" + workflow + "' with input metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to start workflow '" + workflow + "' with input metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata inputMetadata, Priority priority)
+ throws Exception {
+ try {
+ return this.workflowEngine.startWorkflow(workflow, inputMetadata, priority);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to start workflow '" + workflow + "' with input metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' and priority '" + priority + "' in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to start workflow '" + workflow + "' with input metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' and priority '" + priority + "' in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public String startWorkflow(String modelId, Metadata inputMetadata)
+ throws Exception {
+ try {
+ return this.workflowEngine.startWorkflow(modelId, inputMetadata);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to start workflow '" + modelId + "' with input metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to start workflow '" + modelId + "' with input metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public String startWorkflow(String modelId, Metadata inputMetadata, Priority priority)
+ throws Exception {
+ try {
+ return this.workflowEngine.startWorkflow(modelId, inputMetadata, priority);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to start workflow '" + modelId + "' with input metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' and priority '" + priority + "' in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to start workflow '" + modelId + "' with input metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' and priority '" + priority + "' in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void stopWorkflow(String instanceId)
+ throws Exception {
+ try {
+ this.workflowEngine.stopWorkflow(instanceId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to stop workflow '" + instanceId + "' in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to stop workflow '" + instanceId + "' in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void updateInstanceMetadata(String jobId, Metadata metadata) throws Exception {
+ try {
+ this.workflowEngine.updateInstanceMetadata(jobId, metadata);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to update instance metadata for job '" + jobId + "' in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to update instance metadata for job '" + jobId + "' in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void updateWorkflowMetadata(String instanceId,
+ String modelId, Metadata metadata) throws Exception {
+ try {
+ this.workflowEngine.updateWorkflowMetadata(instanceId, modelId, metadata);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to update workflow metadata [InstanceId='" + instanceId + "',ModelId='" + modelId + "'] in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to update workflow metadata [InstanceId='" + instanceId + "',ModelId='" + modelId + "'] in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void updateWorkflowAndInstance(String instanceId, String modelId, WorkflowState state, Metadata metadata, String jobId, Metadata instanceMetadata) throws Exception {
+ try {
+ this.workflowEngine.updateWorkflowAndInstance(instanceId, modelId, state, metadata, jobId, instanceMetadata);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to update workflow and instance metadata [InstanceId='" + instanceId + "',ModelId='" + modelId + "',JobId='" + jobId + "'] in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to update workflow metadata [InstanceId='" + instanceId + "',ModelId='" + modelId + "',JobId='" + jobId + "'] in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void registerEvent(WorkflowEngineEvent event) throws Exception {
+ try {
+ this.workflowEngine.registerEvent(event);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to register event '" + event + "' in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to register event '" + event + "' in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public void triggerEvent(String eventId, Metadata inputMetadata) throws Exception {
+ try {
+ this.workflowEngine.triggerEvent(eventId, inputMetadata);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to trigger event '" + eventId + "' with metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' in engine : " + e.getMessage(), e);
+ throw new Exception("Failed to trigger event '" + eventId + "' with metadata '" + (inputMetadata != null ? inputMetadata.getHashtable() : inputMetadata) + "' in engine : " + e.getMessage(), e);
+ }
+ }
+
+ public List<WorkflowEngineEvent> getRegisteredEvents() throws Exception {
+ try {
+ return this.workflowEngine.getRegisteredEvents();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get registered events from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get registered events from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public List<WorkflowState> getSupportedStates() throws Exception {
+ try {
+ return this.workflowEngine.getSupportedStates();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get supported states from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get supported states from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public int getNumOfLoadedProcessors() throws Exception {
+ try {
+ return this.workflowEngine.getNumOfLoadedProcessors();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get number of loaded processors from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get number of loaded processors from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public int getNumOfWorkflows() throws Exception {
+ try {
+ return this.workflowEngine.getNumOfWorkflows();
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get number of workflows from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get number of workflows from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public RunnablesPage getExecutingPage(PageInfo pageInfo) throws Exception {
+ try {
+ return this.workflowEngine.getExecutingPage(pageInfo);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get executing page '" + pageInfo + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get executing page '" + pageInfo + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public RunnablesPage getRunnablesPage(PageInfo pageInfo) throws Exception {
+ try {
+ return this.workflowEngine.getRunnablesPage(pageInfo);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get runnbles page '" + pageInfo + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get runnbles page '" + pageInfo + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public QueuePage getPage(PageInfo pageInfo) throws Exception {
+ try {
+ return this.workflowEngine.getPage(pageInfo);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get page '" + pageInfo + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get page '" + pageInfo + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, PageFilter filter) throws Exception {
+ try {
+ return this.workflowEngine.getPage(pageInfo, filter);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get page '" + pageInfo + "' from engine with filter '" + filter + "' : " + e.getMessage(), e);
+ throw new Exception("Failed to get page '" + pageInfo + "' from engine with filter '" + filter + "' : " + e.getMessage(), e);
+ }
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, Comparator<ProcessorStub> comparator) throws Exception {
+ try {
+ return this.workflowEngine.getPage(pageInfo, comparator);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get page '" + pageInfo + "' with comparator '" + comparator + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get page '" + pageInfo + "' with comparator '" + comparator + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState state) throws Exception {
+ try {
+ return this.workflowEngine.getPage(pageInfo, state);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get page '" + pageInfo + "' of workflows in state '" + state + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get page '" + pageInfo + "' of workflows in state '" + state + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState.Category category) throws Exception {
+ try {
+ return this.workflowEngine.getPage(pageInfo, category);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get page '" + pageInfo + "' of workflows in category '" + category + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get page '" + pageInfo + "' of workflows in category '" + category + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, String modelId) throws Exception {
+ try {
+ return this.workflowEngine.getPage(pageInfo, modelId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get page '" + pageInfo + "' of workflows of modelId '" + modelId + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get page '" + pageInfo + "' of workflows of modelId '" + modelId + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, Map<String, List<String>> keyValPairs) throws Exception {
+ try {
+ return this.workflowEngine.getPage(pageInfo, keyValPairs);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get page '" + pageInfo + "' of workflows with metadata '" + keyValPairs + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get page '" + pageInfo + "' of workflows with metadata '" + keyValPairs + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public QueuePage getNextPage(QueuePage page) throws Exception {
+ try {
+ return this.workflowEngine.getNextPage(page);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get next queue page '" + page + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get next queue page '" + page + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public ProcessorSkeleton getWorkflow(String instanceId) throws Exception {
+ try {
+ return this.workflowEngine.getWorkflow(instanceId);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get next skeleton for workflow '" + instanceId + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get next skeleton for workflow '" + instanceId + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public QueryPage getNextPage(QueryPage page) throws Exception {
+ try {
+ return this.workflowEngine.getNextPage(page);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get next query page '" + page + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get next query page '" + page + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public QueryPage getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception {
+ try {
+ return this.workflowEngine.getPage(pageInfo, queryExpression);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get query page '" + pageInfo + "' for query '" + queryExpression + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get query page '" + pageInfo + "' for query '" + queryExpression + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+ public List<Metadata> getMetadata(QueryPage page) throws Exception {
+ try {
+ return this.workflowEngine.getMetadata(page);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to get metadata for query page '" + page + "' from engine : " + e.getMessage(), e);
+ throw new Exception("Failed to get metadata for query page '" + page + "' from engine : " + e.getMessage(), e);
+ }
+ }
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelClient.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelClient.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelClient.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelClient.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,146 @@
+/*
+ * 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.server.channel;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.page.PageInfo;
+import org.apache.oodt.cas.catalog.query.QueryExpression;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.event.WorkflowEngineEvent;
+import org.apache.oodt.cas.workflow.instance.repo.WorkflowInstanceRepository;
+import org.apache.oodt.cas.workflow.model.WorkflowGraph;
+import org.apache.oodt.cas.workflow.model.WorkflowModel;
+import org.apache.oodt.cas.workflow.page.PageFilter;
+import org.apache.oodt.cas.workflow.page.QueryPage;
+import org.apache.oodt.cas.workflow.page.QueuePage;
+import org.apache.oodt.cas.workflow.page.RunnablesPage;
+import org.apache.oodt.cas.workflow.priority.Priority;
+import org.apache.oodt.cas.workflow.processor.ProcessorInfo;
+import org.apache.oodt.cas.workflow.processor.ProcessorSkeleton;
+import org.apache.oodt.cas.workflow.processor.ProcessorStub;
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+//JDK imports
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Communication Channel for client to talk to server
+ * <p>
+ */
+public interface CommunicationChannelClient {
+
+ public void shutdown() throws Exception;
+
+ public void pauseRunner() throws Exception;
+
+ public void resumeRunner() throws Exception;
+
+ public Date getLaunchDate() throws Exception;
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata) throws Exception;
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata, Priority priority) throws Exception;
+
+ public String startWorkflow(String modelId, Metadata inputMetadata) throws Exception;
+
+ public String startWorkflow(String modelId, Metadata inputMetadata, Priority priority) throws Exception;
+
+ public void deleteWorkflow(String instanceId) throws Exception;
+
+ public void stopWorkflow(String instanceId) throws Exception;
+
+ public void pauseWorkflow(String instanceId) throws Exception;
+
+ public void resumeWorkflow(String instanceId) throws Exception;
+
+ public WorkflowModel getModel(String modelId) throws Exception;
+
+ public WorkflowGraph getWorkflowGraph(String modelId) throws Exception;
+
+ public Set<String> getSupportedProcessorIds() throws Exception;
+
+ public List<WorkflowModel> getModels() throws Exception;
+
+ public List<WorkflowGraph> getWorkflowGraphs() throws Exception;
+
+ public ProcessorInfo getProcessorInfo(String instanceId, String modelId) throws Exception;
+
+ public WorkflowInstanceRepository getInstanceRepository() throws Exception;
+
+ public void updateWorkflowMetadata(String instanceId, String modelId, Metadata metadata) throws Exception;
+
+ public void updateInstanceMetadata(String jobId, Metadata metadata) throws Exception;
+
+ public void updateWorkflowAndInstance(String instanceId, String modelId, WorkflowState state, Metadata metadata, String jobId, Metadata instanceMetadata) throws Exception;
+
+ public void setWorkflowState(String instanceId, String modelId, WorkflowState state) throws Exception;
+
+ public void setWorkflowPriority(String instanceId, String modelId, Priority priority) throws Exception;
+
+ public Metadata getWorkflowMetadata(String instanceId, String modelId) throws Exception;
+
+ public Metadata getInstanceMetadata(String jobId) throws Exception;
+
+ public void registerEvent(WorkflowEngineEvent event) throws Exception;
+
+ public void triggerEvent(String eventId, Metadata inputMetadata) throws Exception;
+
+ public List<WorkflowEngineEvent> getRegisteredEvents() throws Exception;
+
+ public List<WorkflowState> getSupportedStates() throws Exception;
+
+ public int getNumOfLoadedProcessors() throws Exception;
+
+ public int getNumOfWorkflows() throws Exception;
+
+ public RunnablesPage getExecutingPage(PageInfo pageInfo) throws Exception;
+
+ public RunnablesPage getRunnablesPage(PageInfo pageInfo) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, PageFilter filter) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, Comparator<ProcessorStub> comparator) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState state) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState.Category category) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, String modelId) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, Map<String, List<String>> keyValPairs) throws Exception;
+
+ public QueuePage getNextPage(QueuePage page) throws Exception;
+
+ public ProcessorSkeleton getWorkflow(String instanceId) throws Exception;
+
+ public QueryPage getNextPage(QueryPage page) throws Exception;
+
+ public QueryPage getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception;
+
+ public List<Metadata> getMetadata(QueryPage page) throws Exception;
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelClientFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelClientFactory.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelClientFactory.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelClientFactory.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.server.channel;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Factory for creating CommunicationChannelClient
+ * <p>
+ */
+public interface CommunicationChannelClientFactory {
+
+ public CommunicationChannelClient createCommunicationChannelClient();
+
+ public void setServerUrl(String url);
+
+ public String getServerUrl();
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelServer.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelServer.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelServer.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelServer.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,153 @@
+/*
+ * 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.server.channel;
+
+//JDK imports
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.page.PageInfo;
+import org.apache.oodt.cas.catalog.query.QueryExpression;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.engine.WorkflowEngine;
+import org.apache.oodt.cas.workflow.event.WorkflowEngineEvent;
+import org.apache.oodt.cas.workflow.instance.repo.WorkflowInstanceRepository;
+import org.apache.oodt.cas.workflow.model.WorkflowGraph;
+import org.apache.oodt.cas.workflow.model.WorkflowModel;
+import org.apache.oodt.cas.workflow.page.PageFilter;
+import org.apache.oodt.cas.workflow.page.QueryPage;
+import org.apache.oodt.cas.workflow.page.QueuePage;
+import org.apache.oodt.cas.workflow.page.RunnablesPage;
+import org.apache.oodt.cas.workflow.priority.Priority;
+import org.apache.oodt.cas.workflow.processor.ProcessorInfo;
+import org.apache.oodt.cas.workflow.processor.ProcessorSkeleton;
+import org.apache.oodt.cas.workflow.processor.ProcessorStub;
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Communication Channel between for server to respond to client calls
+ * <p>
+ */
+public interface CommunicationChannelServer {
+
+ public void setPort(int port) throws Exception;
+
+ public void setWorkflowEngine(WorkflowEngine workflowEngine) throws Exception;
+
+ public void startup() throws Exception;
+
+ public void shutdown() throws Exception;
+
+ public void pauseRunner() throws Exception;
+
+ public void resumeRunner() throws Exception;
+
+ public Date getLaunchDate() throws Exception;
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata) throws Exception;
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata, Priority priority) throws Exception;
+
+ public String startWorkflow(String modelId, Metadata inputMetadata) throws Exception;
+
+ public String startWorkflow(String modelId, Metadata inputMetadata, Priority priority) throws Exception;
+
+ public void deleteWorkflow(String instanceId) throws Exception;
+
+ public void stopWorkflow(String instanceId) throws Exception;
+
+ public void pauseWorkflow(String instanceId) throws Exception;
+
+ public void resumeWorkflow(String instanceId) throws Exception;
+
+ public Set<String> getSupportedProcessorIds() throws Exception;
+
+ public WorkflowModel getModel(String modelId) throws Exception;
+
+ public WorkflowGraph getWorkflowGraph(String modelId) throws Exception;
+
+ public List<WorkflowModel> getModels() throws Exception;
+
+ public List<WorkflowGraph> getWorkflowGraphs() throws Exception;
+
+ public ProcessorInfo getProcessorInfo(String instanceId, String modelId) throws Exception;
+
+ public WorkflowInstanceRepository getInstanceRepository() throws Exception;
+
+ public void updateWorkflowMetadata(String instanceId, String modelId, Metadata metadata) throws Exception;
+
+ public void updateInstanceMetadata(String jobId, Metadata metadata) throws Exception;
+
+ public void updateWorkflowAndInstance(String instanceId, String modelId, WorkflowState state, Metadata metadata, String jobId, Metadata instanceMetadata) throws Exception;
+
+ public void setWorkflowState(String instanceId, String modelId, WorkflowState state) throws Exception;
+
+ public void setWorkflowPriority(String instanceId, String modelId, Priority priority) throws Exception;
+
+ public Metadata getWorkflowMetadata(String instanceId, String modelId) throws Exception;
+
+ public Metadata getInstanceMetadata(String jobId) throws Exception;
+
+ public void registerEvent(WorkflowEngineEvent event) throws Exception;
+
+ public void triggerEvent(String eventId, Metadata inputMetadata) throws Exception;
+
+ public List<WorkflowEngineEvent> getRegisteredEvents() throws Exception;
+
+ public List<WorkflowState> getSupportedStates() throws Exception;
+
+ public int getNumOfLoadedProcessors() throws Exception;
+
+ public int getNumOfWorkflows() throws Exception;
+
+ public RunnablesPage getExecutingPage(PageInfo pageInfo) throws Exception;
+
+ public RunnablesPage getRunnablesPage(PageInfo pageInfo) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, PageFilter filter) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, Comparator<ProcessorStub> comparator) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState state) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState.Category category) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, String modelId) throws Exception;
+
+ public QueuePage getPage(PageInfo pageInfo, Map<String, List<String>> keyValPairs) throws Exception;
+
+ public QueuePage getNextPage(QueuePage page) throws Exception;
+
+ public ProcessorSkeleton getWorkflow(String instanceId) throws Exception;
+
+ public QueryPage getNextPage(QueryPage page) throws Exception;
+
+ public QueryPage getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception;
+
+ public List<Metadata> getMetadata(QueryPage page) throws Exception;
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelServerFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelServerFactory.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelServerFactory.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/CommunicationChannelServerFactory.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.server.channel;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.WorkflowEngineFactory;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Factory for creating CommunicationChannelServer
+ * <p>
+ */
+public interface CommunicationChannelServerFactory {
+
+ public CommunicationChannelServer createCommunicationChannelServer();
+
+ public void setPort(int port);
+
+ public int getPort();
+
+ public void setWorkflowEngineFactory(WorkflowEngineFactory workflowEngineFactory);
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelClient.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelClient.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelClient.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelClient.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,264 @@
+/*
+ * 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.server.channel;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.page.PageInfo;
+import org.apache.oodt.cas.catalog.query.QueryExpression;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.event.WorkflowEngineEvent;
+import org.apache.oodt.cas.workflow.instance.repo.WorkflowInstanceRepository;
+import org.apache.oodt.cas.workflow.model.WorkflowGraph;
+import org.apache.oodt.cas.workflow.model.WorkflowModel;
+import org.apache.oodt.cas.workflow.page.PageFilter;
+import org.apache.oodt.cas.workflow.page.QueryPage;
+import org.apache.oodt.cas.workflow.page.QueuePage;
+import org.apache.oodt.cas.workflow.page.RunnablesPage;
+import org.apache.oodt.cas.workflow.priority.Priority;
+import org.apache.oodt.cas.workflow.processor.ProcessorInfo;
+import org.apache.oodt.cas.workflow.processor.ProcessorSkeleton;
+import org.apache.oodt.cas.workflow.processor.ProcessorStub;
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+import org.apache.oodt.cas.workflow.state.WorkflowState.Category;
+
+//JDK imports
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author bfoster
+ *
+ */
+public class MultiCommunicationChannelClient extends
+ AbstractCommunicationChannelClient {
+
+ private CommunicationChannelClient useClient;
+ private List<CommunicationChannelClient> clients;
+
+ public MultiCommunicationChannelClient(CommunicationChannelClient useClient, List<CommunicationChannelClient> clients) {
+ this.useClient = useClient;
+ this.clients = clients;
+ }
+
+ public void shutdown() throws Exception {
+ for (CommunicationChannelClient client : this.clients)
+ client.shutdown();
+ }
+
+ public void pauseRunner() throws Exception {
+ this.useClient.pauseRunner();
+ }
+
+ public void resumeRunner() throws Exception {
+ this.useClient.resumeRunner();
+ }
+
+ public void deleteWorkflow(String instanceId) throws Exception {
+ useClient.deleteWorkflow(instanceId);
+ }
+
+ public RunnablesPage getExecutingPage(PageInfo pageInfo) throws Exception {
+ return useClient.getExecutingPage(pageInfo);
+ }
+
+ public Metadata getInstanceMetadata(String jobId) throws Exception {
+ return useClient.getInstanceMetadata(jobId);
+ }
+
+ public WorkflowInstanceRepository getInstanceRepository() throws Exception {
+ return useClient.getInstanceRepository();
+ }
+
+ public Date getLaunchDate() throws Exception {
+ return useClient.getLaunchDate();
+ }
+
+ public List<Metadata> getMetadata(QueryPage page) throws Exception {
+ return useClient.getMetadata(page);
+ }
+
+ public WorkflowModel getModel(String modelId) throws Exception {
+ return useClient.getModel(modelId);
+ }
+
+ public List<WorkflowModel> getModels() throws Exception {
+ return useClient.getModels();
+ }
+
+ public QueuePage getNextPage(QueuePage page) throws Exception {
+ return useClient.getNextPage(page);
+ }
+
+ public QueryPage getNextPage(QueryPage page) throws Exception {
+ return useClient.getNextPage(page);
+ }
+
+ public int getNumOfLoadedProcessors() throws Exception {
+ return useClient.getNumOfLoadedProcessors();
+ }
+
+ public int getNumOfWorkflows() throws Exception {
+ return useClient.getNumOfWorkflows();
+ }
+
+ public QueuePage getPage(PageInfo pageInfo) throws Exception {
+ return useClient.getPage(pageInfo);
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, PageFilter filter)
+ throws Exception {
+ return useClient.getPage(pageInfo, filter);
+ }
+
+ public QueuePage getPage(PageInfo pageInfo,
+ Comparator<ProcessorStub> comparator) throws Exception {
+ return useClient.getPage(pageInfo, comparator);
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState state)
+ throws Exception {
+ return useClient.getPage(pageInfo, state);
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, Category category)
+ throws Exception {
+ return useClient.getPage(pageInfo, category);
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, String modelId)
+ throws Exception {
+ return useClient.getPage(pageInfo, modelId);
+ }
+
+ public QueuePage getPage(PageInfo pageInfo,
+ Map<String, List<String>> keyValPairs) throws Exception {
+ return useClient.getPage(pageInfo, keyValPairs);
+ }
+
+ public QueryPage getPage(PageInfo pageInfo, QueryExpression queryExpression)
+ throws Exception {
+ return useClient.getPage(pageInfo, queryExpression);
+ }
+
+ public ProcessorInfo getProcessorInfo(String instanceId, String modelId)
+ throws Exception {
+ return useClient.getProcessorInfo(instanceId, modelId);
+ }
+
+ public List<WorkflowEngineEvent> getRegisteredEvents() throws Exception {
+ return useClient.getRegisteredEvents();
+ }
+
+ public RunnablesPage getRunnablesPage(PageInfo pageInfo) throws Exception {
+ return useClient.getRunnablesPage(pageInfo);
+ }
+
+ public Set<String> getSupportedProcessorIds() throws Exception {
+ return useClient.getSupportedProcessorIds();
+ }
+
+ public List<WorkflowState> getSupportedStates() throws Exception {
+ return useClient.getSupportedStates();
+ }
+
+ public ProcessorSkeleton getWorkflow(String instanceId) throws Exception {
+ return useClient.getWorkflow(instanceId);
+ }
+
+ public WorkflowGraph getWorkflowGraph(String modelId) throws Exception {
+ return useClient.getWorkflowGraph(modelId);
+ }
+
+ public List<WorkflowGraph> getWorkflowGraphs() throws Exception {
+ return useClient.getWorkflowGraphs();
+ }
+
+ public Metadata getWorkflowMetadata(String instanceId, String modelId)
+ throws Exception {
+ return useClient.getWorkflowMetadata(instanceId, modelId);
+ }
+
+ public void pauseWorkflow(String instanceId) throws Exception {
+ useClient.pauseWorkflow(instanceId);
+ }
+
+ public void registerEvent(WorkflowEngineEvent event) throws Exception {
+ useClient.registerEvent(event);
+ }
+
+ public void resumeWorkflow(String instanceId) throws Exception {
+ useClient.resumeWorkflow(instanceId);
+ }
+
+ public void setWorkflowPriority(String instanceId, String modelId,
+ Priority priority) throws Exception {
+ useClient.setWorkflowPriority(instanceId, modelId, priority);
+ }
+
+ public void setWorkflowState(String instanceId, String modelId,
+ WorkflowState state) throws Exception {
+ useClient.setWorkflowState(instanceId, modelId, state);
+ }
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata)
+ throws Exception {
+ return useClient.startWorkflow(workflow, metadata);
+ }
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata,
+ Priority priority) throws Exception {
+ return useClient.startWorkflow(workflow, metadata, priority);
+ }
+
+ public String startWorkflow(String modelId, Metadata inputMetadata)
+ throws Exception {
+ return useClient.startWorkflow(modelId, inputMetadata);
+ }
+
+ public String startWorkflow(String modelId, Metadata inputMetadata,
+ Priority priority) throws Exception {
+ return useClient.startWorkflow(modelId, inputMetadata, priority);
+ }
+
+ public void stopWorkflow(String instanceId) throws Exception {
+ useClient.stopWorkflow(instanceId);
+ }
+
+ public void triggerEvent(String eventId, Metadata inputMetadata)
+ throws Exception {
+ useClient.triggerEvent(eventId, inputMetadata);
+ }
+
+ public void updateInstanceMetadata(String jobId, Metadata metadata)
+ throws Exception {
+ useClient.updateInstanceMetadata(jobId, metadata);
+ }
+
+ public void updateWorkflowMetadata(String instanceId, String modelId,
+ Metadata metadata) throws Exception {
+ useClient.updateWorkflowMetadata(instanceId, modelId, metadata);
+ }
+
+ public void updateWorkflowAndInstance(String instanceId, String modelId, WorkflowState state, Metadata metadata, String jobId, Metadata instanceMetadata) throws Exception {
+ useClient.updateWorkflowAndInstance(instanceId, modelId, state, metadata, jobId, instanceMetadata);
+ }
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelClientFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelClientFactory.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelClientFactory.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelClientFactory.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,73 @@
+/*
+ * 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.server.channel;
+
+//JDK imports
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author bfoster
+ *
+ */
+public class MultiCommunicationChannelClientFactory implements
+ CommunicationChannelClientFactory {
+
+ private static final Logger LOG = Logger.getLogger(MultiCommunicationChannelClientFactory.class.getName());
+
+ private String serverUrl;
+ private CommunicationChannelClientFactory useClientFactory;
+ private List<CommunicationChannelClientFactory> clientFactories;
+
+ public MultiCommunicationChannelClient createCommunicationChannelClient() {
+ try {
+ CommunicationChannelClient useClient = this.useClientFactory.createCommunicationChannelClient();
+ Vector<CommunicationChannelClient> clients = new Vector<CommunicationChannelClient>();
+ URL url = new URL(this.serverUrl);
+ int portCounter = url.getPort();
+ for (CommunicationChannelClientFactory factory : this.clientFactories) {
+ factory.setServerUrl(url.getProtocol() + "://" + url.getHost() + ":" + portCounter++);
+ clients.add(factory.createCommunicationChannelClient());
+ }
+ return new MultiCommunicationChannelClient(useClient, clients);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to create '" + MultiCommunicationChannelClientFactory.class.getName() + " : " + e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public String getServerUrl() {
+ return this.serverUrl;
+ }
+
+ public void setServerUrl(String serverUrl) {
+ this.serverUrl = serverUrl;
+ }
+
+ public void setUseClientFactory(CommunicationChannelClientFactory useClientFactory) {
+ this.useClientFactory = useClientFactory;
+ }
+
+ public void setClientFactories(List<CommunicationChannelClientFactory> clientFactories) {
+ this.clientFactories = clientFactories;
+ }
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelServer.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelServer.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelServer.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelServer.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.server.channel;
+
+//JDK imports
+import java.util.List;
+
+/**
+ *
+ * @author bfoster
+ *
+ */
+public class MultiCommunicationChannelServer extends
+ AbstractCommunicationChannelServer {
+
+ private List<CommunicationChannelServer> servers;
+
+ public MultiCommunicationChannelServer(List<CommunicationChannelServer> servers) {
+ this.servers = servers;
+ }
+
+ public void startup() throws Exception {
+ for (CommunicationChannelServer server : servers)
+ server.startup();
+ }
+
+// public void shutdown() throws Exception {
+// for (CommunicationChannelServer server : servers)
+// server.shutdown();
+// }
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelServerFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelServerFactory.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelServerFactory.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/MultiCommunicationChannelServerFactory.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,86 @@
+/*
+ * 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.server.channel;
+
+//JDK imports
+import java.util.List;
+import java.util.Vector;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.WorkflowEngine;
+import org.apache.oodt.cas.workflow.engine.WorkflowEngineFactory;
+
+/**
+ *
+ * @author bfoster
+ *
+ */
+public class MultiCommunicationChannelServerFactory implements
+ CommunicationChannelServerFactory {
+
+ private WorkflowEngineFactory workflowEngineFactory;
+ private int port;
+ private List<CommunicationChannelServerFactory> serverFactories;
+
+ public CommunicationChannelServer createCommunicationChannelServer() {
+ try {
+ if (serverFactories != null) {
+ WorkflowEngine engine = workflowEngineFactory.createEngine();
+ Vector<CommunicationChannelServer> servers = new Vector<CommunicationChannelServer>();
+ int portCounter = port;
+ for (CommunicationChannelServerFactory factory : this.serverFactories) {
+ factory.setWorkflowEngineFactory(new WorkflowEngineFactory() {
+ public WorkflowEngine createEngine() {
+ return null;
+ }
+ });
+ CommunicationChannelServer server = factory.createCommunicationChannelServer();
+ server.setWorkflowEngine(engine);
+ server.setPort(portCounter++);
+ servers.add(server);
+ }
+ return new MultiCommunicationChannelServer(servers);
+ }else {
+ throw new Exception("Must set server factories!");
+ }
+ }catch (Exception e) {
+ return null;
+ }
+ }
+
+ public int getPort() {
+ return this.port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void setWorkflowEngineFactory(
+ WorkflowEngineFactory workflowEngineFactory) {
+ this.workflowEngineFactory = workflowEngineFactory;
+ }
+
+ public void setServerFactories(List<CommunicationChannelServerFactory> serverFactories) {
+ this.serverFactories = serverFactories;
+ }
+
+ public List<CommunicationChannelServerFactory> getServerFactories() {
+ return this.serverFactories;
+ }
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/rmi/RmiCommunicationChannelClient.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/rmi/RmiCommunicationChannelClient.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/rmi/RmiCommunicationChannelClient.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/rmi/RmiCommunicationChannelClient.java Thu Dec 23 02:47:16 2010
@@ -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.server.channel.rmi;
+
+//JDK imports
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.rmi.Naming;
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.page.PageInfo;
+import org.apache.oodt.cas.catalog.query.QueryExpression;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.event.WorkflowEngineEvent;
+import org.apache.oodt.cas.workflow.instance.repo.WorkflowInstanceRepository;
+import org.apache.oodt.cas.workflow.model.WorkflowGraph;
+import org.apache.oodt.cas.workflow.model.WorkflowModel;
+import org.apache.oodt.cas.workflow.page.PageFilter;
+import org.apache.oodt.cas.workflow.page.QueryPage;
+import org.apache.oodt.cas.workflow.page.QueuePage;
+import org.apache.oodt.cas.workflow.page.RunnablesPage;
+import org.apache.oodt.cas.workflow.priority.Priority;
+import org.apache.oodt.cas.workflow.processor.ProcessorInfo;
+import org.apache.oodt.cas.workflow.processor.ProcessorSkeleton;
+import org.apache.oodt.cas.workflow.processor.ProcessorStub;
+import org.apache.oodt.cas.workflow.server.channel.AbstractCommunicationChannelClient;
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ *
+ * @author bfoster
+ *
+ */
+public class RmiCommunicationChannelClient extends
+ AbstractCommunicationChannelClient {
+
+ private URL url;
+ private String name;
+
+ public RmiCommunicationChannelClient(URL url, String name) throws MalformedURLException, RemoteException, NotBoundException {
+ this.url = url;
+ this.name = name;
+ }
+
+ public void shutdown() throws Exception {
+ this.getRmiServer().rmi_shutdown();
+ }
+
+ public void pauseRunner() throws Exception {
+ this.getRmiServer().rmi_pauseRunner();
+ }
+
+ public void resumeRunner() throws Exception {
+ this.getRmiServer().rmi_resumeRunner();
+ }
+
+ public Date getLaunchDate() throws Exception {
+ return this.serializer.deserializeObject(Date.class, this.getRmiServer().rmi_getLaunchDate());
+ }
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata) throws Exception {
+ return this.getRmiServer().rmi_startWorkflow_WithModel(this.serializer.serializeObject(workflow), this.serializer.serializeObject(metadata));
+ }
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata, Priority priority) throws Exception {
+ return this.getRmiServer().rmi_startWorkflow_WithModel(this.serializer.serializeObject(workflow), this.serializer.serializeObject(metadata), this.serializer.serializeObject(priority));
+ }
+
+ public String startWorkflow(String modelId, Metadata inputMetadata) throws Exception {
+ return this.getRmiServer().rmi_startWorkflow_WithModelId(modelId, this.serializer.serializeObject(inputMetadata));
+ }
+
+ public String startWorkflow(String modelId, Metadata inputMetadata, Priority priority) throws Exception {
+ return this.getRmiServer().rmi_startWorkflow_WithModelId(modelId, this.serializer.serializeObject(inputMetadata), this.serializer.serializeObject(priority));
+ }
+
+ public void deleteWorkflow(String instanceId) throws Exception {
+ this.getRmiServer().rmi_deleteWorkflow(instanceId);
+ }
+
+ public void stopWorkflow(String instanceId) throws Exception {
+ this.getRmiServer().rmi_stopWorkflow(instanceId);
+ }
+
+ public void pauseWorkflow(String instanceId) throws Exception {
+ this.getRmiServer().rmi_pauseWorkflow(instanceId);
+ }
+
+ public void resumeWorkflow(String instanceId) throws Exception {
+ this.getRmiServer().rmi_resumeWorkflow(instanceId);
+ }
+
+ public WorkflowModel getModel(String modelId) throws Exception {
+ return this.serializer.deserializeObject(WorkflowModel.class, this.getRmiServer().rmi_getModel(modelId));
+ }
+
+ public WorkflowGraph getWorkflowGraph(String modelId) throws Exception {
+ return this.serializer.deserializeObject(WorkflowGraph.class, this.getRmiServer().rmi_getWorkflowGraph(modelId));
+ }
+
+ public Set<String> getSupportedProcessorIds() throws Exception {
+ return (Set<String>) this.serializer.deserializeObject(Set.class, this.getRmiServer().rmi_getSupportedProcessorIds());
+ }
+
+ public List<WorkflowModel> getModels() throws Exception {
+ return (List<WorkflowModel>) this.serializer.deserializeObject(List.class, this.getRmiServer().rmi_getModels());
+ }
+
+ public List<WorkflowGraph> getWorkflowGraphs() throws Exception {
+ return (List<WorkflowGraph>) this.serializer.deserializeObject(List.class, this.getRmiServer().rmi_getWorkflowGraphs());
+ }
+
+ public ProcessorInfo getProcessorInfo(String instanceId, String modelId) throws Exception {
+ return this.serializer.deserializeObject(ProcessorInfo.class, this.getRmiServer().rmi_getProcessorInfo(instanceId, modelId));
+ }
+
+ public WorkflowInstanceRepository getInstanceRepository() throws Exception {
+ return this.serializer.deserializeObject(WorkflowInstanceRepository.class, this.getRmiServer().rmi_getInstanceRepository());
+ }
+
+ public void updateWorkflowMetadata(String instanceId, String modelId, Metadata metadata) throws Exception {
+ this.getRmiServer().rmi_updateWorkflowMetadata(instanceId, modelId, this.serializer.serializeObject(metadata));
+ }
+
+ public void updateInstanceMetadata(String jobId, Metadata metadata) throws Exception {
+ this.getRmiServer().rmi_updateInstanceMetadata(jobId, this.serializer.serializeObject(metadata));
+ }
+
+ public void updateWorkflowAndInstance(String instanceId, String modelId, WorkflowState state, Metadata metadata, String jobId, Metadata instanceMetadata) throws Exception {
+ this.getRmiServer().rmi_updateWorkflowAndInstance(instanceId, modelId, this.serializer.serializeObject(state), this.serializer.serializeObject(metadata), jobId, this.serializer.serializeObject(instanceMetadata));
+ }
+
+ public void setWorkflowState(String instanceId, String modelId, WorkflowState state) throws Exception {
+ this.getRmiServer().rmi_setWorkflowState(instanceId, modelId, this.serializer.serializeObject(state));
+ }
+
+ public void setWorkflowPriority(String instanceId, String modelId, Priority priority) throws Exception {
+ this.getRmiServer().rmi_setWorkflowPriority(instanceId, modelId, this.serializer.serializeObject(priority));
+ }
+
+ public Metadata getWorkflowMetadata(String instanceId, String modelId) throws Exception {
+ return this.serializer.deserializeObject(Metadata.class, this.getRmiServer().rmi_getWorkflowMetadata(instanceId, modelId));
+ }
+
+ public Metadata getInstanceMetadata(String jobId) throws Exception {
+ return this.serializer.deserializeObject(Metadata.class, this.getRmiServer().rmi_getInstanceMetadata(jobId));
+ }
+
+ public void registerEvent(WorkflowEngineEvent event) throws Exception {
+ this.getRmiServer().rmi_registerEvent(this.serializer.serializeObject(event));
+ }
+
+ public void triggerEvent(String eventId, Metadata inputMetadata) throws Exception {
+ this.getRmiServer().rmi_triggerEvent(eventId, this.serializer.serializeObject(inputMetadata));
+ }
+
+ public List<WorkflowEngineEvent> getRegisteredEvents() throws Exception {
+ return (List<WorkflowEngineEvent>) this.serializer.deserializeObject(List.class, this.getRmiServer().rmi_getRegisteredEvents());
+ }
+
+ public List<WorkflowState> getSupportedStates() throws Exception {
+ return (List<WorkflowState>) this.serializer.deserializeObject(List.class, this.getRmiServer().rmi_getSupportedStates());
+ }
+
+ public int getNumOfLoadedProcessors() throws Exception {
+ return this.serializer.deserializeObject(Integer.class, this.getRmiServer().rmi_getNumOfLoadedProcessors());
+ }
+
+ public int getNumOfWorkflows() throws Exception {
+ return this.serializer.deserializeObject(Integer.class, this.getRmiServer().rmi_getNumOfWorkflows());
+ }
+
+ public RunnablesPage getExecutingPage(PageInfo pageInfo) throws Exception {
+ return this.serializer.deserializeObject(RunnablesPage.class, this.getRmiServer().rmi_getExecutingPage(this.serializer.serializeObject(pageInfo)));
+ }
+
+ public RunnablesPage getRunnablesPage(PageInfo pageInfo) throws Exception {
+ return this.serializer.deserializeObject(RunnablesPage.class, this.getRmiServer().rmi_getRunnablesPage(this.serializer.serializeObject(pageInfo)));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo) throws Exception {
+ return this.serializer.deserializeObject(QueuePage.class, this.getRmiServer().rmi_getPage(this.serializer.serializeObject(pageInfo)));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, PageFilter filter) throws Exception {
+ return this.serializer.deserializeObject(QueuePage.class, this.getRmiServer().rmi_getPage_WithFilter(this.serializer.serializeObject(pageInfo), this.serializer.serializeObject(filter)));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, Comparator<ProcessorStub> comparator) throws Exception {
+ return this.serializer.deserializeObject(QueuePage.class, this.getRmiServer().rmi_getPage_WithComparator(this.serializer.serializeObject(pageInfo), this.serializer.serializeObject(comparator)));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState state) throws Exception {
+ return this.serializer.deserializeObject(QueuePage.class, this.getRmiServer().rmi_getPage_WithState(this.serializer.serializeObject(pageInfo), this.serializer.serializeObject(state)));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState.Category category) throws Exception {
+ return this.serializer.deserializeObject(QueuePage.class, this.getRmiServer().rmi_getPage_WithCategory(this.serializer.serializeObject(pageInfo), this.serializer.serializeObject(category)));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, String modelId) throws Exception {
+ return this.serializer.deserializeObject(QueuePage.class, this.getRmiServer().rmi_getPage_WithModelId(this.serializer.serializeObject(pageInfo), this.serializer.serializeObject(modelId)));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, Map<String, List<String>> keyValPairs) throws Exception {
+ return this.serializer.deserializeObject(QueuePage.class, this.getRmiServer().rmi_getPage_WithMap(this.serializer.serializeObject(pageInfo), this.serializer.serializeObject(keyValPairs)));
+ }
+
+ public QueuePage getNextPage(QueuePage page) throws Exception {
+ return this.serializer.deserializeObject(QueuePage.class, this.getRmiServer().rmi_getNextQueuePage(this.serializer.serializeObject(page)));
+ }
+
+ public ProcessorSkeleton getWorkflow(String instanceId) throws Exception {
+ return this.serializer.deserializeObject(ProcessorSkeleton.class, this.getRmiServer().rmi_getWorkflow(instanceId));
+ }
+
+ public QueryPage getNextPage(QueryPage page) throws Exception {
+ return this.serializer.deserializeObject(QueryPage.class, this.getRmiServer().rmi_getNextQueryPage(this.serializer.serializeObject(page)));
+ }
+
+ public QueryPage getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception {
+ return this.serializer.deserializeObject(QueryPage.class, this.getRmiServer().rmi_getQueryPage(this.serializer.serializeObject(pageInfo), this.serializer.serializeObject(queryExpression)));
+ }
+
+ public List<Metadata> getMetadata(QueryPage page) throws Exception {
+ return (List<Metadata>) this.serializer.deserializeObject(List.class, this.getRmiServer().rmi_getMetadata(this.serializer.serializeObject(page)));
+ }
+
+ protected RmiCommunicationChannelServerInterface getRmiServer() throws Exception {
+ return (RmiCommunicationChannelServerInterface) Naming.lookup("rmi://" + url.getHost() + ":" + url.getPort() + "/" + this.name);
+ }
+
+}
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/rmi/RmiCommunicationChannelClientFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/rmi/RmiCommunicationChannelClientFactory.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/rmi/RmiCommunicationChannelClientFactory.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/server/channel/rmi/RmiCommunicationChannelClientFactory.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.server.channel.rmi;
+
+//JDK imports
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.server.channel.CommunicationChannelClientFactory;
+
+/**
+ *
+ * @author bfoster
+ *
+ */
+public class RmiCommunicationChannelClientFactory implements
+ CommunicationChannelClientFactory {
+
+ private static final Logger LOG = Logger.getLogger(RmiCommunicationChannelClientFactory.class.getName());
+
+ private String url;
+ private String name;
+
+ public RmiCommunicationChannelClient createCommunicationChannelClient() {
+ try {
+ return new RmiCommunicationChannelClient(new URL(this.url), this.name);
+ }catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to create RMI client channel : " + e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public String getServerUrl() {
+ return url;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setServerUrl(String url) {
+ this.url = url;
+ }
+
+}