You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2003/10/10 17:04:50 UTC
cvs commit: jakarta-turbine-fulcrum/osworkflow/src/java/org/apache/fulcrum/osworkflow WorkflowServiceFacade.java DefaultWorkflowService.java
epugh 2003/10/10 08:04:50
Modified: osworkflow/xdocs changes.xml
osworkflow project.xml project.properties
osworkflow/src/java/org/apache/fulcrum/osworkflow
DefaultWorkflowService.java
Added: osworkflow/src/test/org/apache/fulcrum/osworkflow
WorkflowServiceFacadeTest.java
osworkflow/src/java/org/apache/fulcrum/osworkflow
WorkflowServiceFacade.java
Log:
Add WorkflowServiceFacade + unit test from Youngho Cho
Revision Changes Path
1.3 +4 -1 jakarta-turbine-fulcrum/osworkflow/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/osworkflow/xdocs/changes.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- changes.xml 26 Sep 2003 14:55:09 -0000 1.2
+++ changes.xml 10 Oct 2003 15:04:49 -0000 1.3
@@ -6,7 +6,10 @@
</properties>
<body>
- <release version="Not applicable" date="">
+ <release version="in cvs" date="">
+ <action dev="ycho" type="add">
+ New WorkflowServiceFacade.
+ </action>
<action dev="epugh" type="update">
Changed name of project from workflow to osworkflow to clarify this isn't the
end all and be all workflow tool, but rather just an implementation of the
1.3 +8 -0 jakarta-turbine-fulcrum/osworkflow/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/osworkflow/project.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- project.xml 26 Sep 2003 14:55:09 -0000 1.2
+++ project.xml 10 Oct 2003 15:04:49 -0000 1.3
@@ -5,6 +5,14 @@
<name>Fulcrum OSWorkflow Component</name>
<currentVersion>1.0-alpha-1</currentVersion>
+ <contributors>
+ <contributor>
+ <name>Youngho Cho</name>
+ <id>ycho</id>
+ <email>youngho@nannet.co.kr</email>
+ </contributor>
+ </contributors>
+
<dependencies>
<dependency>
<groupId>opensymphony</groupId>
1.2 +3 -1 jakarta-turbine-fulcrum/osworkflow/project.properties
Index: project.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/osworkflow/project.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.properties 14 Sep 2003 13:15:44 -0000 1.1
+++ project.properties 10 Oct 2003 15:04:49 -0000 1.2
@@ -7,4 +7,6 @@
# Display the version the web site is documenting
maven.xdoc.version = ${pom.currentVersion}
-maven.multiproject.type=jar
\ No newline at end of file
+maven.multiproject.type=jar
+
+maven.javadoc.links=http://www.opensymphony.com/osworkflow/api/
\ No newline at end of file
1.1 jakarta-turbine-fulcrum/osworkflow/src/test/org/apache/fulcrum/osworkflow/WorkflowServiceFacadeTest.java
Index: WorkflowServiceFacadeTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.fulcrum.osworkflow;
// Cactus and Junit imports
import junit.awtui.TestRunner;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.fulcrum.testcontainer.BaseUnitTest;
import com.opensymphony.workflow.Workflow;
/**
* Test the WorkflowServiceFacade.
*
* @author <a href="epugh@upstate.com">Eric Pugh</a>
* @version $Id: WorkflowServiceFacadeTest.java,v 1.1 2003/10/10 15:04:49 epugh Exp $
*/
public class WorkflowServiceFacadeTest extends BaseUnitTest
{
/**
* Defines the testcase name for JUnit.
*
* @param name the testcase's name.
*/
public WorkflowServiceFacadeTest(String name)
{
super(name);
}
/**
* Start the tests.
*
* @param args the arguments. Not used
*/
public static void main(String args[])
{
TestRunner.main(
new String[] { WorkflowServiceFacadeTest.class.getName()});
}
/**
* Creates the test suite.
*
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
*/
public static Test suite()
{
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(WorkflowServiceFacadeTest.class);
}
public void testWorkflowFacadeNotConfigured() throws Exception
{
try
{
Workflow wf = WorkflowServiceFacade.retrieveWorkflow("caller");
}
catch (RuntimeException re)
{
//good;
}
}
public void testWorkflowFacadeConfigured() throws Exception
{
// this.lookup causes the workflow service to be configured.
this.lookup(WorkflowService.ROLE);
Workflow wf = WorkflowServiceFacade.retrieveWorkflow("caller");
assertNotNull(wf);
}
}
1.3 +13 -1 jakarta-turbine-fulcrum/osworkflow/src/java/org/apache/fulcrum/osworkflow/DefaultWorkflowService.java
Index: DefaultWorkflowService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/osworkflow/src/java/org/apache/fulcrum/osworkflow/DefaultWorkflowService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultWorkflowService.java 28 Sep 2003 09:56:12 -0000 1.2
+++ DefaultWorkflowService.java 10 Oct 2003 15:04:50 -0000 1.3
@@ -55,6 +55,7 @@
*/
import java.util.Iterator;
import java.util.List;
+
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.configuration.Configurable;
@@ -62,6 +63,9 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import com.opensymphony.workflow.Workflow;
import com.opensymphony.workflow.WorkflowException;
import com.opensymphony.workflow.basic.BasicWorkflow;
@@ -79,6 +83,9 @@
extends AbstractLogEnabled
implements WorkflowService, Configurable, Initializable, Disposable, ThreadSafe
{
+
+ /** The log. */
+ private static Log log = LogFactory.getLog(DefaultWorkflowService.class);
/**
* For a specific caller and status, return all the workflows.
*
@@ -136,6 +143,11 @@
*/
public void initialize() throws Exception
{
+ WorkflowServiceFacade.setWorkflowService(this);
+ if (log.isInfoEnabled())
+ {
+ log.info("OSWorkflow Service is Initialized now..");
+ }
}
/**
1.1 jakarta-turbine-fulcrum/osworkflow/src/java/org/apache/fulcrum/osworkflow/WorkflowServiceFacade.java
Index: WorkflowServiceFacade.java
===================================================================
package org.apache.fulcrum.osworkflow;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import com.opensymphony.workflow.Workflow;
import com.opensymphony.workflow.WorkflowException;
/**
* This is a Facade class for WorkflowService.
*
* This class provides static methods that call related methods of the
* implementation of the WorkflowService used by the System.
*
* @version $Id: WorkflowServiceFacade.java,v 1.1 2003/10/10 15:04:50 epugh Exp $
*/
public class WorkflowServiceFacade
{
/** Static instance of the WorkflowService. */
private static WorkflowService workflowService;
/**
* Utility method for accessing the service
* implementation
*
* @return a WorkflowService implementation instance
*/
private static WorkflowService getService()
{
if(workflowService==null){
throw new RuntimeException("Workflow Service has not been set yet.");
}
return workflowService;
}
static void setWorkflowService(WorkflowService service)
{
workflowService = service;
}
/** Retrives a workflow based on the caller */
public static Workflow retrieveWorkflow(String caller)
{
return getService().retrieveWorkflow(caller);
}
/** For a specific caller and status, return all the workflows. */
public static long[] retrieveWorkflows(String caller, String status)
throws WorkflowException
{
return getService().retrieveWorkflows(caller, status);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org