synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asan...@apache.org
Subject svn commit: r577399 - in /webservices/synapse/trunk/java/modules/core/src/main: java/org/apache/synapse/ java/org/apache/synapse/config/xml/ java/org/apache/synapse/core/axis2/ java/org/apache/synapse/mediators/eip/ java/org/apache/synapse/mediators/ei...
Date Wed, 19 Sep 2007 17:37:30 GMT
Author: asankha
Date: Wed Sep 19 10:37:29 2007
New Revision: 577399

URL: http://svn.apache.org/viewvc?rev=577399&view=rev
Log:
Fix compilation errors after changes to Constants classes
Refactor ProxyService class with service level log

Modified:
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/EIPUtils.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java
    webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
Wed Sep 19 10:37:29 2007
@@ -109,6 +109,7 @@
     //- tracing and statistics constants -
         /** Tracing logger name */
         public static final String TRACE_LOGGER ="TRACE_LOGGER";
+        public static final String SERVICE_LOGGER_PREFIX ="SERVICE_LOGGER.";
 
         /** The tracing state -off */
         public static final int TRACING_OFF =0;

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java
Wed Sep 19 10:37:29 2007
@@ -46,7 +46,7 @@
     /**
      * This will hold the QName of the clone mediator element in the xml configuration
      */
-    private static final QName CLONE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "clone");
+    private static final QName CLONE_Q = new QName(XMLConfigConstants.SYNAPSE_NAMESPACE,
"clone");
 
     /**
      * This method implements the createMediator method of the MediatorFactory interface
@@ -61,14 +61,14 @@
         initMediator(mediator, elem);
         
         OMAttribute continueParent = elem.getAttribute(new QName(
-                Constants.NULL_NAMESPACE, "continueParent"));
+                XMLConfigConstants.NULL_NAMESPACE, "continueParent"));
         if (continueParent != null) {
             mediator.setContinueParent(
                     Boolean.valueOf(continueParent.getAttributeValue()).booleanValue());
         }
 
         Iterator targetElements = elem.getChildrenWithName(
-                new QName(Constants.SYNAPSE_NAMESPACE, "target"));
+                new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "target"));
         while (targetElements.hasNext()) {
             mediator.addTarget(TargetFactory.createTarget((OMElement) targetElements.next()));
         }

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
Wed Sep 19 10:37:29 2007
@@ -66,13 +66,13 @@
 
     public static ProxyService createProxy(OMElement elem) {
 
-        ProxyService proxy = new ProxyService();
+        ProxyService proxy = null;
 
         OMAttribute name = elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE,
"name"));
         if (name == null) {
             handleException("The 'name' attribute is required for a Proxy service definition");
         } else {
-            proxy.setName(name.getAttributeValue());
+            proxy = new ProxyService(name.getAttributeValue());
         }
 
         OMAttribute statistics = elem.getAttribute(

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetFactory.java
Wed Sep 19 10:37:29 2007
@@ -47,7 +47,7 @@
     /**
      * Holds the QName of the target element in the xml configuration
      */
