oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfos...@apache.org
Subject svn commit: r1052147 [9/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...
Date Thu, 23 Dec 2010 02:47:22 GMT
Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/RevertableWorkflowState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/RevertableWorkflowState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/RevertableWorkflowState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/RevertableWorkflowState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/StateUtils.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/StateUtils.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/StateUtils.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/StateUtils.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/WorkflowState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/WorkflowState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/WorkflowState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/WorkflowState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/FailureState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/FailureState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/FailureState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/FailureState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/OFFState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/OFFState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/OFFState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/OFFState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/StoppedState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/StoppedState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/StoppedState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/StoppedState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/SuccessState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/SuccessState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/SuccessState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/done/SuccessState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/holding/PausedState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/holding/PausedState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/holding/PausedState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/holding/PausedState.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.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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/holding/UnknownState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/holding/UnknownState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/holding/UnknownState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/holding/UnknownState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/initial/LoadedState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/initial/LoadedState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/initial/LoadedState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/initial/LoadedState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/initial/NullState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/initial/NullState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/initial/NullState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/initial/NullState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsBailState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsBailState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsBailState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsBailState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsFailureState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsFailureState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsFailureState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsFailureState.java Thu Dec 23 02:47:16 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/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsState.java Thu Dec 23 02:47:16 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;
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsSuccessState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsSuccessState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsSuccessState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/results/ResultsSuccessState.java Thu Dec 23 02:47:16 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 Success State
+ * <p>
+ */
+public class ResultsSuccessState extends ResultsState {
+
+	public ResultsSuccessState(String message) {
+		super(message);
+	}
+
+	@Override
+	public String getDescription() {
+		return "Notification of success";
+	}
+
+	@Override
+	public String getName() {
+		return "ResultsSuccess";
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/ExecutingState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/ExecutingState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/ExecutingState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/ExecutingState.java Thu Dec 23 02:47:16 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.running;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Executing State
+ * <p>
+ */
+public class ExecutingState extends WorkflowState {
+
+	public ExecutingState(String message) {
+		super(message);
+	}
+
+	@Override
+	public String getName() {
+		return "Executing";
+	}
+
+	@Override
+	public String getDescription() {
+		return "Current being executed";
+	}
+
+	@Override
+	public Category getCategory() {
+		return Category.RUNNING;
+	}
+	
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/PostConditionEvalState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/PostConditionEvalState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/PostConditionEvalState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/PostConditionEvalState.java Thu Dec 23 02:47:16 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.running;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * PostCondition Evalution State
+ * <p>
+ */
+public class PostConditionEvalState extends WorkflowState {
+
+	public PostConditionEvalState(String message) {
+		super(message);
+	}
+
+	@Override
+	public Category getCategory() {
+		return Category.RUNNING;
+	}
+
+	@Override
+	public String getDescription() {
+		return "Executing PostConditions";
+	}
+
+	@Override
+	public String getName() {
+		return "PostConditionEval";
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/PreConditionEvalState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/PreConditionEvalState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/PreConditionEvalState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/running/PreConditionEvalState.java Thu Dec 23 02:47:16 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.running;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * PreCondition Evalution State
+ * <p>
+ */
+public class PreConditionEvalState extends WorkflowState {
+
+	public PreConditionEvalState(String message) {
+		super(message);
+	}
+
+	@Override
+	public Category getCategory() {
+		return Category.RUNNING;
+	}
+
+	@Override
+	public String getDescription() {
+		return "Executing PreConditions";
+	}
+
+	@Override
+	public String getName() {
+		return "PreConditionEval";
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/transition/ExecutionCompleteState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/transition/ExecutionCompleteState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/transition/ExecutionCompleteState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/transition/ExecutionCompleteState.java Thu Dec 23 02:47:16 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.transition;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Execution Complete State
+ * <p>
+ */
+public class ExecutionCompleteState extends WorkflowState {
+
+	public ExecutionCompleteState(String message) {
+		super(message);
+	}
+
+	@Override
+	public Category getCategory() {
+		return Category.TRANSITION;
+	}
+
+	@Override
+	public String getDescription() {
+		return "Execution Completed Successfully";
+	}
+
+	@Override
+	public String getName() {
+		return "ExecutionComplete";
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/transition/PreConditionSuccessState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/transition/PreConditionSuccessState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/transition/PreConditionSuccessState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/transition/PreConditionSuccessState.java Thu Dec 23 02:47:16 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.transition;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * PreCondition Success State
+ * <p>
+ */
+public class PreConditionSuccessState extends WorkflowState {
+
+	public PreConditionSuccessState(String message) {
+		super(message);
+	}
+
+	@Override
+	public Category getCategory() {
+		return Category.TRANSITION;
+	}
+
+	@Override
+	public String getDescription() {
+		return "All PreCondition Finished Successfully";
+	}
+
+	@Override
+	public String getName() {
+		return "PreConditionSuccess";
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/BlockedState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/BlockedState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/BlockedState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/BlockedState.java Thu Dec 23 02:47:16 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.waiting;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Blocked State
+ * <p>
+ */
+public class BlockedState extends WorkflowState {
+
+	public BlockedState(String message) {
+		super(message);
+	}
+
+	@Override
+	public String getName() {
+		return "Blocked";
+	}
+
+	@Override
+	public String getDescription() {
+		return "Task Bailed";
+	}
+
+	@Override
+	public Category getCategory() {
+		return Category.WAITING;
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/QueuedState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/QueuedState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/QueuedState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/QueuedState.java Thu Dec 23 02:47:16 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.waiting;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Queued State
+ * <p>
+ */
+public class QueuedState extends WorkflowState {
+
+	public QueuedState(String message) {
+		super(message);
+	}
+
+	@Override
+	public Category getCategory() {
+		return Category.WAITING;
+	}
+
+	@Override
+	public String getDescription() {
+		return "Queued in WorkflowEngine";
+	}
+
+	@Override
+	public String getName() {
+		return "Queued";
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/WaitingOnResourcesState.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/WaitingOnResourcesState.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/WaitingOnResourcesState.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/state/waiting/WaitingOnResourcesState.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,49 @@
+/*
+ * 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.waiting;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.state.RevertableWorkflowState;
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+
+/**
+ * 
+ * @author bfoster
+ *
+ */
+public class WaitingOnResourcesState extends RevertableWorkflowState {
+
+	public WaitingOnResourcesState(String message) {
+		super("WaitingOnResources", message);
+	}
+	
+	public WaitingOnResourcesState(String message, WorkflowState prevState) {
+		this(message);
+		this.setPrevState(prevState);
+	}
+
+	@Override
+	public Category getCategory() {
+		return Category.WAITING;
+	}
+
+	@Override
+	public String getDescription() {
+		return "Waiting for resource to execute";
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/CasPropertyPlaceholderConfigurer.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/CasPropertyPlaceholderConfigurer.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/CasPropertyPlaceholderConfigurer.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/CasPropertyPlaceholderConfigurer.java Thu Dec 23 02:47:16 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.util;
+
+//OODT imports
+import org.apache.oodt.cas.metadata.util.PathUtils;
+
+//Spring imports
+import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
+
+/**
+ * 
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>Describe your class here</p>.
+ */
+public class CasPropertyPlaceholderConfigurer extends
+        PropertyPlaceholderConfigurer {
+
+    @Override
+    protected String convertPropertyValue(String value) {
+        try {
+        	String defaultValue = null;
+        	String[] splitValue = value.split(";");
+        	if (splitValue.length == 2) {
+        		value = splitValue[0];
+        		defaultValue = splitValue[1];
+        	}
+            String result = PathUtils.doDynamicReplacement(value);
+            if (result.equals("null"))
+            	return defaultValue;
+            else
+            	return result;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return value;
+        }
+    }
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/PluginClassLoader.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/PluginClassLoader.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/PluginClassLoader.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/PluginClassLoader.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.workflow.util;
+
+//OODT imports
+import org.apache.oodt.cas.metadata.util.PathUtils;
+
+//JDK imports
+import java.io.File;
+import java.io.FileFilter;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * 
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>Java ClassLoader for loading plugin classes in Catalogs and QueryExpressions</p>.
+ */
+public class PluginClassLoader extends URLClassLoader {
+
+	private static final Logger LOG = Logger.getLogger(PluginClassLoader.class.getName());
+	
+	public PluginClassLoader() {
+		super(getPluginURLs());
+	}
+	
+	public PluginClassLoader(ClassLoader parent) {
+		super(new URL[0], parent);
+	}
+
+	protected void addURL(URL url) {
+		super.addURL(url);
+	}
+	
+	protected void addURLs(List<URL> urls) {
+		for (URL url : urls)
+			this.addURL(url);
+	}
+	
+	public static URL[] getPluginURLs() {
+		List<URL> urls = new Vector<URL>();
+		try {
+			String pluginDirs = System.getProperty("org.apache.oodt.cas.workflow.plugin.dirs");
+			if (pluginDirs != null) {
+				for (String pluginDir : PathUtils.doDynamicReplacement(pluginDirs).split(",")) {
+					File[] jarFiles = new File(pluginDir).listFiles(new FileFilter() {
+						public boolean accept(File pathname) {
+							return pathname.getName().endsWith(".jar");
+						}					
+					});
+					for (File jarFile : jarFiles) {
+						try {
+							urls.add(jarFile.toURL());
+						}catch (Exception e) {
+							LOG.log(Level.SEVERE, "Failed to load jar file '" + jarFile + "' : " + e.getMessage(), e);
+						}
+					
+					}
+				}
+			}
+		}catch (Exception e) {}
+		return urls.toArray(new URL[urls.size()]);
+	}
+	
+	public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+		try {
+			Class<?> clazz = this.findLoadedClass(name);
+			if (clazz == null)
+				clazz = this.findClass(name);
+			return clazz;
+		}catch (Exception e) {}
+		return super.loadClass(name, resolve);
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.workflow.util;
+
+//JDK imports
+import java.util.List;
+import java.util.Vector;
+import java.util.Iterator;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ * 
+ * <p>
+ * A script file represents a set of commands (which are just
+ * <code>String</code>s) to be run through a command shell.
+ * </p>
+ * 
+ */
+public class ScriptFile {
+
+    private String commandShell = null;
+
+    private List commands = null;
+
+    /**
+     * 
+     */
+    public ScriptFile() {
+        commandShell = "/bin/sh";
+        commands = new Vector();
+    }
+
+    public ScriptFile(String shell) {
+        commandShell = shell;
+        commands = new Vector();
+    }
+
+    public ScriptFile(String shell, List cmds) {
+        commandShell = shell;
+        commands = cmds;
+    }
+
+    /**
+     * @return Returns the commands.
+     */
+    public List getCommands() {
+        return commands;
+    }
+
+    /**
+     * @param commands
+     *            The commands to set.
+     */
+    public void setCommands(List commands) {
+        this.commands = commands;
+    }
+
+    /**
+     * @return Returns the commandShell.
+     */
+    public String getCommandShell() {
+        return commandShell;
+    }
+
+    /**
+     * @param commandShell
+     *            The commandShell to set.
+     */
+    public void setCommandShell(String commandShell) {
+        this.commandShell = commandShell;
+    }
+
+    public String toString() {
+        String rStr = "";
+
+        rStr += "#!" + commandShell + "\n";
+
+        for (Iterator i = commands.iterator(); i.hasNext();) {
+            String cmd = (String) i.next();
+            rStr += cmd + "\n";
+        }
+
+        return rStr;
+    }
+
+    public void writeScriptFile(String filePath) throws Exception {
+        PrintWriter pw = null;
+
+        try {
+            pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(
+                    new File(filePath))));
+            pw.println(toString());
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new Exception("Error writing script file!: " + e.getMessage());
+        } finally {
+            try {
+                pw.close();
+                pw = null;
+            } catch (Exception ignore) {
+            }
+
+        }
+
+    }
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/Serializer.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/Serializer.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/Serializer.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/Serializer.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.workflow.util;
+
+//JDK imports
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+//XStream imports
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ */
+public class Serializer {
+
+	protected ClassLoader classLoader;
+	protected boolean usePluginUrls;
+	
+	public Serializer() {
+		this(true);
+	}
+
+	public Serializer(boolean usePluginUrls) {
+		this.usePluginUrls = usePluginUrls;
+		this.refreshClassLoader();
+	}
+	
+	public void refreshClassLoader() {
+		if (usePluginUrls) {
+			try {
+				Serializer.this.classLoader = AccessController
+					.doPrivileged(new PrivilegedAction<ClassLoader>() {
+						public ClassLoader run() {
+							return new PluginClassLoader();
+						}
+					});
+			} catch (Exception e) {}
+		}
+	}
+	
+	public void setUsePluginUrls(boolean usePluginUrls) {
+		this.usePluginUrls = usePluginUrls;
+	}
+
+	public ClassLoader getClassLoader() {
+		return classLoader == null ? Serializer.class.getClassLoader() : this.classLoader;
+	}
+	
+	/**
+	 * Serializes any java object into a java Serializable String
+	 * @param <T> Object type to be serialized
+	 * @param object The Object of type <T> to be serialized
+	 * @return A String for of the object arg
+	 */
+	public <T> String serializeObject(T object) {
+		XStream xStream = new XStream();
+		return xStream.toXML(object);
+	}
+	
+	public <T> void serializeObject(T object, OutputStream outStream) {
+		XStream xStream = new XStream();
+		xStream.toXML(object, outStream);
+	}
+	
+	/**
+	 * Deserializes any object that has been serialized by the serializedObject(T) method
+	 * @param <T> Type of Object that was originally serialized
+	 * @param clazz The class object representation of the object type
+	 * @param xmlObject The String for of the object to be deserialized
+	 * @return The deserialized object
+	 * @throws ClassNotFoundException
+	 * @throws InstantiationException
+	 * @throws IllegalAccessException
+	 */
+	public <T> T deserializeObject(Class<T> clazz, String xmlObject) {
+		XStream xStream = new XStream();
+		xStream.setClassLoader(getClassLoader());
+		return (T) xStream.fromXML(xmlObject);
+	}
+	
+	public <T> T deserializeObject(Class<T> clazz, InputStream inStream) {
+		XStream xStream = new XStream();
+		xStream.setClassLoader(getClassLoader());
+		return (T) xStream.fromXML(inStream);
+	}
+
+}

Added: oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/WorkflowUtils.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/WorkflowUtils.java?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/WorkflowUtils.java (added)
+++ oodt/branches/wengine-branch/wengine/src/main/java/org/apache/oodt/cas/workflow/util/WorkflowUtils.java Thu Dec 23 02:47:16 2010
@@ -0,0 +1,290 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.workflow.util;
+
+//OODT imports
+import org.apache.oodt.commons.exec.ExecHelper;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.instance.TaskInstance;
+import org.apache.oodt.cas.workflow.model.WorkflowGraph;
+import org.apache.oodt.cas.workflow.model.WorkflowModel;
+import org.apache.oodt.cas.workflow.processor.ProcessorSkeleton;
+import org.apache.oodt.cas.workflow.processor.TaskProcessor;
+import org.apache.oodt.cas.workflow.processor.WorkflowProcessor;
+import org.apache.oodt.cas.workflow.state.WorkflowState;
+import org.apache.oodt.cas.workflow.state.initial.LoadedState;
+import org.apache.oodt.cas.workflow.state.running.ExecutingState;
+import org.apache.oodt.cas.workflow.state.waiting.QueuedState;
+import org.apache.oodt.cas.workflow.state.waiting.WaitingOnResourcesState;
+
+//JDK imports
+import java.net.InetAddress;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+import java.util.Vector;
+import java.util.HashMap;
+import java.util.Map.Entry;
+
+//APACHE imports
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Utilities for working with WorkflowProcessors and WorkflowModels
+ * <p>
+ */
+public class WorkflowUtils {
+
+	public static String toString(WorkflowGraph graph) {
+		return toString(graph, "\n   ");
+	}
+	
+	private static String toString(WorkflowGraph graph, String indent) {
+		StringBuffer stringModel = new StringBuffer(toString(graph.getModel()));
+		if (graph.getPreConditions() != null)
+			stringModel.append(indent + "{PreCond:" + indent + "   " + toString(graph.getPreConditions(), indent + "      ") + "}");
+		if (graph.getPostConditions() != null)
+			stringModel.append(indent + "{PostCond:" + indent + "   " + toString(graph.getPostConditions(), indent + "      ") + "}");
+		if (graph.getChildren() != null)
+			for (WorkflowGraph childGraph : graph.getChildren())
+				stringModel.append(indent + toString(childGraph, indent + "   "));
+		return stringModel.toString();
+	}
+	
+	public static String toString(WorkflowModel model) {
+		return toString(model, "\n   ");
+	}
+	
+	public static String toString(WorkflowModel model, String indent) {
+		return "[" + (model.getId() == null ? "" : "id = '" + model.getId() + "', name = '" + model.getName() + "', ") + "execution = '" + model.getExecutionType() + "']";//, properties = " + model.getStaticMetadata().asHashtable() + "]";
+
+	}
+	
+	public static String toString(WorkflowProcessor processor) {
+		return toString(processor, "\n   ");
+	}
+	
+	private static String toString(WorkflowProcessor processor, String indent) {
+		StringBuffer stringModel = new StringBuffer("[" + (processor.getModelId() == null ? "" : "id = '" + processor.getModelId() + "', name = '" + processor.getModelName() + "', ") + "execution = '" + processor.getExecutionType() + "', state = '" + processor.getState().getName() + "']");//, properties = " + processor.getStaticMetadata().asHashtable() + "]");
+		if (processor.getPreConditions() != null)
+			stringModel.append(indent + "{PreCond:" + indent + "   " + toString(processor.getPreConditions(), indent + "      ") + "}");
+		if (processor.getPostConditions() != null)
+			stringModel.append(indent + "{PostCond:" + indent + "   " + toString(processor.getPostConditions(), indent + "      ") + "}");
+		if (processor.getSubProcessors() != null)
+			for (WorkflowProcessor subProcessor : processor.getSubProcessors())
+				stringModel.append(indent + toString(subProcessor, indent + "   "));
+		return stringModel.toString();
+	}
+	
+	public static String toString(ProcessorSkeleton skeleton) {
+		return toString(skeleton, "\n   ");
+	}
+	
+	private static String toString(ProcessorSkeleton skeleton, String indent) {
+		StringBuffer stringModel = new StringBuffer("[" + (skeleton.getModelId() == null ? "" : "id = '" + skeleton.getModelId() + "', name = '" + skeleton.getModelName() + "', ") + "execution = '" + skeleton.getExecutionType() + "', state = '" + skeleton.getState().getName() + "']");//, properties = " + processor.getStaticMetadata().asHashtable() + "]");
+		if (skeleton.getPreConditions() != null)
+			stringModel.append(indent + "{PreCond:" + indent + "   " + toString(skeleton.getPreConditions(), indent + "      ") + "}");
+		if (skeleton.getPostConditions() != null)
+			stringModel.append(indent + "{PostCond:" + indent + "   " + toString(skeleton.getPostConditions(), indent + "      ") + "}");
+		if (skeleton.getSubProcessors() != null)
+			for (ProcessorSkeleton subProcessor : skeleton.getSubProcessors())
+				stringModel.append(indent + toString(subProcessor, indent + "   "));
+		return stringModel.toString();
+	}
+	
+	public static String describe(ProcessorSkeleton skeleton) {
+		StringBuffer stringModel = new StringBuffer("");
+		stringModel.append("Processor [id = '" + skeleton.getModelId() + "', name = '" + skeleton.getModelName() + "']\n");
+		stringModel.append("   - instance = '" + skeleton.getInstanceId() + "'\n");
+		stringModel.append("   - execution = '" + skeleton.getExecutionType() + "'\n");
+		stringModel.append("   - timesBlocked = '" + skeleton.getTimesBlocked() + "'\n");
+		stringModel.append("   - dates: \n");
+		stringModel.append("        CreationDate = '" + skeleton.getProcessorInfo().getCreationDate() + "'\n");
+		stringModel.append("        ReadyDate = '" + skeleton.getProcessorInfo().getReadyDate() + "'\n");
+		stringModel.append("        ExecutionDate = '" + skeleton.getProcessorInfo().getExecutionDate() + "'\n");
+		stringModel.append("        CompletionDate = '" + skeleton.getProcessorInfo().getCompletionDate() + "'\n");
+		stringModel.append("   - state: \n");
+		stringModel.append("        name = '" + skeleton.getState().getName() + "'\n");
+		stringModel.append("        startTime = '" + skeleton.getState().getStartTime() + "'\n");
+		stringModel.append("        message = '" + skeleton.getState().getMessage() + "'\n");
+		stringModel.append("   - priority = '" + skeleton.getPriority() + "'\n");
+		stringModel.append("   - execusedSubProcessors = '" + StringUtils.join(skeleton.getExcusedSubProcessorIds().iterator(), ",") + "'\n");
+		stringModel.append("   - static metadata = \n");
+		for (String key : skeleton.getStaticMetadata().getAllKeys())
+			stringModel.append("      + " + key + " -> '" + StringUtils.join(skeleton.getStaticMetadata().getAllMetadata(key), ",") + "'\n");
+		stringModel.append("   - dynamic metadata = \n");
+		for (String key : skeleton.getDynamicMetadata().getAllKeys())
+			stringModel.append("      + " + key + " -> '" + StringUtils.join(skeleton.getDynamicMetadata().getAllMetadata(key), ",") + "'\n");
+		return stringModel.toString();
+	}
+	
+	public static WorkflowProcessor buildProcessor(String instanceId, WorkflowGraph graph, Map<String, Class<? extends WorkflowProcessor>> modelToProcessorMap) throws Exception {
+		List<WorkflowProcessor> subProcessors = new Vector<WorkflowProcessor>();
+		for (WorkflowGraph childGraph : graph.getChildren())
+			subProcessors.add(buildProcessor(instanceId, childGraph, modelToProcessorMap));
+		WorkflowProcessor wp = buildProcessor(instanceId, graph.getModel(), graph.isCondition(), graph.getPreConditions(), graph.getPostConditions(), modelToProcessorMap);
+		wp.setSubProcessors(subProcessors);
+		return wp;
+	}
+	
+	public static WorkflowProcessor buildProcessor(String instanceId, WorkflowModel model, boolean isCondition, WorkflowGraph preConditions, WorkflowGraph postConditions, Map<String, Class<? extends WorkflowProcessor>> modelToProcessorMap) throws Exception {
+		WorkflowProcessor wp = modelToProcessorMap.get(model.getExecutionType()).newInstance();
+		wp.setExcusedSubProcessorIds(model.getExcusedSubProcessorIds());
+		wp.setInstanceId(instanceId);
+		wp.setModelId(model.getId());
+		wp.setModelName(model.getName());
+		wp.setIsConditionProcessor(isCondition);
+		wp.setExecutionType(model.getExecutionType());
+		if (preConditions != null)
+			wp.setPreConditions(buildProcessor(instanceId, preConditions, modelToProcessorMap));
+		if (postConditions != null)
+			wp.setPostConditions(buildProcessor(instanceId, postConditions, modelToProcessorMap));
+		wp.setPriority(model.getPriority());
+		wp.setMinReqSuccessfulSubProcessors(model.getMinReqSuccessfulSubProcessors());
+		wp.setStaticMetadata(model.getStaticMetadata());
+		wp.setState(new LoadedState(""));
+		if (wp instanceof TaskProcessor)
+			((TaskProcessor) wp).setInstanceClass((Class<? extends TaskInstance>) Class.forName(model.getInstanceClass()));
+		return wp;
+	}
+	
+	public static ProcessorSkeleton findSkeleton(ProcessorSkeleton skeleton, String modelId) {
+		if (skeleton.getModelId().equals(modelId))
+			return skeleton;
+		ProcessorSkeleton found = findSkeleton(skeleton.getSubProcessors(), modelId);
+		if (found == null) {
+			if (skeleton.getPreConditions() != null)
+				found = findSkeleton(skeleton.getPreConditions(), modelId);
+			if (found == null && skeleton.getPostConditions() != null)
+				found = findSkeleton(skeleton.getPostConditions(), modelId);
+		}
+		return found;
+	}
+	
+	protected static ProcessorSkeleton findSkeleton(List<ProcessorSkeleton> skeletons, String modelId) {
+		for (ProcessorSkeleton skeleton : skeletons) {
+			if (skeleton.getModelId().equals(modelId)) {
+				return skeleton;
+			}else {
+				skeleton = findSkeleton(skeleton, modelId);
+				if (skeleton != null)
+					return skeleton;
+			}
+		}
+		return null;
+	}
+	
+	public static WorkflowProcessor findProcessor(WorkflowProcessor wp, String modelId) {
+		if (wp.getModelId().equals(modelId))
+			return wp;
+		WorkflowProcessor found = findProcessor(wp.getSubProcessors(), modelId);
+		if (found == null) {
+			if (wp.getPreConditions() != null)
+				found = findProcessor(wp.getPreConditions(), modelId);
+			if (found == null && wp.getPostConditions() != null)
+				found = findProcessor(wp.getPostConditions(), modelId);
+		}
+		return found;
+	}
+	
+	protected static WorkflowProcessor findProcessor(List<WorkflowProcessor> processors, String modelId) {
+		for (WorkflowProcessor processor : processors) {
+			if (processor.getModelId().equals(modelId)) {
+				return processor;
+			}else {
+				processor = findProcessor(processor, modelId);
+				if (processor != null)
+					return processor;
+			}
+		}
+		return null;
+	}
+
+	public static void validateWorkflowProcessor(WorkflowProcessor wp) {
+		if (wp instanceof TaskProcessor) {
+			WorkflowState state = wp.getState();
+			if ((state instanceof WaitingOnResourcesState && ((WaitingOnResourcesState) state).getPrevState() instanceof ExecutingState) || state instanceof ExecutingState) 
+				wp.setState(new QueuedState("Marked back to queued state because of system failure"));
+			else
+				wp.setState(state);
+		}else {
+			if (wp.getPreConditions() != null)
+				validateWorkflowProcessor(wp.getPreConditions());
+			for (WorkflowProcessor child : wp.getSubProcessors())
+				validateWorkflowProcessor(child);
+			if (wp.getPostConditions() != null)
+				validateWorkflowProcessor(wp.getPostConditions());
+		}
+	}
+	
+	public static List<Metadata> getDynamicMetadata(List<WorkflowProcessor> workflowProcessors) {
+		List<Metadata> metadatas = new Vector<Metadata>();
+		for (WorkflowProcessor workflowProcessor: workflowProcessors)
+			metadatas.add(workflowProcessor.getDynamicMetadata());
+		return metadatas;
+	}
+		
+	public static Metadata mergeMetadata(Metadata m1, Metadata m2) {
+		HashMap<String, LinkedHashSet<String>> merge = new HashMap<String, LinkedHashSet<String>>();
+		List<Metadata> metadatas = Arrays.asList(m1, m2);
+		for (Metadata m : metadatas) {
+			for (String key : m.getAllKeys()) {
+				LinkedHashSet<String> values = merge.get(key);
+				if (values == null)
+					values = new LinkedHashSet<String>();
+				values.addAll(m.getAllMetadata(key));
+				merge.put(key, values);
+			}
+		}
+		Metadata m = new Metadata();
+		for (Entry<String, LinkedHashSet<String>> entry : merge.entrySet())
+			m.addMetadata(entry.getKey(), new Vector<String>(entry.getValue()));
+		return m;
+	}
+	
+	public static void markAsCondition(WorkflowGraph graph) {
+		Stack<WorkflowGraph> stack = new Stack<WorkflowGraph>();
+		stack.push(graph);
+		while (!stack.empty()) {
+			WorkflowGraph curGraph = stack.pop();
+			curGraph.setIsCondition(true);
+			stack.addAll(curGraph.getChildren());
+		}
+	}
+	
+	public static String getHostName() {
+		String host = null;
+		try {
+			host = InetAddress.getLocalHost().getHostName();
+		}catch (Exception e) {
+			try {
+				host = ExecHelper.exec(new String[] { "hostname" }).getOutput().trim();
+			}catch (Exception e1){}
+		}
+		if (host == null) 
+			return "Unknown";
+		return host;
+	}
+}

Added: oodt/branches/wengine-branch/wengine/src/main/resources/REMOVE.log
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/resources/REMOVE.log?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/resources/REMOVE.log (added)
+++ oodt/branches/wengine-branch/wengine/src/main/resources/REMOVE.log Thu Dec 23 02:47:16 2010
@@ -0,0 +1,2 @@
+You can remove this file. It was only included to ensure that the log directory for this
+distribution was created on assembly.

Added: oodt/branches/wengine-branch/wengine/src/main/resources/documentation/UserGuide.doc
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/resources/documentation/UserGuide.doc?rev=1052147&view=auto
==============================================================================
Binary file - no diff available.

Propchange: oodt/branches/wengine-branch/wengine/src/main/resources/documentation/UserGuide.doc
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: oodt/branches/wengine-branch/wengine/src/main/resources/logging.properties
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/wengine/src/main/resources/logging.properties?rev=1052147&view=auto
==============================================================================
--- oodt/branches/wengine-branch/wengine/src/main/resources/logging.properties (added)
+++ oodt/branches/wengine-branch/wengine/src/main/resources/logging.properties Thu Dec 23 02:47:16 2010
@@ -0,0 +1,43 @@
+# Copyright (c) 2008 California Institute of Technology.
+# ALL RIGHTS RESERVED. U.S. Government Sponsorship acknowledged.
+#
+# $Id$
+
+
+# Specify the handlers to create in the root logger
+# (all loggers are children of the root logger)
+# The following creates two handlers
+handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
+
+# Set the default logging level for the root logger
+.level = ALL
+    
+# Set the default logging level for new ConsoleHandler instances
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.FileHandler.level = ALL
+        
+# Set the default formatter for new ConsoleHandler instances
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = ../logs/cas_workflow%g.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 5
+java.util.logging.FileHandler.append = true
+java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
+    
+# Set the default logging level for the subsystems
+org.apache.oodt.cas.workflow.level = ALL
+
+# control the underlying commons-httpclient transport layer for xmlrpc 
+org.apache.commons.httpclient.level = INFO
+httpclient.wire.header.level = INFO
+httpclient.wire.level = INFO
+
+org.springframework.beans.level = WARNING
+org.springframework.core.level = WARNING
+org.springframework.level = WARNING
+org.springframework.beans.factory.level = WARNING
+org.springframework.beans.factory.config.level = WARNING
+org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.level = WARNING
+org.apache.oodt.cas.workflow.util.CasPropertyPlaceholderConfigurer.level = WARNING
\ No newline at end of file



Mime
View raw message