You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/02/28 07:47:26 UTC
svn commit: r631872 - in
/servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src:
main/java/org/apache/servicemix/osworkflow/
test/java/org/apache/servicemix/osworkflow/conditions/
test/java/org/apache/servicemix/osworkflow/functions/
Author: ffang
Date: Wed Feb 27 22:47:25 2008
New Revision: 631872
URL: http://svn.apache.org/viewvc?rev=631872&view=rev
Log:
[SM-1253]remove checkstyle error
Modified:
servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflow.java
servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflowEndpoint.java
servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/WorkflowManager.java
servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/conditions/ExampleCondition.java
servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/AnswerExampleFunction.java
servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/ExampleFunction.java
servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/FailExampleFunction.java
Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflow.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflow.java?rev=631872&r1=631871&r2=631872&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflow.java (original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflow.java Wed Feb 27 22:47:25 2008
@@ -22,8 +22,6 @@
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.RobustInOnly;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import com.opensymphony.workflow.InvalidInputException;
import com.opensymphony.workflow.InvalidRoleException;
@@ -32,11 +30,14 @@
import com.opensymphony.workflow.basic.BasicWorkflow;
import com.opensymphony.workflow.config.DefaultConfiguration;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* @author lhe
*/
public class OSWorkflow extends Thread {
- private static Log log = LogFactory.getLog(OSWorkflow.class);
+
public static final String KEY_EXCHANGE = "exchange";
@@ -48,25 +49,27 @@
public static final String KEY_ASYNC_PROCESSING = "asynchronous";
- private Workflow osWorkflowInstance = null;
+ private static Log log = LogFactory.getLog(OSWorkflow.class);
+
+ private Workflow osWorkflowInstance;
- private String caller = null;
+ private String caller;
- private String osWorkflowName = null;
+ private String osWorkflowName;
- private Map map = null;
+ private Map map;
private int action = -1;
- private long workflowId = -1l;
+ private long workflowId = -1L;
- private boolean finished = false;
+ private boolean finished;
- private boolean aborted = false;
+ private boolean aborted;
- private OSWorkflowEndpoint endpoint = null;
+ private OSWorkflowEndpoint endpoint;
- private MessageExchange exchange = null;
+ private MessageExchange exchange;
/**
* creates and initializes a new workflow object
@@ -105,7 +108,7 @@
this.map
.put(
KEY_ASYNC_PROCESSING,
- (this.exchange instanceof InOnly || this.exchange instanceof RobustInOnly));
+ this.exchange instanceof InOnly || this.exchange instanceof RobustInOnly);
}
/**
@@ -118,9 +121,9 @@
this.osWorkflowInstance = new BasicWorkflow(this.caller);
DefaultConfiguration config = new DefaultConfiguration();
this.osWorkflowInstance.setConfiguration(config);
- long workflowId = this.osWorkflowInstance.initialize(
+ long wfId = this.osWorkflowInstance.initialize(
this.osWorkflowName, this.action, this.map);
- return workflowId;
+ return wfId;
}
/*
Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflowEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflowEndpoint.java?rev=631872&r1=631871&r2=631872&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflowEndpoint.java (original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/OSWorkflowEndpoint.java Wed Feb 27 22:47:25 2008
@@ -25,11 +25,11 @@
import javax.jbi.messaging.InOnly;
import javax.jbi.messaging.InOut;
import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchange.Role;
import javax.jbi.messaging.MessageExchangeFactory;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
import javax.jbi.messaging.RobustInOnly;
-import javax.jbi.messaging.MessageExchange.Role;
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
@@ -152,20 +152,16 @@
// UnsupportedOperationException
if (exchange.getRole() == Role.CONSUMER) {
onConsumerExchange(exchange);
- }
-
- // The component acts as a provider, this means that another component
- // has requested our
- // service
- // As this exchange is active, this is either an in or a fault (out are
- // send by this
- // component)
- else if (exchange.getRole() == MessageExchange.Role.PROVIDER) {
+ } else if (exchange.getRole() == MessageExchange.Role.PROVIDER) {
+// The component acts as a provider, this means that another component
+ // has requested our
+ // service
+ // As this exchange is active, this is either an in or a fault (out are
+ // send by this
+ // component)
onProviderExchange(exchange);
- }
-
- // Unknown role
- else {
+ } else {
+ // Unknown role
throw new MessagingException(
"OSWorkflowEndpoint.onMessageExchange(): Unknown role: "
+ exchange.getRole());
@@ -179,21 +175,17 @@
* @throws MessagingException
*/
protected void onConsumerExchange(MessageExchange exchange)
- throws MessagingException {
+ throws MessagingException {
// Out message
if (exchange.getMessage("out") != null) {
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);
- }
-
- // Fault message
- else if (exchange.getFault() != null) {
+ } else if (exchange.getFault() != null) {
+ //Fault message
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);
- }
-
- // This is not compliant with the default MEPs
- else {
+ } else {
+ //This is not compliant with the default MEPs
throw new MessagingException(
"OSWorkflowEndpoint.onConsumerExchange(): Consumer exchange is ACTIVE, but no out or fault is provided");
}
@@ -206,17 +198,16 @@
* @throws MessagingException
*/
protected void onProviderExchange(MessageExchange exchange)
- throws MessagingException {
- // Exchange is finished
+ throws MessagingException {
+
if (exchange.getStatus() == ExchangeStatus.DONE) {
+ //Exchange is finished
return;
- }
- // Exchange has been aborted with an exception
- else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+ } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+ //Exchange has been aborted with an exception
return;
- }
- // Fault message
- else if (exchange.getFault() != null) {
+ } else if (exchange.getFault() != null) {
+ //Fault message
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);
} else {
@@ -285,7 +276,7 @@
* on any messaging exception
*/
public boolean sendMessage(QName service, Source source)
- throws MessagingException {
+ throws MessagingException {
InOnly inOnly = channel.createExchangeFactoryForService(service)
.createInOnlyExchange();
NormalizedMessage msg = inOnly.createMessage();
@@ -310,7 +301,7 @@
* on any messaging exception
*/
public Source sendRequest(QName service, Source source)
- throws MessagingException {
+ throws MessagingException {
InOut inOut = channel.createExchangeFactoryForService(service)
.createInOutExchange();
NormalizedMessage msg = inOut.createMessage();
@@ -349,7 +340,7 @@
* on any messaging exception
*/
public MessageExchange sendRawInOutRequest(QName service, Source source)
- throws MessagingException {
+ throws MessagingException {
InOut inOut = channel.createExchangeFactoryForService(service)
.createInOutExchange();
NormalizedMessage msg = inOut.createMessage();
@@ -373,7 +364,7 @@
* @throws MessagingException
*/
public MessageExchange getNewExchange(QName qname, boolean inOut)
- throws MessagingException {
+ throws MessagingException {
MessageExchange exchange = null;
if (inOut) {
@@ -406,7 +397,7 @@
* @throws MessagingException
*/
public void send(MessageExchange ex, boolean sync)
- throws MessagingException {
+ throws MessagingException {
if (sync) {
channel.sendSync(ex, TIME_OUT);
} else {
Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/WorkflowManager.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/WorkflowManager.java?rev=631872&r1=631871&r2=631872&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/WorkflowManager.java (original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/main/java/org/apache/servicemix/osworkflow/WorkflowManager.java Wed Feb 27 22:47:25 2008
@@ -22,10 +22,10 @@
/**
* @author lhe
*/
-public class WorkflowManager {
+public final class WorkflowManager {
private static final int WORKER_COUNT = 30;
- private static WorkflowManager manager = null;
+ private static WorkflowManager manager;
private ExecutorService executor;
@@ -41,7 +41,7 @@
*
* @return manager instance
*/
- public synchronized static WorkflowManager getInstance() {
+ public static synchronized WorkflowManager getInstance() {
if (manager == null) {
manager = new WorkflowManager();
}
Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/conditions/ExampleCondition.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/conditions/ExampleCondition.java?rev=631872&r1=631871&r2=631872&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/conditions/ExampleCondition.java (original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/conditions/ExampleCondition.java Wed Feb 27 22:47:25 2008
@@ -18,12 +18,14 @@
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import com.opensymphony.module.propertyset.PropertySet;
import com.opensymphony.workflow.Condition;
import com.opensymphony.workflow.WorkflowException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
public class ExampleCondition implements Condition {
Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/AnswerExampleFunction.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/AnswerExampleFunction.java?rev=631872&r1=631871&r2=631872&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/AnswerExampleFunction.java (original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/AnswerExampleFunction.java Wed Feb 27 22:47:25 2008
@@ -21,22 +21,21 @@
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.NormalizedMessage;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import com.opensymphony.module.propertyset.PropertySet;
+import com.opensymphony.workflow.FunctionProvider;
+import com.opensymphony.workflow.WorkflowException;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.osworkflow.OSWorkflow;
import org.apache.servicemix.osworkflow.OSWorkflowEndpoint;
-import com.opensymphony.module.propertyset.PropertySet;
-import com.opensymphony.workflow.FunctionProvider;
-import com.opensymphony.workflow.WorkflowException;
+
/**
* @author lhe
*/
public class AnswerExampleFunction implements FunctionProvider {
- private static Log logger = LogFactory.getLog(AnswerExampleFunction.class);
+ //private static Log logger = LogFactory.getLog(AnswerExampleFunction.class);
/*
* (non-Javadoc)
@@ -45,7 +44,7 @@
* java.util.Map, com.opensymphony.module.propertyset.PropertySet)
*/
public void execute(Map transientVars, Map args, PropertySet propertySet)
- throws WorkflowException {
+ throws WorkflowException {
OSWorkflowEndpoint ep = null;
boolean isAsynchron = false;
MessageExchange exchange = null;
Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/ExampleFunction.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/ExampleFunction.java?rev=631872&r1=631871&r2=631872&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/ExampleFunction.java (original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/ExampleFunction.java Wed Feb 27 22:47:25 2008
@@ -23,17 +23,18 @@
import javax.jbi.messaging.NormalizedMessage;
import javax.xml.transform.dom.DOMSource;
+import org.w3c.dom.Node;
+
+import com.opensymphony.module.propertyset.PropertySet;
+import com.opensymphony.workflow.FunctionProvider;
+import com.opensymphony.workflow.WorkflowException;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.osworkflow.OSWorkflow;
import org.apache.servicemix.osworkflow.OSWorkflowEndpoint;
import org.apache.xpath.CachedXPathAPI;
-import org.w3c.dom.Node;
-
-import com.opensymphony.module.propertyset.PropertySet;
-import com.opensymphony.workflow.FunctionProvider;
-import com.opensymphony.workflow.WorkflowException;
public class ExampleFunction implements FunctionProvider {
@@ -46,7 +47,7 @@
* java.util.Map, com.opensymphony.module.propertyset.PropertySet)
*/
public void execute(Map transientVars, Map args, PropertySet propertySet)
- throws WorkflowException {
+ throws WorkflowException {
logger.info("Executing function...");
Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/FailExampleFunction.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/FailExampleFunction.java?rev=631872&r1=631871&r2=631872&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/FailExampleFunction.java (original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-osworkflow/src/test/java/org/apache/servicemix/osworkflow/functions/FailExampleFunction.java Wed Feb 27 22:47:25 2008
@@ -21,22 +21,22 @@
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.NormalizedMessage;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import com.opensymphony.module.propertyset.PropertySet;
+import com.opensymphony.workflow.FunctionProvider;
+import com.opensymphony.workflow.WorkflowException;
+
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.osworkflow.OSWorkflow;
import org.apache.servicemix.osworkflow.OSWorkflowEndpoint;
-import com.opensymphony.module.propertyset.PropertySet;
-import com.opensymphony.workflow.FunctionProvider;
-import com.opensymphony.workflow.WorkflowException;
+
/**
* @author lhe
*/
public class FailExampleFunction implements FunctionProvider {
- private static Log logger = LogFactory.getLog(FailExampleFunction.class);
+ //private static Log logger = LogFactory.getLog(FailExampleFunction.class);
/*
* (non-Javadoc)
@@ -45,7 +45,7 @@
* java.util.Map, com.opensymphony.module.propertyset.PropertySet)
*/
public void execute(Map transientVars, Map args, PropertySet propertySet)
- throws WorkflowException {
+ throws WorkflowException {
OSWorkflowEndpoint ep = null;
boolean isAsynchron = false;
MessageExchange exchange = null;