-    private static final QName TARGET_Q = new QName(Constants.SYNAPSE_NAMESPACE, "target");
+    private static final QName TARGET_Q = new QName(XMLConfigConstants.SYNAPSE_NAMESPACE,
"target");
 
     /**
      * This static method will be used to build the Target from the specified element
@@ -62,38 +62,38 @@
         }
 
         Target target = new Target();
-        OMAttribute toAttr = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "to"));
+        OMAttribute toAttr = elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE,
"to"));
         if (toAttr != null && toAttr.getAttributeValue() != null) {
             target.setTo(toAttr.getAttributeValue());
         }
 
         OMAttribute soapAction = elem.getAttribute(
-                new QName(Constants.NULL_NAMESPACE, "soapAction"));
+                new QName(XMLConfigConstants.NULL_NAMESPACE, "soapAction"));
         if (soapAction != null && soapAction.getAttributeValue() != null) {
             target.setSoapAction(soapAction.getAttributeValue());
         }
 
         OMAttribute sequenceAttr = elem.getAttribute(
-                new QName(Constants.NULL_NAMESPACE, "sequence"));
+                new QName(XMLConfigConstants.NULL_NAMESPACE, "sequence"));
         if (sequenceAttr != null && sequenceAttr.getAttributeValue() != null) {
             target.setSequenceRef(sequenceAttr.getAttributeValue());
         }
 
         OMAttribute endpointAttr = elem.getAttribute(
-                new QName(Constants.NULL_NAMESPACE, "endpoint"));
+                new QName(XMLConfigConstants.NULL_NAMESPACE, "endpoint"));
         if (endpointAttr != null && endpointAttr.getAttributeValue() != null) {
             target.setEndpointRef(endpointAttr.getAttributeValue());
         }
 
         OMElement sequence = elem.getFirstChildWithName(
-                new QName(Constants.SYNAPSE_NAMESPACE, "sequence"));
+                new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "sequence"));
         if (sequence != null) {
             SequenceMediatorFactory fac = new SequenceMediatorFactory();
             target.setSequence(fac.createAnonymousSequence(sequence));
         }
 
         OMElement endpoint = elem.getFirstChildWithName(
-                new QName(Constants.SYNAPSE_NAMESPACE, "endpoint"));
+                new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "endpoint"));
         if (endpoint != null) {
             target.setEndpoint(EndpointAbstractFactory.
                     getEndpointFactroy(endpoint).createEndpoint(endpoint, true));

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TargetSerializer.java
Wed Sep 19 10:37:29 2007
@@ -45,12 +45,12 @@
      * This holds the Synapse namesapce for all the elements (qualified from default)
      */
     private static final OMNamespace synNS
-            = fac.createOMNamespace(Constants.SYNAPSE_NAMESPACE, "syn");
+            = fac.createOMNamespace(XMLConfigConstants.SYNAPSE_NAMESPACE, "syn");
 
     /**
      * This holds the null namespace for all the attributes (unqualified from default)
      */
-    private static final OMNamespace nullNS = fac.createOMNamespace(Constants.NULL_NAMESPACE,
"");
+    private static final OMNamespace nullNS = fac.createOMNamespace(XMLConfigConstants.NULL_NAMESPACE,
"");
 
     /**
      * This static method will serialize the Target object to the target elements

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
Wed Sep 19 10:37:29 2007
@@ -70,6 +70,7 @@
 
     private static final Log log = LogFactory.getLog(ProxyService.class);
     private static final Log trace = LogFactory.getLog(SynapseConstants.TRACE_LOGGER);
+    private final Log serviceLog;
     /**
      * The name of the proxy service
      */
@@ -162,6 +163,17 @@
      */
     protected int traceState = SynapseConstants.TRACING_UNSET;
 
+
+    /**
+     * Constructor
+     *
+     * @param name the name of the Proxy service
+     */
+    public ProxyService(String name) {
+        this.name = name;
+        serviceLog = LogFactory.getLog(SynapseConstants.SERVICE_LOGGER_PREFIX + name);
+    }
+
     /**
      * Build the underlying Axis2 service from the Proxy service definition
      *
@@ -171,9 +183,19 @@
      */
     public AxisService buildAxisService(SynapseConfiguration synCfg, AxisConfiguration axisCfg)
{
 
+        auditInfo("Building Axis service for Proxy service : " + name);
         AxisService proxyService = null;
+
+        // get the wsdlElement as an OMElement
+        if (trace()) {
+            trace.info("Loading the WSDL : " +
+                (wsdlKey != null ? " key = " + wsdlKey :
+                (wsdlURI != null ? " URI = " + wsdlURI : " <Inlined>")));
+        }
+
         InputStream wsdlInputStream = null;
         OMElement wsdlElement = null;
+
         if (wsdlKey != null) {
             synCfg.getEntryDefinition(wsdlKey);
             Object keyObject = synCfg.getEntry(wsdlKey);
@@ -192,21 +214,31 @@
                 handleException("Error reading from wsdl URI", e);
             }
         }
