synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruwan Linton <ruwan.lin...@gmail.com>
Subject Re: svn commit: r753144 - in /synapse/trunk/java/modules: core/src/main/java/org/apache/synapse/mediators/builtin/ core/src/main/java/org/apache/synapse/mediators/db/ core/src/main/java/org/apache/synapse/mediators/eip/aggregator/ core/src/main/java/
Date Fri, 13 Mar 2009 17:20:25 GMT
Indika,

Why does AbstractMediator implements the ManagedLifecycle? does this means
that all the mediators have init and destroy methods?

Thanks,
Ruwan

2009/3/13 <indika@apache.org>

> Author: indika
> Date: Fri Mar 13 07:16:16 2009
> New Revision: 753144
>
> URL: http://svn.apache.org/viewvc?rev=753144&view=rev
> Log:
> remove ManagedLifecycle from mediators that extends AbstractMediator as
> AbstractMediator already implements ManagedLifecycle
>
> Modified:
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CacheMediator.java
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/aggregator/AggregateMediator.java
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/IterateMediator.java
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java
>
>  synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/SwitchMediator.java
>
>  synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/eip/SplitTestHelperMediator.java
>
>  synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java
>
>  synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/spring/SpringMediator.java
>
>  synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CacheMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CacheMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CacheMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CacheMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -24,7 +24,6 @@
>  import org.apache.axis2.clustering.context.Replicator;
>  import org.apache.axis2.context.ConfigurationContext;
>  import org.apache.axis2.saaj.util.SAAJUtil;
> -import org.apache.synapse.ManagedLifecycle;
>  import org.apache.synapse.MessageContext;
>  import org.apache.synapse.SynapseException;
>  import org.apache.synapse.SynapseLog;
> @@ -58,7 +57,7 @@
>  *
>  * @see org.apache.synapse.Mediator
>  */
> -public class CacheMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class CacheMediator extends AbstractMediator {
>
>     private String id = null;
>     private String scope = CachingConstants.SCOPE_PER_HOST;// global
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -23,15 +23,14 @@
>  import org.apache.axiom.om.OMNode;
>  import org.apache.axis2.AxisFault;
>  import org.apache.axis2.Constants;
> -import org.apache.axis2.transport.http.HTTPConstants;
> -import org.apache.axis2.description.Parameter;
>  import org.apache.axis2.addressing.AddressingConstants;
>  import org.apache.axis2.addressing.EndpointReference;
>  import org.apache.axis2.client.Options;
>  import org.apache.axis2.client.ServiceClient;
>  import org.apache.axis2.context.ConfigurationContext;
>  import org.apache.axis2.context.ConfigurationContextFactory;
> -import org.apache.synapse.ManagedLifecycle;
> +import org.apache.axis2.description.Parameter;
> +import org.apache.axis2.transport.http.HTTPConstants;
>  import org.apache.synapse.MessageContext;
>  import org.apache.synapse.SynapseException;
>  import org.apache.synapse.SynapseLog;
> @@ -51,7 +50,7 @@
>  *      <target xpath="expression" | key="string"/>
>  * </callout>
>  */
> -public class CalloutMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class CalloutMediator extends AbstractMediator {
>
>     private ServiceClient sc = null;
>     private String serviceURL = null;
> @@ -179,6 +178,7 @@
>         return null;
>     }
>
> +    @Override
>     public void init(SynapseEnvironment synEnv) {
>         try {
>             ConfigurationContext cfgCtx
> @@ -193,6 +193,7 @@
>         }
>     }
>
> +    @Override
>     public void destroy() {
>         try {
>             sc.cleanup();
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -21,7 +21,6 @@
>
>  import org.apache.commons.dbcp.BasicDataSource;
>  import org.apache.commons.dbcp.datasources.PerUserPoolDataSource;
> -import org.apache.synapse.ManagedLifecycle;
>  import org.apache.synapse.MessageContext;
>  import org.apache.synapse.SynapseException;
>  import org.apache.synapse.SynapseLog;
> @@ -34,13 +33,15 @@
>  import javax.xml.namespace.QName;
>  import java.math.BigDecimal;
>  import java.sql.*;
> -import java.sql.Date;
> -import java.util.*;
> +import java.util.ArrayList;
> +import java.util.HashMap;
> +import java.util.List;
> +import java.util.Map;
>
>  /**
>  * This abstract DB mediator will perform common DB connection pooling etc.
> for all DB mediators
>  */
> -public abstract class AbstractDBMediator extends AbstractMediator
> implements ManagedLifecycle {
> +public abstract class AbstractDBMediator extends AbstractMediator {
>
>     /** Hold JDBC properties */
>     protected final Map dataSourceProps = new HashMap();
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/aggregator/AggregateMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/aggregator/AggregateMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/aggregator/AggregateMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/aggregator/AggregateMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -23,7 +23,6 @@
>  import org.apache.axiom.soap.SOAP12Constants;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> -import org.apache.synapse.ManagedLifecycle;
>  import org.apache.synapse.MessageContext;
>  import org.apache.synapse.SynapseLog;
>  import org.apache.synapse.core.SynapseEnvironment;
> @@ -48,7 +47,7 @@
>  * so that aggregations that never would complete could be timed out and
> cleared from memory and
>  * any fault conditions handled
>  */
> -public class AggregateMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class AggregateMediator extends AbstractMediator {
>
>     private static final Log log =
> LogFactory.getLog(AggregateMediator.class);
>
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -19,23 +19,23 @@
>
>  package org.apache.synapse.mediators.eip.splitter;
>
> -import org.apache.synapse.MessageContext;
> +import org.apache.axis2.AxisFault;
> +import org.apache.axis2.Constants;
> +import org.apache.axis2.context.OperationContext;
>  import org.apache.synapse.ManagedLifecycle;
> +import org.apache.synapse.MessageContext;
>  import org.apache.synapse.SynapseLog;
> -import org.apache.synapse.endpoints.Endpoint;
> -import org.apache.synapse.core.axis2.Axis2MessageContext;
>  import org.apache.synapse.core.SynapseEnvironment;
> -import org.apache.synapse.util.MessageHelper;
> +import org.apache.synapse.core.axis2.Axis2MessageContext;
> +import org.apache.synapse.endpoints.Endpoint;
>  import org.apache.synapse.mediators.AbstractMediator;
> -import org.apache.synapse.mediators.eip.Target;
>  import org.apache.synapse.mediators.eip.EIPConstants;
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.Constants;
> -import org.apache.axis2.context.OperationContext;
> +import org.apache.synapse.mediators.eip.Target;
> +import org.apache.synapse.util.MessageHelper;
>
>  import java.util.ArrayList;
> -import java.util.List;
>  import java.util.Iterator;
> +import java.util.List;
>
>  /**
>  * This mediator will clone the message into multiple messages and mediate
> as specified in the
> @@ -43,7 +43,7 @@
>  * specifies an Action and/or To address to be set to the cloned message.
> The number of cloned
>  * messages created is the number of targets specified
>  */
> -public class CloneMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class CloneMediator extends AbstractMediator {
>
>     /**
>      * Continue processing the parent message or not?
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/IterateMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/IterateMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/IterateMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/IterateMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -28,9 +28,9 @@
>  import org.apache.synapse.ManagedLifecycle;
>  import org.apache.synapse.MessageContext;
>  import org.apache.synapse.SynapseLog;
> -import org.apache.synapse.endpoints.Endpoint;
>  import org.apache.synapse.core.SynapseEnvironment;
>  import org.apache.synapse.core.axis2.Axis2MessageContext;
> +import org.apache.synapse.endpoints.Endpoint;
>  import org.apache.synapse.mediators.AbstractMediator;
>  import org.apache.synapse.mediators.eip.EIPConstants;
>  import org.apache.synapse.mediators.eip.EIPUtils;
> @@ -47,7 +47,7 @@
>  * each resulting element. This is very much similar to the clone mediator,
> and
>  * hands over the newly created messages to a target for processing
>  */
> -public class IterateMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class IterateMediator extends AbstractMediator {
>
>     /** Continue mediation on the parent message or not? */
>     private boolean continueParent = false;
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -19,11 +19,7 @@
>
>  package org.apache.synapse.mediators.ext;
>
> -import org.apache.synapse.ManagedLifecycle;
> -import org.apache.synapse.Mediator;
> -import org.apache.synapse.MessageContext;
> -import org.apache.synapse.SynapseException;
> -import org.apache.synapse.SynapseLog;
> +import org.apache.synapse.*;
>  import org.apache.synapse.core.SynapseEnvironment;
>  import org.apache.synapse.mediators.AbstractMediator;
>
> @@ -41,7 +37,7 @@
>  *
>  * @see Mediator
>  */
> -public class ClassMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class ClassMediator extends AbstractMediator {
>
>     /** The reference to the actual class that implments the Mediator
> interface */
>     private Mediator mediator = null;
>
> Modified:
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/SwitchMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/SwitchMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/SwitchMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/SwitchMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -36,7 +36,7 @@
>  * the given list of cases. This is actually a list of sequences, and
> depending on the
>  * selected case, the selected sequence gets executed.
>  */
> -public class SwitchMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class SwitchMediator extends AbstractMediator {
>
>     /** The XPath expression specifying the source element to apply the
> switch case expressions against   */
>     private SynapseXPath source = null;
>
> Modified:
> synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/eip/SplitTestHelperMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/eip/SplitTestHelperMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/eip/SplitTestHelperMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/eip/SplitTestHelperMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -1,21 +1,20 @@
>  package org.apache.synapse.mediators.eip;
>
> -import org.apache.synapse.mediators.AbstractMediator;
> -import org.apache.synapse.MessageContext;
> -import org.apache.synapse.ManagedLifecycle;
> -import org.apache.synapse.core.SynapseEnvironment;
> -import org.apache.axiom.soap.SOAPEnvelope;
>  import org.apache.axiom.om.OMAbstractFactory;
> +import org.apache.axiom.soap.SOAPEnvelope;
>  import org.apache.axis2.AxisFault;
> +import org.apache.synapse.MessageContext;
> +import org.apache.synapse.core.SynapseEnvironment;
> +import org.apache.synapse.mediators.AbstractMediator;
>
> -import java.util.List;
>  import java.util.ArrayList;
> +import java.util.List;
>
>  /**
>  * Created by IntelliJ IDEA. User: ruwan Date: Oct 3, 2007 Time: 7:26:09 AM
> To change this template
>  * use File | Settings | File Templates.
>  */
> -public class SplitTestHelperMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class SplitTestHelperMediator extends AbstractMediator {
>
>     private List mediatedContext = new ArrayList();
>     int msgcount;
>
> Modified:
> synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java
> (original)
> +++
> synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -20,8 +20,6 @@
>  package org.apache.synapse.mediators.ext;
>
>  import org.apache.synapse.MessageContext;
> -import org.apache.synapse.Mediator;
> -import org.apache.synapse.ManagedLifecycle;
>  import org.apache.synapse.core.SynapseEnvironment;
>  import org.apache.synapse.mediators.AbstractMediator;
>
> @@ -30,7 +28,7 @@
>  * use a static member variable just to test this.. This class is not
> nice.. :-)
>  * but does what is expected... :-(
>  */
> -public class ClassMediatorTestMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class ClassMediatorTestMediator extends AbstractMediator {
>
>     public static boolean invoked = false;
>     public static boolean initialized = false;
>
> Modified:
> synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/spring/SpringMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/spring/SpringMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/spring/SpringMediator.java
> (original)
> +++
> synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/spring/SpringMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -19,15 +19,14 @@
>
>  package org.apache.synapse.mediators.spring;
>
> -import org.apache.synapse.MessageContext;
>  import org.apache.synapse.Mediator;
> -import org.apache.synapse.ManagedLifecycle;
> +import org.apache.synapse.MessageContext;
>  import org.apache.synapse.SynapseException;
>  import org.apache.synapse.SynapseLog;
> +import org.apache.synapse.config.Entry;
> +import org.apache.synapse.config.SynapseConfigUtils;
>  import org.apache.synapse.core.SynapseEnvironment;
>  import org.apache.synapse.mediators.AbstractMediator;
> -import org.apache.synapse.config.SynapseConfigUtils;
> -import org.apache.synapse.config.Entry;
>  import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
>  import org.springframework.context.ApplicationContext;
>  import org.springframework.context.support.GenericApplicationContext;
> @@ -41,7 +40,7 @@
>  * refers to a Spring bean name, and also either a Spring configuration
> defined to Synapse
>  * or an inlined Spring configuration.
>  */
> -public class SpringMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class SpringMediator extends AbstractMediator {
>
>     /**
>      * The Spring bean ref to be used
>
> Modified:
> synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
> URL:
> http://svn.apache.org/viewvc/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java?rev=753144&r1=753143&r2=753144&view=diff
>
> ==============================================================================
> ---
> synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
> (original)
> +++
> synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
> Fri Mar 13 07:16:16 2009
> @@ -19,20 +19,20 @@
>  package org.apache.synapse.mediators.throttle;
>
>  import org.apache.axiom.om.OMElement;
> +import org.apache.axis2.clustering.ClusterManager;
> +import org.apache.axis2.clustering.ClusteringFault;
> +import org.apache.axis2.clustering.context.Replicator;
> +import org.apache.axis2.context.ConfigurationContext;
>  import org.apache.neethi.PolicyEngine;
>  import org.apache.synapse.ManagedLifecycle;
>  import org.apache.synapse.Mediator;
>  import org.apache.synapse.MessageContext;
>  import org.apache.synapse.SynapseLog;
> -import org.apache.synapse.transport.nhttp.NhttpConstants;
>  import org.apache.synapse.config.Entry;
>  import org.apache.synapse.core.SynapseEnvironment;
>  import org.apache.synapse.core.axis2.Axis2MessageContext;
>  import org.apache.synapse.mediators.AbstractMediator;
> -import org.apache.axis2.context.ConfigurationContext;
> -import org.apache.axis2.clustering.context.Replicator;
> -import org.apache.axis2.clustering.ClusteringFault;
> -import org.apache.axis2.clustering.ClusterManager;
> +import org.apache.synapse.transport.nhttp.NhttpConstants;
>  import org.wso2.throttle.*;
>
>
> @@ -42,7 +42,7 @@
>  * Only support IP based throttling- Throotling can manage per IP using the
> throttle policy
>  */
>
> -public class ThrottleMediator extends AbstractMediator implements
> ManagedLifecycle {
> +public class ThrottleMediator extends AbstractMediator {
>
>     /* The key for getting the throttling policy - key refers to a/an
> [registry] entry    */
>     private String policyKey = null;
>
>
>


-- 
Ruwan Linton
Senior Software Engineer & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Mime
View raw message