You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/04/07 23:29:15 UTC

svn commit: r526489 - in /incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script: ScriptComponent.java ScriptExchangeHelper.java ScriptExchangeProcessorEndpoint.java ScriptHelper.java

Author: gnodet
Date: Sat Apr  7 14:29:14 2007
New Revision: 526489

URL: http://svn.apache.org/viewvc?view=rev&rev=526489
Log:
Fix checkstyle and pmd violations

Modified:
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptComponent.java
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeHelper.java
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeProcessorEndpoint.java
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptHelper.java

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptComponent.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptComponent.java?view=diff&rev=526489&r1=526488&r2=526489
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptComponent.java (original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptComponent.java Sat Apr  7 14:29:14 2007
@@ -26,22 +26,22 @@
  */
 public class ScriptComponent extends DefaultComponent {
 
-	private ScriptExchangeProcessorEndpoint[] endpoints;
+    private ScriptExchangeProcessorEndpoint[] endpoints;
 
-	protected Class[] getEndpointClasses() {
-		return new Class[] { ScriptExchangeProcessorEndpoint.class };
-	}
+    protected Class[] getEndpointClasses() {
+        return new Class[] {ScriptExchangeProcessorEndpoint.class };
+    }
 
-	public ScriptExchangeProcessorEndpoint[] getEndpoints() {
-		return endpoints;
-	}
+    public ScriptExchangeProcessorEndpoint[] getEndpoints() {
+        return endpoints;
+    }
 
-	public void setEndpoints(ScriptExchangeProcessorEndpoint[] endpoints) {
-		this.endpoints = endpoints;
-	}
+    public void setEndpoints(ScriptExchangeProcessorEndpoint[] endpoints) {
+        this.endpoints = endpoints;
+    }
 
-	protected List getConfiguredEndpoints() {
-		return asList(endpoints);
-	}
+    protected List getConfiguredEndpoints() {
+        return asList(endpoints);
+    }
 
 }

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeHelper.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeHelper.java?view=diff&rev=526489&r1=526488&r2=526489
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeHelper.java (original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeHelper.java Sat Apr  7 14:29:14 2007
@@ -28,30 +28,27 @@
  */
 public class ScriptExchangeHelper implements ScriptHelper {
 
-	private ScriptExchangeProcessorEndpoint endpoint;
+    private ScriptExchangeProcessorEndpoint endpoint;
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.servicemix.script.ScriptHelper#setScriptExchangeProcessorEndpoint(org.apache.servicemix.script.ScriptExchangeProcessorEndpoint)
-	 */
-	public void setScriptExchangeProcessorEndpoint(
-			ScriptExchangeProcessorEndpoint endpoint) {
-		this.endpoint = endpoint;
-	}
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.servicemix.script.ScriptHelper#setScriptExchangeProcessorEndpoint(
+     *          org.apache.servicemix.script.ScriptExchangeProcessorEndpoint)
+     */
+    public void setScriptExchangeProcessorEndpoint(ScriptExchangeProcessorEndpoint ep) {
+        this.endpoint = ep;
+    }
 
-	public void doneExchange(MessageExchange exchange)
-			throws MessagingException {
-		endpoint.done(exchange);
-	}
+    public void doneExchange(MessageExchange exchange) throws MessagingException {
+        endpoint.done(exchange);
+    }
 
-	public void failExchange(MessageExchange exchange, Exception exception)
-			throws MessagingException {
-		endpoint.fail(exchange, exception);
-	}
+    public void failExchange(MessageExchange exchange, Exception exception) throws MessagingException {
+        endpoint.fail(exchange, exception);
+    }
 
-	public void sendExchange(MessageExchange exchange)
-			throws MessagingException {
-		endpoint.send(exchange);
-	}
+    public void sendExchange(MessageExchange exchange) throws MessagingException {
+        endpoint.send(exchange);
+    }
 }

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeProcessorEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeProcessorEndpoint.java?view=diff&rev=526489&r1=526488&r2=526489
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeProcessorEndpoint.java (original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptExchangeProcessorEndpoint.java Sat Apr  7 14:29:14 2007
@@ -25,9 +25,8 @@
 import javax.jbi.messaging.DeliveryChannel;
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessageExchangeFactory;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.MessageExchange.Role;
+import javax.jbi.messaging.MessagingException;
 import javax.jbi.servicedesc.ServiceEndpoint;
 
 import org.apache.servicemix.common.BaseLifeCycle;
@@ -37,119 +36,110 @@
 /**
  * @org.apache.xbean.XBean element="exchangeProcessor"
  */
-public class ScriptExchangeProcessorEndpoint extends Endpoint implements
-		ExchangeProcessor {
+public class ScriptExchangeProcessorEndpoint extends Endpoint implements ExchangeProcessor {
 
-	private ServiceEndpoint activated;
+    private ServiceEndpoint activated;
 
-	private DeliveryChannel channel;
+    private DeliveryChannel channel;
 
-	private MessageExchangeFactory exchangeFactory;
+    private ExchangeProcessor implementation;
 
-	private ExchangeProcessor implementation;
-
-	private List helpers = new ArrayList();
-
-	public void activate() throws Exception {
-		logger = this.serviceUnit.getComponent().getLogger();
-		ComponentContext ctx = getServiceUnit().getComponent()
-				.getComponentContext();
-		channel = ctx.getDeliveryChannel();
-		exchangeFactory = channel.createExchangeFactory();
-		activated = ctx.activateEndpoint(service, endpoint);
-		start();
-	}
-
-	public void deactivate() throws Exception {
-		stop();
-		ServiceEndpoint ep = activated;
-		activated = null;
-		ComponentContext ctx = getServiceUnit().getComponent()
-				.getComponentContext();
-		ctx.deactivateEndpoint(ep);
-	}
-
-	protected void done(MessageExchange me) throws MessagingException {
-		me.setStatus(ExchangeStatus.DONE);
-		send(me);
-	}
-
-	protected void fail(MessageExchange me, Exception error)
-			throws MessagingException {
-		me.setError(error);
-		send(me);
-	}
-
-	public List getHelpers() {
-		return helpers;
-	}
-
-	public ExchangeProcessor getImplementation() {
-		return implementation;
-	}
-
-	public ExchangeProcessor getProcessor() {
-		return this;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.servicemix.common.Endpoint#getRole()
-	 */
-	public Role getRole() {
-		return Role.PROVIDER;
-	}
-
-	public void process(MessageExchange exchange) throws Exception {
-		if (implementation != null)
-			implementation.process(exchange);
-
-	}
-
-	protected void send(MessageExchange me) throws MessagingException {
-		if (me.getRole() == MessageExchange.Role.CONSUMER
-				&& me.getStatus() == ExchangeStatus.ACTIVE) {
-			BaseLifeCycle lf = (BaseLifeCycle) getServiceUnit().getComponent()
-					.getLifeCycle();
-			lf.sendConsumerExchange(me, (Endpoint) this);
-		} else {
-			channel.send(me);
-		}
-	}
-
-	public void setHelpers(List helpers) {
-		this.helpers = helpers;
-		for (Iterator iterator = helpers.iterator(); iterator.hasNext();) {
-			Object nextHelper = iterator.next();
-			if (nextHelper instanceof ScriptHelper) {
-				((ScriptHelper) nextHelper)
-						.setScriptExchangeProcessorEndpoint(this);
-			}
-		}
-	}
-
-	public void setImplementation(ExchangeProcessor implementation) {
-		this.implementation = implementation;
-	}
-
-	public void start() throws Exception {
-		if (implementation != null)
-			implementation.start();
-	}
-
-	public void stop() {
-		if (implementation != null) {
-			try {
-				implementation.stop();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
+    private List helpers = new ArrayList();
+
+    public void activate() throws Exception {
+        logger = this.serviceUnit.getComponent().getLogger();
+        ComponentContext ctx = getServiceUnit().getComponent().getComponentContext();
+        channel = ctx.getDeliveryChannel();
+        activated = ctx.activateEndpoint(service, endpoint);
+        start();
+    }
+
+    public void deactivate() throws Exception {
+        stop();
+        ServiceEndpoint ep = activated;
+        activated = null;
+        ComponentContext ctx = getServiceUnit().getComponent().getComponentContext();
+        ctx.deactivateEndpoint(ep);
+    }
+
+    protected void done(MessageExchange me) throws MessagingException {
+        me.setStatus(ExchangeStatus.DONE);
+        send(me);
+    }
+
+    protected void fail(MessageExchange me, Exception error) throws MessagingException {
+        me.setError(error);
+        send(me);
+    }
+
+    public List getHelpers() {
+        return helpers;
+    }
+
+    public ExchangeProcessor getImplementation() {
+        return implementation;
+    }
+
+    public ExchangeProcessor getProcessor() {
+        return this;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.servicemix.common.Endpoint#getRole()
+     */
+    public Role getRole() {
+        return Role.PROVIDER;
+    }
+
+    public void process(MessageExchange exchange) throws Exception {
+        if (implementation != null) {
+            implementation.process(exchange);
+        }
+    }
+
+    protected void send(MessageExchange me) throws MessagingException {
+        if (me.getRole() == MessageExchange.Role.CONSUMER && me.getStatus() == ExchangeStatus.ACTIVE) {
+            BaseLifeCycle lf = (BaseLifeCycle) getServiceUnit().getComponent().getLifeCycle();
+            lf.sendConsumerExchange(me, (Endpoint) this);
+        } else {
+            channel.send(me);
+        }
+    }
+
+    public void setHelpers(List helpers) {
+        this.helpers = helpers;
+        for (Iterator iterator = helpers.iterator(); iterator.hasNext();) {
+            Object nextHelper = iterator.next();
+            if (nextHelper instanceof ScriptHelper) {
+                ((ScriptHelper) nextHelper).setScriptExchangeProcessorEndpoint(this);
+            }
+        }
+    }
+
+    public void setImplementation(ExchangeProcessor implementation) {
+        this.implementation = implementation;
+    }
+
+    public void start() throws Exception {
+        if (implementation != null) {
+            implementation.start();
+        }
+    }
+
+    public void stop() {
+        if (implementation != null) {
+            try {
+                implementation.stop();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
 
-	}
+    }
 
-	public void validate() throws DeploymentException {
-	}
+    public void validate() throws DeploymentException {
+    }
 
 }

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptHelper.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptHelper.java?view=diff&rev=526489&r1=526488&r2=526489
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptHelper.java (original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-script/src/main/java/org/apache/servicemix/script/ScriptHelper.java Sat Apr  7 14:29:14 2007
@@ -18,7 +18,6 @@
 
 public interface ScriptHelper {
 
-	public abstract void setScriptExchangeProcessorEndpoint(
-			ScriptExchangeProcessorEndpoint endpoint);
+    void setScriptExchangeProcessorEndpoint(ScriptExchangeProcessorEndpoint endpoint);
 
 }