+
+        // if a WSDL was found
         if (wsdlElement != null) {
             OMNamespace wsdlNamespace = wsdlElement.getNamespace();
+
+            // serialize and create an inputstream to read WSDL
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             try {
+                if (trace()) trace.info("Serializing wsdlElement found to build Axis service");
                 wsdlElement.serialize(baos);
                 wsdlInputStream = new ByteArrayInputStream(baos.toByteArray());
             } catch (XMLStreamException e) {
                 handleException("Error converting to a StreamSource", e);
             }
+
             if (wsdlInputStream != null) {
+
                 try {
                     // detect version of the WSDL 1.1 or 2.0
+                    if (trace()) trace.info("WSDL Namespace is : " + wsdlNamespace);
+
                     if (wsdlNamespace != null) {
                         boolean isWSDL11 = false;
                         WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
+
                         if (WSDL2Constants.WSDL_NAMESPACE.
                                 equals(wsdlNamespace.getNamespaceURI())) {
                             wsdlToAxisServiceBuilder =
@@ -226,6 +258,13 @@
                             throw new SynapseException(
                                     "Could not get the WSDL to Axis Service Builder");
                         }
+
+                        if (trace()) {
+                            trace.info("Populating Axis service using WSDL");
+                            if (trace.isTraceEnabled()) {
+                                trace.trace("WSDL : " + wsdlElement.toString());
+                            }
+                        }
                         proxyService = wsdlToAxisServiceBuilder.populateService();
                         proxyService.setWsdlFound(true);
 
@@ -259,9 +298,9 @@
         } else {
             // this is for POX... create a dummy service and an operation for which
             // our SynapseDispatcher will properly dispatch to
+            if (trace()) trace.info("Did not find a WSDL. Assuming a POX or Legacy service");
             proxyService = new AxisService();
-            AxisOperation mediateOperation =
-                    new InOutAxisOperation(new QName("mediate"));
+            AxisOperation mediateOperation = new InOutAxisOperation(new QName("mediate"));
             proxyService.addOperation(mediateOperation);
         }
 
@@ -281,10 +320,12 @@
         if (transports == null || transports.size() == 0) {
             // default to all transports using service name as destination
         } else {
+            if (trace()) trace.info("Exposing transports : " + transports);
             proxyService.setExposedTransports(transports);
         }
 
         // process parameters
+        if (trace()) trace.info("Setting service parameters : " + parameters);
         Iterator iter = parameters.keySet().iterator();
         while (iter.hasNext()) {
             String name = (String) iter.next();
@@ -302,30 +343,35 @@
             }
         }
 
+        if (trace()) trace.info("Seeting service level policies : " + serviceLevelPolicies);
         // if service level policies are specified, apply them
+
         if (!serviceLevelPolicies.isEmpty()) {
             Policy svcEffectivePolicy = null;
             iter = serviceLevelPolicies.iterator();
+
             while (iter.hasNext()) {
                 String policyKey = (String) iter.next();
                 synCfg.getEntryDefinition(policyKey);
                 Object policyProp = synCfg.getEntry(policyKey);
                 if (policyProp != null) {
                     if (svcEffectivePolicy == null) {
-
                         svcEffectivePolicy = PolicyEngine.getPolicy(
-                                Util.getStreamSource(policyProp).getInputStream());
+                            Util.getStreamSource(policyProp).getInputStream());
                     } else {
                         svcEffectivePolicy = (Policy) svcEffectivePolicy.merge(
-                                PolicyEngine.getPolicy(
-                                        Util.getStreamSource(policyProp).getInputStream()));
+                            PolicyEngine.getPolicy(Util.getStreamSource(policyProp).getInputStream()));
                     }
                 }
             }
             PolicyInclude pi = proxyService.getPolicyInclude();
             if (pi != null && svcEffectivePolicy != null) {
+                if (trace()) {
+                    if (trace.isTraceEnabled()) {
+                        trace.trace("Effective policy applied : " + svcEffectivePolicy);
+                    }
+                }
                 pi.addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY, svcEffectivePolicy);
-                // todo: check whether the rm or sec is enabled
             }
         }
 
@@ -340,11 +386,14 @@
         }
 
         try {
+            auditInfo("Adding service " + name + "to the Axis2 configuration");
             axisCfg.addService(proxyService);
             this.setRunning(true);
         } catch (AxisFault axisFault) {
             try {
                 if (axisCfg.getService(proxyService.getName()) != null) {
+                    if (trace()) trace.info("Removing service " + name + " due to error :
"
+                        + axisFault.getMessage());
                     axisCfg.removeService(proxyService.getName());
                 }
             } catch (AxisFault ignore) {}
@@ -354,9 +403,10 @@
         // todo: need to remove this and engage modules by looking at policies
         // should RM be engaged on this service?
         if (wsRMEnabled) {
+            auditInfo("WS-Reliable messaging is enabled for service : " + name);
             try {
                 proxyService.engageModule(axisCfg.getModule(
-                        SynapseConstants.SANDESHA2_MODULE_NAME), axisCfg);
+                    SynapseConstants.SANDESHA2_MODULE_NAME), axisCfg);
             } catch (AxisFault axisFault) {
                 handleException("Error loading WS RM module on proxy service : " + name,
axisFault);
             }
