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:44:31 UTC
svn commit: r1052143 [8/11] - in /oodt/branches/wengine-branch: ./ 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/main/ja...
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,414 @@
+/*
+ * 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.xmlrpc;
+
+//JDK imports
+import java.io.IOException;
+import java.net.URL;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+//APACHE imports
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpMethodRetryHandler;
+import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.apache.xmlrpc.CommonsXmlRpcTransport;
+import org.apache.xmlrpc.XmlRpcClient;
+import org.apache.xmlrpc.XmlRpcClientException;
+import org.apache.xmlrpc.XmlRpcTransport;
+import org.apache.xmlrpc.XmlRpcTransportFactory;
+
+//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
+ * @version $Revision$
+ *
+ * <p>
+ * XML-RPC communication channel client
+ * <p>
+ */
+public class XmlRpcCommunicationChannelClient extends
+ AbstractCommunicationChannelClient {
+
+ protected XmlRpcClient client;
+ protected int chunkSize;
+
+ public XmlRpcCommunicationChannelClient(final URL serverUrl, final int connectionTimeout, final int requestTimeout, final int chunkSize, final int connectionRetries, final int connectionRetryIntervalSecs) {
+ super();
+ XmlRpcTransportFactory transportFactory = new XmlRpcTransportFactory() {
+
+ public XmlRpcTransport createTransport()
+ throws XmlRpcClientException {
+ HttpClient client = new HttpClient();
+ client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
+ new HttpMethodRetryHandler() {
+
+ public boolean retryMethod(HttpMethod method, IOException e,
+ int count) {
+ if (count < connectionRetries) {
+ try {
+ Thread.sleep(connectionRetryIntervalSecs * 1000);
+ return true;
+ }catch (Exception e1) {}
+ }
+ return false;
+ }
+
+ });
+ CommonsXmlRpcTransport transport = new CommonsXmlRpcTransport(serverUrl, client);
+ transport.setConnectionTimeout(connectionTimeout * 60 * 1000);
+ transport.setTimeout(requestTimeout * 60 * 1000);
+
+ return transport;
+ }
+
+ public void setProperty(String arg0, Object arg1) {}
+
+ };
+ this.client = new XmlRpcClient(serverUrl, transportFactory);
+ this.chunkSize = chunkSize;
+ }
+
+ public void shutdown() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_shutdown", args);
+ }
+
+ public void pauseRunner() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_pauseRunner", args);
+ }
+
+ public void resumeRunner() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_resumeRunner", args);
+ }
+
+ public Date getLaunchDate() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ return this.serializer.deserializeObject(Date.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getLaunchDate", args));
+ }
+
+ public void deleteWorkflow(String instanceId)
+ throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_deleteWorkflow", args);
+ }
+
+ public Metadata getInstanceMetadata(String jobId) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(jobId);
+ return this.serializer.deserializeObject(Metadata.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getInstanceMetadata", args));
+ }
+
+ public WorkflowInstanceRepository getInstanceRepository() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ return this.serializer.deserializeObject(WorkflowInstanceRepository.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getInstanceRepository", args));
+ }
+
+ public Set<String> getSupportedProcessorIds() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ return this.serializer.deserializeObject(Set.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getSupportedProcessorIds", args));
+ }
+
+ public WorkflowModel getModel(String modelId) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(modelId);
+ return this.serializer.deserializeObject(WorkflowModel.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getModel", args));
+ }
+
+ public List<WorkflowModel> getModels() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getModels", args));
+ }
+
+ public WorkflowGraph getWorkflowGraph(String modelId) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(modelId);
+ return this.serializer.deserializeObject(WorkflowGraph.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getWorkflowGraph", args));
+ }
+
+ public List<WorkflowGraph> getWorkflowGraphs() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getWorkflowGraphs", args));
+ }
+
+ public ProcessorInfo getProcessorInfo(String instanceId, String modelId) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ args.add(modelId);
+ return this.serializer.deserializeObject(ProcessorInfo.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getProcessorInfo", args));
+ }
+
+ public Metadata getWorkflowMetadata(String instanceId,
+ String modelId) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ args.add(modelId);
+ return this.serializer.deserializeObject(Metadata.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getWorkflowMetadata", args));
+ }
+
+ public void pauseWorkflow(String instanceId)
+ throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_pauseWorkflow", args);
+ }
+
+ public void resumeWorkflow(String instanceId)
+ throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_resumeWorkflow", args);
+ }
+
+ public void setWorkflowState(String instanceId,
+ String modelId, WorkflowState state) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ args.add(modelId);
+ args.add(this.serializer.serializeObject(state));
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setWorkflowState", args);
+ }
+
+ public void setWorkflowPriority(String instanceId,
+ String modelId, Priority priority) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ args.add(modelId);
+ args.add(this.serializer.serializeObject(priority));
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_setWorkflowPriority", args);
+ }
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata)
+ throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(workflow));
+ args.add(this.serializer.serializeObject(metadata));
+ return (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_startWorkflow", args);
+ }
+
+ public String startWorkflow(WorkflowGraph workflow, Metadata metadata, Priority priority) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(workflow));
+ args.add(this.serializer.serializeObject(metadata));
+ args.add(this.serializer.serializeObject(priority));
+ return (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_startWorkflow", args);
+ }
+
+ public String startWorkflow(String modelId, Metadata inputMetadata)
+ throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(modelId);
+ args.add(this.serializer.serializeObject(inputMetadata));
+ return (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_startWorkflow2", args);
+ }
+
+ public String startWorkflow(String modelId, Metadata inputMetadata, Priority priority) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(modelId);
+ args.add(this.serializer.serializeObject(inputMetadata));
+ args.add(this.serializer.serializeObject(priority));
+ return (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_startWorkflow2", args);
+ }
+
+ public void stopWorkflow(String instanceId)
+ throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_stopWorkflow", args);
+ }
+
+ public void updateInstanceMetadata(String jobId, Metadata metadata)
+ throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(jobId);
+ args.add(this.serializer.serializeObject(metadata));
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_updateInstanceMetadata", args);
+ }
+
+ public void updateWorkflowMetadata(String instanceId,
+ String modelId, Metadata metadata) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ args.add(modelId);
+ args.add(this.serializer.serializeObject(metadata));
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_updateWorkflowMetadata", args);
+ }
+
+ public void updateWorkflowAndInstance(String instanceId,
+ String modelId, WorkflowState state, Metadata metadata, String jobId, Metadata instanceMetadata) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ args.add(modelId);
+ args.add(this.serializer.serializeObject(state));
+ args.add(this.serializer.serializeObject(metadata));
+ args.add(jobId);
+ args.add(this.serializer.serializeObject(instanceMetadata));
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_updateWorkflowAndInstance", args);
+ }
+
+ public void registerEvent(WorkflowEngineEvent event) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(event));
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_registerEvent", args);
+ }
+
+ public void triggerEvent(String eventId, Metadata inputMetadata) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(eventId);
+ args.add(this.serializer.serializeObject(inputMetadata));
+ this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_triggerEvent", args);
+ }
+
+ public List<WorkflowEngineEvent> getRegisteredEvents() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getRegisteredEvents", args));
+ }
+
+ public List<WorkflowState> getSupportedStates() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getSupportedStates", args));
+ }
+
+ public int getNumOfLoadedProcessors() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ return this.serializer.deserializeObject(Integer.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNumOfLoadedProcessors", args));
+ }
+
+ public int getNumOfWorkflows() throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ return this.serializer.deserializeObject(Integer.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNumOfWorkflows", args));
+ }
+
+ public RunnablesPage getExecutingPage(PageInfo pageInfo) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ return this.serializer.deserializeObject(RunnablesPage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getExecutingPage", args));
+ }
+
+ public RunnablesPage getRunnablesPage(PageInfo pageInfo) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ return this.serializer.deserializeObject(RunnablesPage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getRunnablesPage", args));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ return this.serializer.deserializeObject(QueuePage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage", args));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, PageFilter filter) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ args.add(this.serializer.serializeObject(filter));
+ return this.serializer.deserializeObject(QueuePage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage_filtered", args));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, Comparator<ProcessorStub> comparator) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ args.add(this.serializer.serializeObject(comparator));
+ return this.serializer.deserializeObject(QueuePage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage2", args));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState state) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ args.add(this.serializer.serializeObject(state));
+ return this.serializer.deserializeObject(QueuePage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage3", args));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, WorkflowState.Category category) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ args.add(this.serializer.serializeObject(category));
+ return this.serializer.deserializeObject(QueuePage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage4", args));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, String modelId) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ args.add(modelId);
+ return this.serializer.deserializeObject(QueuePage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage5", args));
+ }
+
+ public QueuePage getPage(PageInfo pageInfo, Map<String, List<String>> keyValPairs) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ args.add(this.serializer.serializeObject(keyValPairs));
+ return this.serializer.deserializeObject(QueuePage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage7", args));
+ }
+
+ public QueuePage getNextPage(QueuePage page) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(page));
+ return this.serializer.deserializeObject(QueuePage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage", args));
+ }
+
+ public ProcessorSkeleton getWorkflow(String instanceId) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(instanceId);
+ return this.serializer.deserializeObject(ProcessorSkeleton.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getWorkflow", args));
+ }
+
+ public List<Metadata> getMetadata(QueryPage page) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(page));
+ return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadata", args));
+ }
+
+ public QueryPage getNextPage(QueryPage page) throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(page));
+ return this.serializer.deserializeObject(QueryPage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage2", args));
+ }
+
+ public QueryPage getPage(PageInfo pageInfo, QueryExpression queryExpression)
+ throws Exception {
+ Vector<Object> args = new Vector<Object>();
+ args.add(this.serializer.serializeObject(pageInfo));
+ args.add(this.serializer.serializeObject(queryExpression));
+ return this.serializer.deserializeObject(QueryPage.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage6", args));
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,100 @@
+/*
+ * 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.xmlrpc;
+
+//JDK imports
+import java.net.URL;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.server.channel.CommunicationChannelClientFactory;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Factory for creating XML-RPC communication channel client
+ * <p>
+ */
+public class XmlRpcCommunicationChannelClientFactory implements
+ CommunicationChannelClientFactory {
+
+ private String serverUrl = "http://localhost:9000";
+ private int connectionTimeout = 60;
+ private int requestTimeout = 90;
+ private int chunkSize = 1024;
+ private int connectionRetries = 3;
+ private int connectionRetryIntervalSecs = 0;
+
+ public XmlRpcCommunicationChannelClient createCommunicationChannelClient() {
+ try {
+ return new XmlRpcCommunicationChannelClient(new URL(this.serverUrl), this.connectionTimeout, this.requestTimeout, this.chunkSize, this.connectionRetries, this.connectionRetryIntervalSecs);
+ }catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public String getServerUrl() {
+ return this.serverUrl;
+ }
+
+ public void setServerUrl(String serverUrl) {
+ this.serverUrl = serverUrl;
+ }
+
+ public int getConnectionTimeout() {
+ return connectionTimeout;
+ }
+
+ public void setConnectionTimeout(int connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ public int getRequestTimeout() {
+ return requestTimeout;
+ }
+
+ public void setRequestTimeout(int requestTimeout) {
+ this.requestTimeout = requestTimeout;
+ }
+
+ public int getChunkSize() {
+ return chunkSize;
+ }
+
+ public void setChunkSize(int chunkSize) {
+ this.chunkSize = chunkSize;
+ }
+
+ public int getConnectionRetries() {
+ return connectionRetries;
+ }
+
+ public void setConnectionRetries(int connectionRetries) {
+ this.connectionRetries = connectionRetries;
+ }
+
+ public int getConnectionRetryIntervalSecs() {
+ return connectionRetryIntervalSecs;
+ }
+
+ public void setConnectionRetryIntervalSecs(int connectionRetryIntervalSecs) {
+ this.connectionRetryIntervalSecs = connectionRetryIntervalSecs;
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,263 @@
+/*
+ * 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.xmlrpc;
+
+//JDK imports
+import java.util.Comparator;
+import java.util.Map;
+
+//APACHE imports
+import org.apache.xmlrpc.WebServer;
+
+//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.model.WorkflowGraph;
+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.priority.Priority;
+import org.apache.oodt.cas.workflow.server.channel.AbstractCommunicationChannelServer;
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * XML-RPC communication channel server
+ * <p>
+ */
+public class XmlRpcCommunicationChannelServer extends
+ AbstractCommunicationChannelServer implements XmlRpcCommunicationServerInterface {
+
+ private WebServer webServer;
+
+ public XmlRpcCommunicationChannelServer() {
+ super();
+ }
+
+ public void startup() throws Exception {
+ this.webServer = new WebServer(this.port);
+ this.webServer.addHandler(this.getClass().getSimpleName(), this);
+ this.webServer.start();
+ }
+
+ public boolean xmlrpc_shutdown() throws Exception {
+ this.shutdown();
+ this.webServer.shutdown();
+ this.webServer = null;
+ return true;
+ }
+
+ public boolean xmlrpc_pauseRunner() throws Exception {
+ this.pauseRunner();
+ return true;
+ }
+
+ public boolean xmlrpc_resumeRunner() throws Exception {
+ this.resumeRunner();
+ return true;
+ }
+
+ public String xmlrpc_getLaunchDate() throws Exception {
+ return this.serializer.serializeObject(this.getLaunchDate());
+ }
+
+ public String xmlrpc_deleteWorkflow(String instanceId) throws Exception {
+ this.deleteWorkflow(instanceId);
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_getInstanceMetadata(String jobId) throws Exception {
+ return this.serializer.serializeObject(this.getInstanceMetadata(jobId));
+ }
+
+ public String xmlrpc_getInstanceRepository() throws Exception {
+ return this.serializer.serializeObject(this.getInstanceRepository());
+ }
+
+ public String xmlrpc_getModel(String modelId) throws Exception {
+ return this.serializer.serializeObject(this.getModel(modelId));
+ }
+
+ public String xmlrpc_getModels() throws Exception {
+ return this.serializer.serializeObject(this.getModels());
+ }
+
+ public String xmlrpc_getWorkflowGraph(String modelId) throws Exception {
+ return this.serializer.serializeObject(this.getWorkflowGraph(modelId));
+ }
+
+ public String xmlrpc_getWorkflowGraphs() throws Exception {
+ return this.serializer.serializeObject(this.getWorkflowGraphs());
+ }
+
+ public String xmlrpc_getSupportedProcessorIds() throws Exception {
+ return this.serializer.serializeObject(this.xmlrpc_getSupportedProcessorIds());
+ }
+
+ public String xmlrpc_getProcessorInfo(String instanceId, String modelId) throws Exception {
+ return this.serializer.serializeObject(this.getProcessorInfo(instanceId, modelId));
+ }
+
+ public String xmlrpc_getWorkflowMetadata(String instanceId, String modelId) throws Exception {
+ return this.serializer.serializeObject(this.getWorkflowMetadata(instanceId, modelId));
+ }
+
+ public String xmlrpc_pauseWorkflow(String instanceId) throws Exception {
+ this.pauseWorkflow(instanceId);
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_resumeWorkflow(String instanceId) throws Exception {
+ this.resumeWorkflow(instanceId);
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_setWorkflowState(String instanceId, String modelId, String state) throws Exception {
+ this.setWorkflowState(instanceId, modelId, this.serializer.deserializeObject(WorkflowState.class, state));
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_setWorkflowPriority(String instanceId, String modelId, String priority) throws Exception {
+ this.setWorkflowPriority(instanceId, modelId, this.serializer.deserializeObject(Priority.class, priority));
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_startWorkflow(String workflow, String metadata) throws Exception {
+ return this.startWorkflow(this.serializer.deserializeObject(WorkflowGraph.class, workflow), this.serializer.deserializeObject(Metadata.class, metadata));
+ }
+
+ public String xmlrpc_startWorkflow(String workflow, String metadata, String priority) throws Exception {
+ return this.startWorkflow(this.serializer.deserializeObject(WorkflowGraph.class, workflow), this.serializer.deserializeObject(Metadata.class, metadata), this.serializer.deserializeObject(Priority.class, priority));
+ }
+
+ public String xmlrpc_startWorkflow2(String modelId, String inputMetadata) throws Exception {
+ return this.startWorkflow(modelId, this.serializer.deserializeObject(Metadata.class, inputMetadata));
+ }
+
+ public String xmlrpc_startWorkflow2(String modelId, String inputMetadata, String priority) throws Exception {
+ return this.startWorkflow(modelId, this.serializer.deserializeObject(Metadata.class, inputMetadata), this.serializer.deserializeObject(Priority.class, priority));
+ }
+
+ public String xmlrpc_stopWorkflow(String instanceId) throws Exception {
+ this.stopWorkflow(instanceId);
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_updateInstanceMetadata(String jobId, String metadata) throws Exception {
+ this.updateInstanceMetadata(jobId, this.serializer.deserializeObject(Metadata.class, metadata));
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_updateWorkflowMetadata(String instanceId, String modelId, String metadata) throws Exception {
+ this.updateWorkflowMetadata(instanceId, modelId, this.serializer.deserializeObject(Metadata.class, metadata));
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_updateWorkflowAndInstance(String instanceId, String modelId, String state, String metadata, String jobId, String instanceMetadata) throws Exception {
+ this.updateWorkflowAndInstance(instanceId, modelId, this.serializer.deserializeObject(WorkflowState.class, state), this.serializer.deserializeObject(Metadata.class, metadata), jobId, this.serializer.deserializeObject(Metadata.class, instanceMetadata));
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_registerEvent(String event) throws Exception {
+ this.registerEvent(this.serializer.deserializeObject(WorkflowEngineEvent.class, event));
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_triggerEvent(String eventId, String inputMetadata) throws Exception {
+ this.triggerEvent(eventId, this.serializer.deserializeObject(Metadata.class, inputMetadata));
+ return this.serializer.serializeObject(Boolean.TRUE);
+ }
+
+ public String xmlrpc_getRegisteredEvents() throws Exception {
+ return this.serializer.serializeObject(this.getRegisteredEvents());
+ }
+
+ public String xmlrpc_getSupportedStates() throws Exception {
+ return this.serializer.serializeObject(this.getSupportedStates());
+ }
+
+ public String xmlrpc_getNumOfLoadedProcessors() throws Exception {
+ return this.serializer.serializeObject(Integer.valueOf(this.getNumOfLoadedProcessors()));
+ }
+
+ public String xmlrpc_getNumOfWorkflows() throws Exception {
+ return this.serializer.serializeObject(Integer.valueOf(this.getNumOfWorkflows()));
+ }
+
+ public String xmlrpc_getExecutingPage(String pageInfo) throws Exception {
+ return this.serializer.serializeObject(this.getExecutingPage(this.serializer.deserializeObject(PageInfo.class, pageInfo)));
+ }
+
+ public String xmlrpc_getRunnablesPage(String pageInfo) throws Exception {
+ return this.serializer.serializeObject(this.getRunnablesPage(this.serializer.deserializeObject(PageInfo.class, pageInfo)));
+ }
+
+ public String xmlrpc_getPage(String pageInfo) throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfo)));
+ }
+
+ public String xmlrpc_getPage_filtered(String pageInfo, String pageFilter) throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfo), this.serializer.deserializeObject(PageFilter.class, pageFilter)));
+ }
+
+ public String xmlrpc_getPage2(String pageInfo, String comparator) throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfo), this.serializer.deserializeObject(Comparator.class, comparator)));
+ }
+
+ public String xmlrpc_getPage3(String pageInfo, String state) throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfo), this.serializer.deserializeObject(WorkflowState.class, state)));
+ }
+
+ public String xmlrpc_getPage4(String pageInfo, String category) throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfo), this.serializer.deserializeObject(WorkflowState.Category.class, category)));
+ }
+
+ public String xmlrpc_getPage5(String pageInfo, String modelId) throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfo), modelId));
+ }
+
+ public String xmlrpc_getPage7(String pageInfo, String keyValPairs) throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfo), this.serializer.deserializeObject(Map.class, keyValPairs)));
+ }
+
+ public String xmlrpc_getNextPage(String page) throws Exception {
+ return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(QueuePage.class, page)));
+ }
+
+ public String xmlrpc_getWorkflow(String instanceId) throws Exception {
+ return this.serializer.serializeObject(this.getWorkflow(instanceId));
+ }
+
+ public String xmlrpc_getMetadata(String page) throws Exception {
+ return this.serializer.serializeObject(this.getMetadata(this.serializer.deserializeObject(QueryPage.class, page)));
+ }
+
+ public String xmlrpc_getNextPage2(String page) throws Exception {
+ return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(QueryPage.class, page)));
+ }
+
+ public String xmlrpc_getPage6(String pageInfo, String queryExpression)
+ throws Exception {
+ return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfo), this.serializer.deserializeObject(QueryExpression.class, queryExpression)));
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.xmlrpc;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.WorkflowEngineFactory;
+import org.apache.oodt.cas.workflow.server.channel.CommunicationChannelServerFactory;
+
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Factory for creating XML-RPC communication channel server
+ * <p>
+ */
+public class XmlRpcCommunicationChannelServerFactory implements
+ CommunicationChannelServerFactory {
+
+ private int port;
+ private WorkflowEngineFactory workflowEngineFactory;
+
+ public XmlRpcCommunicationChannelServer createCommunicationChannelServer() {
+ XmlRpcCommunicationChannelServer xmlrpcServer = new XmlRpcCommunicationChannelServer();
+ xmlrpcServer.setPort(this.port);
+ xmlrpcServer.setWorkflowEngine(this.workflowEngineFactory.createEngine());
+ return xmlrpcServer;
+ }
+
+ public int getPort() {
+ return this.port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void setWorkflowEngineFactory(WorkflowEngineFactory workflowEngineFactory) {
+ this.workflowEngineFactory = workflowEngineFactory;
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationServerInterface.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationServerInterface.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationServerInterface.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/channel/xmlrpc/XmlRpcCommunicationServerInterface.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,115 @@
+/*
+ * 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.xmlrpc;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * XML-RPC communication channel server interface
+ * <p>
+ */
+public interface XmlRpcCommunicationServerInterface {
+
+ public boolean xmlrpc_shutdown() throws Exception;
+
+ public boolean xmlrpc_pauseRunner() throws Exception;
+
+ public boolean xmlrpc_resumeRunner() throws Exception;
+
+ public String xmlrpc_getLaunchDate() throws Exception;
+
+ public String xmlrpc_deleteWorkflow(String instanceId) throws Exception;
+
+ public String xmlrpc_getInstanceMetadata(String jobId) throws Exception;
+
+ public String xmlrpc_getInstanceRepository() throws Exception;
+
+ public String xmlrpc_getModel(String modelId) throws Exception;
+
+ public String xmlrpc_getModels() throws Exception;
+
+ public String xmlrpc_getWorkflowGraph(String modelId) throws Exception;
+
+ public String xmlrpc_getWorkflowGraphs() throws Exception;
+
+ public String xmlrpc_getProcessorInfo(String instanceId, String modelId) throws Exception;
+
+ public String xmlrpc_getWorkflowMetadata(String instanceId, String modelId) throws Exception;
+
+ public String xmlrpc_pauseWorkflow(String instanceId) throws Exception;
+
+ public String xmlrpc_resumeWorkflow(String instanceId) throws Exception;
+
+ public String xmlrpc_setWorkflowState(String instanceId, String modelId, String state) throws Exception;
+
+ public String xmlrpc_setWorkflowPriority(String instanceId, String modelId, String priority) throws Exception;
+
+ public String xmlrpc_startWorkflow(String workflow, String metadata) throws Exception;
+
+ public String xmlrpc_startWorkflow(String workflow, String metadata, String priority) throws Exception;
+
+ public String xmlrpc_startWorkflow2(String modelId, String inputMetadata) throws Exception;
+
+ public String xmlrpc_startWorkflow2(String modelId, String inputMetadata, String priority) throws Exception;
+
+ public String xmlrpc_stopWorkflow(String instanceId) throws Exception;
+
+ public String xmlrpc_updateInstanceMetadata(String jobId, String metadata) throws Exception;
+
+ public String xmlrpc_updateWorkflowMetadata(String instanceId, String modelId, String metadata) throws Exception;
+
+ public String xmlrpc_registerEvent(String event) throws Exception;
+
+ public String xmlrpc_triggerEvent(String eventId, String inputMetadata) throws Exception;
+
+ public String xmlrpc_getRegisteredEvents() throws Exception;
+
+ public String xmlrpc_getSupportedStates() throws Exception;
+
+ public String xmlrpc_getNumOfLoadedProcessors() throws Exception;
+
+ public String xmlrpc_getNumOfWorkflows() throws Exception;
+
+ public String xmlrpc_getExecutingPage(String pageInfo) throws Exception;
+
+ public String xmlrpc_getRunnablesPage(String pageInfo) throws Exception;
+
+ public String xmlrpc_getPage(String pageInfo) throws Exception;
+
+ public String xmlrpc_getPage2(String pageInfo, String comparator) throws Exception;
+
+ public String xmlrpc_getPage3(String pageInfo, String state) throws Exception;
+
+ public String xmlrpc_getPage4(String pageInfo, String category) throws Exception;
+
+ public String xmlrpc_getPage5(String pageInfo, String modelId) throws Exception;
+
+ public String xmlrpc_getPage7(String pageInfo, String keyValPairs) throws Exception;
+
+ public String xmlrpc_getNextPage(String page) throws Exception;
+
+ public String xmlrpc_getWorkflow(String instanceId) throws Exception;
+
+ public String xmlrpc_getNextPage2(String page) throws Exception;
+
+ public String xmlrpc_getPage6(String pageInfo, String queryExpression) throws Exception;
+
+ public String xmlrpc_getMetadata(String page) throws Exception;
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedActionsHandler.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedActionsHandler.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedActionsHandler.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedActionsHandler.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,76 @@
+/*
+ * 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.option;
+
+//JDK imports
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Map;
+
+//Spring imports
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.server.action.WorkflowEngineServerAction;
+import org.apache.oodt.cas.workflow.util.Serializer;
+import org.apache.oodt.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.handler.CmdLineOptionHandler;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Command line handler for printing out support actions
+ * <p>
+ */
+public class PrintSupportedActionsHandler extends CmdLineOptionHandler {
+
+ protected String beanRepo;
+
+ @Override
+ public String getCustomOptionUsage(CmdLineOption option) {
+ return "";
+ }
+
+ @Override
+ public void handleOption(CmdLineOption option, List<String> values) {
+ FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
+ appContext.setClassLoader(new Serializer().getClassLoader());
+ appContext.refresh();
+ PrintStream ps = new PrintStream(System.out);
+ ps.println("Actions:");
+ for (WorkflowEngineServerAction action : ((Map<String, WorkflowEngineServerAction>) appContext.getBeansOfType(WorkflowEngineServerAction.class)).values()) {
+ ps.println(" Action:");
+ ps.println(" Id: " + action.getId());
+ ps.println(" Description: " + action.getDescription());
+ ps.println();
+ }
+ ps.close();
+ }
+
+ public void setBeanRepo(String beanRepo) {
+ this.beanRepo = beanRepo;
+ }
+
+ @Override
+ public boolean affectsOption(CmdLineOptionInstance arg0) {
+ return false;
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedClientsHandler.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedClientsHandler.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedClientsHandler.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedClientsHandler.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,76 @@
+/*
+ * 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.option;
+
+//JDK imports
+import java.io.PrintStream;
+import java.util.List;
+
+//Spring imports
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.WorkflowEngineClientFactory;
+import org.apache.oodt.cas.workflow.util.Serializer;
+import org.apache.oodt.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.handler.CmdLineOptionHandler;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Command line handler for printing out support clients
+ * <p>
+ */
+public class PrintSupportedClientsHandler extends CmdLineOptionHandler {
+
+ protected String beanRepo;
+
+ @Override
+ public String getCustomOptionUsage(CmdLineOption option) {
+ return "";
+ }
+
+ @Override
+ public void handleOption(CmdLineOption option, List<String> values) {
+ FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
+ appContext.setClassLoader(new Serializer().getClassLoader());
+ appContext.refresh();
+ PrintStream ps = new PrintStream(System.out);
+ ps.println("ClientFactories:");
+ for (String clientId : appContext.getBeanNamesForType(WorkflowEngineClientFactory.class)) {
+ WorkflowEngineClientFactory clientFactory = (WorkflowEngineClientFactory) appContext.getBean(clientId, WorkflowEngineClientFactory.class);
+ ps.println(" ClientFactory:");
+ ps.println(" Id: " + clientId);
+ ps.println(" URL: " + clientFactory.getServerUrl());
+ ps.println();
+ }
+ ps.close();
+ }
+
+ public void setBeanRepo(String beanRepo) {
+ this.beanRepo = beanRepo;
+ }
+
+ @Override
+ public boolean affectsOption(CmdLineOptionInstance arg0) {
+ return false;
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedServersHandler.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedServersHandler.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedServersHandler.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/server/option/PrintSupportedServersHandler.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,76 @@
+/*
+ * 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.option;
+
+//JDK imports
+import java.io.PrintStream;
+import java.util.List;
+
+//Spring imports
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.server.channel.CommunicationChannelServerFactory;
+import org.apache.oodt.cas.workflow.util.Serializer;
+import org.apache.oodt.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.handler.CmdLineOptionHandler;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Command line handler for printing out support servers
+ * <p>
+ */
+public class PrintSupportedServersHandler extends CmdLineOptionHandler {
+
+ protected String beanRepo;
+
+ @Override
+ public String getCustomOptionUsage(CmdLineOption option) {
+ return "";
+ }
+
+ @Override
+ public void handleOption(CmdLineOption option, List<String> values) {
+ FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
+ appContext.setClassLoader(new Serializer().getClassLoader());
+ appContext.refresh();
+ PrintStream ps = new PrintStream(System.out);
+ ps.println("ServerFactories:");
+ for (String serverId : appContext.getBeanNamesForType(CommunicationChannelServerFactory.class)) {
+ CommunicationChannelServerFactory serverFactory = (CommunicationChannelServerFactory) appContext.getBean(serverId, CommunicationChannelServerFactory.class);
+ ps.println(" ServerFactory:");
+ ps.println(" Id: " + serverId);
+ ps.println(" Port: " + serverFactory.getPort());
+ ps.println();
+ }
+ ps.close();
+ }
+
+ public void setBeanRepo(String beanRepo) {
+ this.beanRepo = beanRepo;
+ }
+
+ @Override
+ public boolean affectsOption(CmdLineOptionInstance arg0) {
+ return false;
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/RevertableWorkflowState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/RevertableWorkflowState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/RevertableWorkflowState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/RevertableWorkflowState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,55 @@
+/*
+ * 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.state;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * WorkflowState which stores previous state
+ * <p>
+ */
+public abstract class RevertableWorkflowState extends WorkflowState {
+
+ private WorkflowState prevState;
+ private String name;
+
+ public RevertableWorkflowState(String name, String message) {
+ super(message);
+ this.name = name;
+ }
+
+ public void setPrevState(WorkflowState prevState) {
+ this.prevState = prevState;
+ }
+
+ public WorkflowState getPrevState() {
+ return this.prevState;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof RevertableWorkflowState && ((RevertableWorkflowState) obj).getClass().equals(this.getClass()))
+ return (((RevertableWorkflowState) obj).prevState == null) || (this.prevState != null && this.prevState.equals(((RevertableWorkflowState) obj).prevState));
+ return false;
+ }
+
+ public String getName() {
+ return this.name + (this.prevState != null ? "(" + this.prevState.getName() + ")" : "");
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/StateUtils.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/StateUtils.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/StateUtils.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/StateUtils.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,144 @@
+/*
+ * 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.state;
+
+//JDK imports
+import java.util.List;
+import java.util.Stack;
+import java.util.Vector;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.processor.TaskProcessor;
+import org.apache.oodt.cas.workflow.processor.WorkflowProcessor;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Utilities for working with WorkflowState
+ * <p>
+ */
+public class StateUtils {
+
+ private StateUtils() {}
+
+ public static boolean allOfGivenState(List<WorkflowProcessor> workflowProcessors, Class<? extends WorkflowState> stateClass) {
+ for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ if (stateClass.isAssignableFrom(workflowProcessor.getState().getClass()))
+ return false;
+ return true;
+ }
+
+ public static boolean containsGivenState(List<WorkflowProcessor> workflowProcessors, Class<? extends WorkflowState> stateClass) {
+ for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ if (stateClass.isAssignableFrom(workflowProcessor.getState().getClass()))
+ return true;
+ return false;
+ }
+
+ public static boolean allOfGivenCategory(List<WorkflowProcessor> workflowProcessors, WorkflowState.Category category) {
+ for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ if (!workflowProcessor.getState().getCategory().equals(category))
+ return false;
+ return true;
+ }
+
+ public static boolean containsTaskInGivenCategory(WorkflowProcessor workflowProcessor, WorkflowState.Category category) {
+ Stack<WorkflowProcessor> stack = new Stack<WorkflowProcessor>();
+ stack.add(workflowProcessor);
+ while (!stack.empty()) {
+ WorkflowProcessor wp = stack.pop();
+ if (wp instanceof TaskProcessor && wp.getState().getCategory().equals(category))
+ return true;
+ stack.addAll(wp.getSubProcessors());
+ }
+ return false;
+ }
+
+ public static boolean constainsGivenCategory(List<WorkflowProcessor> workflowProcessors, WorkflowState.Category category) {
+ for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ if (workflowProcessor.getState().getCategory().equals(category))
+ return true;
+ return false;
+ }
+
+ public static List<WorkflowProcessor> getWorkflowProcessorsOfGivenState(List<WorkflowProcessor> workflowProcessors, Class<? extends WorkflowState> stateClass) {
+ List<WorkflowProcessor> returnProcessors = new Vector<WorkflowProcessor>();
+ for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ if (stateClass.isAssignableFrom(workflowProcessor.getState().getClass()))
+ returnProcessors.add(workflowProcessor);
+ return returnProcessors;
+ }
+
+ public static List<WorkflowProcessor> getWorkflowProcessorsOfGivenCategory(List<WorkflowProcessor> workflowProcessors, WorkflowState.Category category) {
+ List<WorkflowProcessor> returnProcessors = new Vector<WorkflowProcessor>();
+ for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ if (workflowProcessor.getState().getCategory().equals(category))
+ returnProcessors.add(workflowProcessor);
+ return returnProcessors;
+ }
+
+ public static List<WorkflowProcessor> getWorkflowProcessorsNotOfGivenState(List<WorkflowProcessor> workflowProcessors, Class<? extends WorkflowState> stateClass) {
+ List<WorkflowProcessor> returnProcessors = new Vector<WorkflowProcessor>();
+ for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ if (!stateClass.isAssignableFrom(workflowProcessor.getState().getClass()))
+ returnProcessors.add(workflowProcessor);
+ return returnProcessors;
+ }
+
+ public static List<WorkflowProcessor> getWorkflowProcessorsNotOfGivenCategory(List<WorkflowProcessor> workflowProcessors, WorkflowState.Category category) {
+ List<WorkflowProcessor> returnProcessors = new Vector<WorkflowProcessor>();
+ for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ if (!workflowProcessor.getState().getCategory().equals(category))
+ returnProcessors.add(workflowProcessor);
+ return returnProcessors;
+ }
+
+ public static WorkflowState.Category getCategoryByName(List<WorkflowState> states, String name) {
+ for (WorkflowState state : states) {
+ if (state.getCategory().toString().toLowerCase().equals(name.toLowerCase()))
+ return state.getCategory();
+ }
+ return null;
+ }
+
+ public static WorkflowState getStateByName(List<WorkflowState> states, String name) {
+ String[] splitName = name.split("[\\(\\)]{1}");
+ String revertState = null;
+ if (splitName.length == 2) {
+ name = splitName[0];
+ revertState = splitName[1];
+ }
+ WorkflowState state = _getStateByName(states, name);
+ if (state != null && state instanceof RevertableWorkflowState && revertState != null)
+ ((RevertableWorkflowState) state).setPrevState(_getStateByName(states, revertState));
+ return state;
+ }
+
+ private static WorkflowState _getStateByName(List<WorkflowState> states, String name) {
+ for (WorkflowState state : states) {
+ if (state instanceof RevertableWorkflowState) {
+ if (state.getName().toLowerCase().startsWith(name.toLowerCase()))
+ return state;
+ }else if (state.getName().toLowerCase().equals(name.toLowerCase()))
+ return state;
+ }
+ return null;
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/WorkflowState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/WorkflowState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/WorkflowState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/WorkflowState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,68 @@
+/*
+ * 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.state;
+
+//JDK imports
+import java.util.Date;
+import java.util.Vector;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * The state of a WorkflowProcessor
+ * <p>
+ */
+public abstract class WorkflowState {
+
+ protected String message;
+ protected Vector<WorkflowState> subStates;
+ protected Date startTime;
+ public enum Category { INITIAL, WAITING, RUNNING, RESULTS, TRANSITION, HOLDING, DONE }
+
+ public WorkflowState(String message) {
+ this.message = message;
+ this.startTime = new Date();
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public Date getStartTime() {
+ return this.startTime;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof WorkflowState)
+ return ((WorkflowState) obj).getName().equals(this.getName());
+ else
+ return false;
+ }
+
+ public String toString() {
+ return this.getName() + " : " + this.getMessage();
+ }
+
+ public abstract String getName();
+
+ public abstract String getDescription();
+
+ public abstract Category getCategory();
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/FailureState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/FailureState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/FailureState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/FailureState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.state.done;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Failure State
+ * <p>
+ */
+public class FailureState extends WorkflowState {
+
+ public FailureState(String message) {
+ super(message);
+ }
+
+ @Override
+ public String getName() {
+ return "Failure";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Execution Failed";
+ }
+
+ @Override
+ public Category getCategory() {
+ return Category.DONE;
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/OFFState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/OFFState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/OFFState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/OFFState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.state.done;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * OFF State
+ * <p>
+ */
+public class OFFState extends SuccessState {
+
+ public OFFState(String message) {
+ super(message);
+ }
+
+ @Override
+ public String getName() {
+ return "Off";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Turned OFF";
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/StoppedState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/StoppedState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/StoppedState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/StoppedState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.state.done;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Stopped State
+ * <p>
+ */
+public class StoppedState extends WorkflowState {
+
+ public StoppedState(String message) {
+ super(message);
+ }
+
+ @Override
+ public Category getCategory() {
+ return Category.DONE;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Force Killed";
+ }
+
+ @Override
+ public String getName() {
+ return "Stopped";
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/SuccessState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/SuccessState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/SuccessState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/done/SuccessState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.state.done;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Success State
+ * <p>
+ */
+public class SuccessState extends WorkflowState {
+
+ public SuccessState(String message) {
+ super(message);
+ }
+
+ @Override
+ public String getName() {
+ return "Success";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Successfully Completed";
+ }
+
+ @Override
+ public Category getCategory() {
+ return Category.DONE;
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/holding/PausedState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/holding/PausedState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/holding/PausedState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/holding/PausedState.java Thu Dec 23 02:44:23 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.state.holding;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.RevertableWorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Paused State
+ * <p>
+ */
+public class PausedState extends RevertableWorkflowState {
+
+ public PausedState(String message) {
+ super("Paused", message);
+ }
+
+ @Override
+ public Category getCategory() {
+ return Category.HOLDING;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Has been manually paused";
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/holding/UnknownState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/holding/UnknownState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/holding/UnknownState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/holding/UnknownState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.state.holding;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Unknown State
+ * <p>
+ */
+public class UnknownState extends WorkflowState {
+
+ public UnknownState(String message) {
+ super(message);
+ }
+
+ @Override
+ public Category getCategory() {
+ return Category.HOLDING;
+ }
+
+ @Override
+ public String getDescription() {
+ return "State is Unknown";
+ }
+
+ @Override
+ public String getName() {
+ return "Unknown";
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/initial/LoadedState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/initial/LoadedState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/initial/LoadedState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/initial/LoadedState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.state.initial;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Loaded State
+ * <p>
+ */
+public class LoadedState extends WorkflowState {
+
+ public LoadedState(String message) {
+ super(message);
+ }
+
+ @Override
+ public Category getCategory() {
+ return Category.INITIAL;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Loading Complete";
+ }
+
+ @Override
+ public String getName() {
+ return "Loaded";
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/initial/NullState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/initial/NullState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/initial/NullState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/initial/NullState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.state.initial;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * NULL State
+ * <p>
+ */
+public class NullState extends WorkflowState {
+
+ public NullState() {
+ super("I am the null value of the state world");
+ }
+
+ @Override
+ public String getName() {
+ return "Null";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Uninitialied State";
+ }
+
+ @Override
+ public Category getCategory() {
+ return Category.INITIAL;
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsBailState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsBailState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsBailState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsBailState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.state.results;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Results Bail State
+ * <p>
+ */
+public class ResultsBailState extends ResultsState {
+
+ public ResultsBailState(String message) {
+ super(message);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Notification to bail workflow";
+ }
+
+ @Override
+ public String getName() {
+ return "ResultsBail";
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsFailureState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsFailureState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsFailureState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsFailureState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.state.results;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Results Failure State
+ * <p>
+ */
+public class ResultsFailureState extends ResultsState {
+
+ public ResultsFailureState(String message) {
+ super(message);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Notification of failure";
+ }
+
+ @Override
+ public String getName() {
+ return "ResultsFailure";
+ }
+
+}
Added: oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsState.java?rev=1052143&view=auto
==============================================================================
--- oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsState.java (added)
+++ oodt/branches/wengine-branch/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsState.java Thu Dec 23 02:44:23 2010
@@ -0,0 +1,41 @@
+/*
+ * 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.state.results;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Results State return by a TaskInstance
+ * <p>
+ */
+public abstract class ResultsState extends WorkflowState {
+
+ public ResultsState(String message) {
+ super(message);
+ }
+
+ @Override
+ public Category getCategory() {
+ return Category.RESULTS;
+ }
+
+}