@@ -364,43 +414,107 @@
 
         // should Security be engaged on this service?
         if (wsSecEnabled) {
+            auditInfo("WS-Security is enabled for service : " + name);
             try {
                 proxyService.engageModule(axisCfg.getModule(
-                        SynapseConstants.RAMPART_MODULE_NAME), axisCfg);
+                    SynapseConstants.RAMPART_MODULE_NAME), axisCfg);
             } catch (AxisFault axisFault) {
                 handleException("Error loading WS Sec module on proxy service : "
                         + name, axisFault);
             }
         }
 
+        auditInfo("Successfully created the Axis2 service for Proxy service : " + name);
         return proxyService;
     }
 
+    /**
+     * Start the proxy service
+     * @param synCfg the synapse configuration
+     */
     public void start(SynapseConfiguration synCfg) {
         AxisConfiguration axisConfig = synCfg.getAxisConfiguration();
-        axisConfig.getServiceForActivation(this.getName()).setActive(true);
-        this.setRunning(true);
+        if (axisConfig != null) {
+            axisConfig.getServiceForActivation(this.getName()).setActive(true);
+            this.setRunning(true);
+            auditInfo("Started the proxy service : " + name);
+        } else {
+            auditWarn("Unable to start proxy service : " + name + 
+                ". Couldn't access Axis configuration");
+        }
     }
 
+    /**
+     * Stop the proxy service
+     * @param synCfg the synapse configuration
+     */
     public void stop(SynapseConfiguration synCfg) {
         AxisConfiguration axisConfig = synCfg.getAxisConfiguration();
-        try {
-            AxisService as = axisConfig.getService(this.getName());
-            if (as != null) {
-                as.setActive(false);
+        if (axisConfig != null) {
+            try {
+                AxisService as = axisConfig.getService(this.getName());
+                if (as != null) {
+                    as.setActive(false);
+                }
+                this.setRunning(false);
+                auditInfo("Started the proxy service : " + name);
+            } catch (AxisFault axisFault) {
+                handleException("Error stopping the proxy service : " + name, axisFault);
             }
-            this.setRunning(false);
-        } catch (AxisFault axisFault) {
-            handleException(axisFault.getMessage());
+        } else {
+            auditWarn("Unable to stop proxy service : " + name +
+                ". Couldn't access Axis configuration");
         }
     }
 
-    public String getName() {
-        return name;
+    private void handleException(String msg) {
+        serviceLog.error(msg);
+        log.error(msg);
+        if (trace()) trace.error(msg);
+        throw new SynapseException(msg);
     }
 
-    public void setName(String name) {
-        this.name = name;
+    private void handleException(String msg, Exception e) {
+        serviceLog.error(msg);
+        log.error(msg, e);
+        if (trace()) trace.error(msg + " :: " + e.getMessage());
+        throw new SynapseException(msg, e);
+    }
+
+    /**
+     * Write to the general log, as well as any service specific logs the audit message at
INFO
+     * @param message the INFO level audit message
+     */
+    private void auditInfo(String message) {
+        log.info(message);
+        serviceLog.info(message);
+        if (trace()) {
+            trace.info(message);
+        }
+    }
+
+    /**
+     * Write to the general log, as well as any service specific logs the audit message at
WARN
+     * @param message the WARN level audit message
+     */
+    private void auditWarn(String message) {
+        log.warn(message);
+        serviceLog.warn(message);
+        if (trace()) {
+            trace.warn(message);
+        }
+    }
+
+    /**
+     * Return true if tracing should be enabled
+     * @return true if tracing is enabled for this service
+     */
+    private boolean trace() {
+        return traceState == SynapseConstants.TRACING_ON;
+    }
+
+    public String getName() {
+        return name;
     }
 
     public String getDescription() {
@@ -497,16 +611,6 @@
 
     public void setRunning(boolean running) {
         this.running = running;
-    }
-
-    private static void handleException(String msg) {
-        log.error(msg);
-        throw new SynapseException(msg);
-    }
-
-    private static void handleException(String msg, Exception e) {
-        log.error(msg, e);
-        throw new SynapseException(msg, e);
     }
 
     /**

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
Wed Sep 19 10:37:29 2007
@@ -29,7 +29,7 @@
 import org.apache.log4j.MDC;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
-import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseConstants;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.config.SynapseConfigurationBuilder;
@@ -98,7 +98,7 @@
 
         log.info("Initializing Sandesha 2...");
         AxisModule sandeshaAxisModule = configurationContext.getAxisConfiguration().
-            getModule(Constants.SANDESHA2_MODULE_NAME);
+            getModule(SynapseConstants.SANDESHA2_MODULE_NAME);
         if (sandeshaAxisModule != null) {
             Module sandesha2 = sandeshaAxisModule.getModule();
             sandesha2.init(configurationContext, sandeshaAxisModule);
@@ -127,16 +127,16 @@
         AxisConfiguration axisConfiguration = cfgCtx.getAxisConfiguration();
         SynapseConfiguration synapseConfiguration;
 
-        String config = System.getProperty(Constants.SYNAPSE_XML);
+        String config = System.getProperty(SynapseConstants.SYNAPSE_XML);
 
         if (config != null) {
             if (log.isDebugEnabled()) {
-                log.debug("System property '" + Constants.SYNAPSE_XML +
+                log.debug("System property '" + SynapseConstants.SYNAPSE_XML +
                         "' specifies synapse configuration as " + config);
             }
             synapseConfiguration = SynapseConfigurationBuilder.getConfiguration(config);
         } else {
-            log.warn("System property '" + Constants.SYNAPSE_XML +
+            log.warn("System property '" + SynapseConstants.SYNAPSE_XML +
                 "' is not specified. Using default configuration..");
             synapseConfiguration = SynapseConfigurationBuilder.getDefaultConfiguration();
         }
@@ -145,11 +145,11 @@
         synapseConfiguration.setAxisConfiguration(cfgCtx.getAxisConfiguration());
 
         // set the Synapse configuration and environment into the Axis2 configuration
-        Parameter synapseCtxParam = new Parameter(Constants.SYNAPSE_CONFIG, null);
+        Parameter synapseCtxParam = new Parameter(SynapseConstants.SYNAPSE_CONFIG, null);
         synapseCtxParam.setValue(synapseConfiguration);
         MessageContextCreatorForAxis2.setSynConfig(synapseConfiguration);
 
-        Parameter synapseEnvParam = new Parameter(Constants.SYNAPSE_ENV, null);
+        Parameter synapseEnvParam = new Parameter(SynapseConstants.SYNAPSE_ENV, null);
         Axis2SynapseEnvironment synEnv = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
         synapseEnvParam.setValue(synEnv);
         MessageContextCreatorForAxis2.setSynEnv(synEnv);
@@ -160,8 +160,8 @@
 
         } catch (AxisFault e) {
             String msg =
-                "Could not set parameters '" + Constants.SYNAPSE_CONFIG +
-                    "' and/or '" + Constants.SYNAPSE_ENV +
+                "Could not set parameters '" + SynapseConstants.SYNAPSE_CONFIG +
+                    "' and/or '" + SynapseConstants.SYNAPSE_ENV +
                     "'to the Axis2 configuration : " + e.getMessage();
             log.fatal(msg, e);
             throw new SynapseException(msg, e);

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/EIPUtils.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/EIPUtils.java?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/EIPUtils.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/EIPUtils.java
Wed Sep 19 10:37:29 2007
@@ -28,7 +28,6 @@
 import org.apache.axis2.AxisFault;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.Constants;
 import org.apache.synapse.MessageContext;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.core.axis2.Axis2MessageContext;
@@ -43,6 +42,8 @@
  */
 public class EIPUtils {
 
+    public static final String AGGREGATE_CORELATION = "aggregateCorelation";
+    
     /**
      * This will be used for logging purposes
      */
@@ -120,7 +121,7 @@
             }
 
             // set the parent details to the splitted MC 
-            newCtx.setProperty(Constants.AGGREGATE_CORELATION, synCtx.getMessageID());
+            newCtx.setProperty(AGGREGATE_CORELATION, synCtx.getMessageID());
 
             // set the parent properties to the splitted MC
             newCtx.setTo(synCtx.getTo());

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java
Wed Sep 19 10:37:29 2007
@@ -19,24 +19,15 @@
 
 package org.apache.synapse.mediators.eip.splitter;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.MessageContext;
 import org.apache.synapse.mediators.AbstractMediator;
-import org.apache.synapse.mediators.base.SequenceMediator;
 import org.apache.synapse.mediators.eip.EIPUtils;
 import org.apache.synapse.mediators.eip.Target;
-import org.apache.synapse.MessageContext;
-import org.apache.synapse.Constants;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.endpoints.Endpoint;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
-import javax.xml.namespace.QName;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * This mediator will clone the message in to different messages and mediated as specified
in
@@ -44,6 +35,9 @@
  */
 public class CloneMediator extends AbstractMediator {
 
+    private static final String MESSAGE_SEQUENCE = "messageSequence";
+    private static final String MESSAGE_SEQUENCE_DELEMITER = "/";
+
     /**
      * This will hold the logger which is used for logging purposes
      */
@@ -63,45 +57,45 @@
     /**
      * This will implement the mediate method of the Mediator interface and will provide
the
      * functionality of cloning message in to the specified targets and mediation
-     * 
+     *
      * @param synCtx - MessageContext which is subjected to the cloning
      * @return boolean true if this needs to be further mediated (continueParent=true)
-     *  false otherwise
+     *         false otherwise
      */
     public boolean mediate(MessageContext synCtx) {
-        
+
         if (targets.size() != 0) {
-            
-            for (int i=0; i<targets.size(); i++) {
+
+            for (int i = 0; i < targets.size(); i++) {
                 MessageContext newContext = getClonedMessageContext(synCtx, i, targets.size());
                 Object o = targets.get(i);
-                
+
                 if (o instanceof Target) {
                     Target target = (Target) o;
                     target.mediate(newContext);
                 }
             }
         }
-        
+
         return continueParent;
     }
 
     /**
      * This private method is used to clone the MC in to a new MC
-     * 
-     * @param synCtx - MessageContext which is subjected to the clonning
+     *
+     * @param synCtx          - MessageContext which is subjected to the clonning
      * @param messageSequence - int clonning message number
-     * @param messageCount - int complete count of cloned messages
+     * @param messageCount    - int complete count of cloned messages
      * @return MessageContext which is cloned from the given parameters
      */
     private MessageContext getClonedMessageContext(MessageContext synCtx,
-                                                   int messageSequence, int messageCount)
{
-        
+        int messageSequence, int messageCount) {
+
         MessageContext newCtx = EIPUtils.createNewMessageContext(synCtx, synCtx.getEnvelope());
 
         // Sets the property MESSAGE_SEQUENCE to the MC for aggragation purposes 
-        newCtx.setProperty(Constants.MESSAGE_SEQUENCE, String.valueOf(messageSequence)
-                + Constants.MESSAGE_SEQUENCE_DELEMITER + messageCount);
+        newCtx.setProperty(MESSAGE_SEQUENCE, String.valueOf(messageSequence)
+            + MESSAGE_SEQUENCE_DELEMITER + messageCount);
 
         return newCtx;
     }

Modified: webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties?rev=577399&r1=577398&r2=577399&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties Wed Sep
19 10:37:29 2007
@@ -19,7 +19,11 @@
 
 log4j.rootCategory=ERROR,logfile,stdout
 
-log4j.logger.TRACE_LOGGER = TRACE,TRACE_APPENDER
+# The trace logger runs at TRACE level by default, and appends to the TRACE_APPENDER
+log4j.logger.TRACE_LOGGER=TRACE, TRACE_APPENDER
+
+# The service logger runs at INFO level by default, and appends to the SERVICE_APPENDER for
all services
+log4j.logger.SERVICE_LOGGER=INFO, SERVICE_APPENDER
 
 # TRACE_LOGFILE is set to be a DailyRollingFileAppender using a PatternLayout.
 log4j.appender.TRACE_APPENDER=org.apache.log4j.DailyRollingFileAppender



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message