synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r387760 [1/4] - in /incubator/synapse/trunk/scratch/infravio: Mediators-NoSynapseObject/ Mediators-NoSynapseObject/org/ Mediators-NoSynapseObject/org/apache/ Mediators-NoSynapseObject/org/apache/synapse/ Mediators-NoSynapseObject/org/apache...
Date Wed, 22 Mar 2006 06:54:23 GMT
Author: vikas
Date: Tue Mar 21 22:54:17 2006
New Revision: 387760

URL: http://svn.apache.org/viewcvs?rev=387760&view=rev
Log:
Going along the suggestions put up in the mailing list...
Here are the mediators under-development.

Added:
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/DISCLAIMER.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfiguration.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfigurator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationMediator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationRule.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/services.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/CallService.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfiguration.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfigurator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverMediator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverRule.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/failover.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/services.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfiguration.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfigurator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingMediator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingRule.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/META-INF/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/META-INF/loadbalancing.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/META-INF/services.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/META-INF/
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/META-INF/services.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/META-INF/sla.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/SLAConfigurator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/SLAConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/SLAMediator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/SLAObject.java
    incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/sla/SLAStack.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/DISCLAIMER.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/ci/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/ci/CIConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/ci/CIMediator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/ci/META-INF/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/ci/META-INF/ci.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/ci/META-INF/services.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/ci/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/deprecation/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/deprecation/DeprecationMediator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/deprecation/META-INF/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/deprecation/META-INF/services.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/deprecation/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/failover/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/failover/CallService.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/failover/FailoverConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/failover/FailoverMediator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/failover/META-INF/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/failover/META-INF/failover.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/failover/META-INF/services.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/failover/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/loadbalancing/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingMediator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/loadbalancing/META-INF/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/loadbalancing/META-INF/loadbalancing.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/loadbalancing/META-INF/services.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/loadbalancing/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/META-INF/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/META-INF/services.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/META-INF/sla.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/SLAConfigurator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/SLAConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/SLAMediator.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/SLAObject.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/mediators/sla/SLAStack.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/GenericObject.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/OMUtil.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/Sample.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/SynapseObject.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/SynapseObjectArray.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/TestOMElementSo.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/TestSample.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/UtilConstants.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/org/apache/synapse/synapseobject/Utils.java
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/ci_mediator/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/ci_mediator/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/ci_mediator/build.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/ci_mediator/synapse.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/failover_mediator/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/failover_mediator/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/failover_mediator/build.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/failover_mediator/synapse.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/loadbalancing_mediator/
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/loadbalancing_mediator/README.txt
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/loadbalancing_mediator/build.xml
    incubator/synapse/trunk/scratch/infravio/Mediators-SynapseObject/scripts/loadbalancing_mediator/synapse.xml

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/DISCLAIMER.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/DISCLAIMER.txt?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/DISCLAIMER.txt (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/DISCLAIMER.txt Tue Mar 21 22:54:17 2006
@@ -0,0 +1,10 @@
+Hello everyone,
+
+Since this is a scratch area, the code committed might break or may not be feature complete.. 
+
+Have not been updated since effort was on to get SynapseObject going...
+
+Feel free to comment and make suggestions..
+
+Keeping in-line with the ASF way of developing code :-)
+

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/README.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/README.txt?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/README.txt (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/README.txt Tue Mar 21 22:54:17 2006
@@ -0,0 +1,13 @@
+Hello everyone,
+
+
+The code here deals with some of the mediators under development...
+
+* Deprecation
+* Failover
+* Loadbalancing
+* SLA
+
+Feel free to comment and make suggestions..
+
+

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfiguration.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfiguration.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfiguration.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.deprecation;
+
+public class DeprecationConfiguration {
+
+    private DeprecationRule rules[] = new DeprecationRule[0];
+    private String enabled;
+
+    public DeprecationConfiguration() {
+    }
+
+    public void addRule(DeprecationRule rule) {
+        DeprecationRule tmp[] = new DeprecationRule[rules.length + 1];
+        for (int i = 0; i < rules.length; i++) {
+            tmp[i] = rules[i];
+        }
+        tmp[rules.length] = rule;
+        this.rules = tmp;
+    }
+
+    public void removeRule() {
+        if (rules.length == 0)
+            return;
+        DeprecationRule tmp[] = new DeprecationRule[rules.length - 1];
+        for (int i = 0; i < rules.length - 1; i++) {
+            tmp[i] = rules[i];
+        }
+        this.rules = tmp;
+    }
+
+    public boolean hasRule(String service) {
+        for (int i = 0; i < rules.length; i++) {
+            if (rules[i].getService().equals(service)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public DeprecationRule[] getRules() {
+        return rules;
+    }
+
+    public void setEnabled(String enabled) {
+        this.enabled = enabled;
+    }
+
+    public String getEnabled() {
+        return this.enabled;
+    }
+
+}
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfigurator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfigurator.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfigurator.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConfigurator.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.deprecation;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+
+import javax.xml.namespace.QName;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class DeprecationConfigurator {
+
+    /*
+    *** MAP STRUCTURE ***
+    The config map contains the parameter-sets for all the services and also a default
+    parameter set. The key to this map is the endPoint reference of the service and the
+    value associated with it is the parameter map corresponding to it.
+
+    <deprecationConfig>
+        <service Id = "the serviceEPR">
+                <parameterSet>
+                    <fromDate>value</fromDate>
+                    <toDate>value</toDate>
+                </parameterSet>
+                <parameterSet>
+                    <fromDate>value</fromDate>
+                    <toDate>value</toDate>
+                </parameterSet>*
+        </service>*
+    </deprecationConfig>
+
+    This should map to
+    key is ("serviceEPR")
+    value is (map of parameterSet) i.e.
+        map with key (parameter name), value (parameter value).
+    */
+
+    public Map deprecationConfig;
+    private Map configMap;
+
+    public DeprecationConfigurator(InputStream inStream) {
+
+        //Read from some source, probably a file and set the config map here.
+        //If the source is service specific, we can use getConfig() and only access
+        //service based parameters else make a general config and filter out the needed parameters
+        //and create a Map in the getConfig(EndpointReference to)
+        try {
+            configMap = generateMap(inStream);
+            setConfig(configMap);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private Map generateMap(InputStream inStream) throws Exception {
+
+
+        StAXOMBuilder staxOMBuilder;
+
+        staxOMBuilder = new StAXOMBuilder(inStream);
+
+        //Read the source and generate a map of the
+        Map generatedMap = new HashMap();
+
+        OMElement config = staxOMBuilder.getDocumentElement();
+        config.build();
+        Iterator serviceItr = config.getChildrenWithName(new QName(DeprecationConstants.CFG_DEPRECATION_SERVICE));
+
+        while (serviceItr.hasNext()) {
+            OMElement serviceEle = (OMElement) serviceItr.next();
+            String serviceKey = serviceEle.getAttributeValue(new QName("Id"));
+            Iterator paramItr = serviceEle.getChildElements();
+            int counter = 0;
+            Map dataMap = new HashMap();
+
+            while (paramItr.hasNext()) {
+                OMElement paramEle = (OMElement) paramItr.next();
+                Iterator dataItr = paramEle.getChildElements();
+
+                while (dataItr.hasNext()) {
+                    OMElement dataEle = (OMElement) dataItr.next();
+                    String dataName = dataEle.getLocalName() + "[" + counter + "]";
+                    String dataValue = dataEle.getText();
+                    dataMap.put(dataName, dataValue);
+                }
+
+                //Will be of use if multiple services are facaded by a single serviceEPR
+                dataMap.put(DeprecationConstants.CFG_DEPRECATION_SERVICE + "[" + counter + "]", serviceKey);
+                counter++;
+
+            }
+            generatedMap.put(serviceKey, dataMap);
+        }
+        return generatedMap;
+    }
+
+    public Map getConfig(EndpointReference to) {
+
+        //Filter out the required parameters and generate the ConfigMap for this service
+        //This is done by using the EndPointReference as a key into the configMap.
+        //The value object corresponding to it is the required deprecationMap.
+
+        deprecationConfig = (Map) configMap.get(to.getAddress());
+
+        return deprecationConfig;
+    }
+
+    public void setConfig(Map configMap) {
+
+        //In case we go for service-specific impl then the configMap will contain details
+        // for the single service alone, hence this line.
+        //If an aggregate approach is taken [i.e. all service data in a single source file]
+        // then this method should not assign configMap to deprecationConfig.
+
+        this.deprecationConfig = configMap;
+
+    }
+
+}

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConstants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConstants.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConstants.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationConstants.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.deprecation;
+
+public interface DeprecationConstants {
+
+    public static final String CFG_DEPRECATION_SERVICE = "deprecationService";
+    public static final String CFG_DEPRECATION_FROM_DATE = "deprecationFromdate";
+    public static final String CFG_DEPRECATION_TO_DATE = "deprecationTodate";
+    public static final String CFG_DEPRECATION_ENABLED = "deprecationEnabled";
+    public static final String CFG_DEPRECATION_RESULT = "synapse.deprecation.result";
+    public static final String CFG_DEPRECATION_XML = "deprecation.xml";
+    public static final String CFG_XML_FOLDER = "META-INF";
+}

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationMediator.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationMediator.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationMediator.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.deprecation;
+
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.api.EnvironmentAware;
+
+import java.util.Map;
+import java.io.InputStream;
+
+public class DeprecationMediator implements Mediator, EnvironmentAware {
+
+    DeprecationConfiguration configuration;
+    private ClassLoader classLoader;
+
+    public DeprecationMediator() {
+    }
+
+    public boolean mediate(SynapseMessage synapseMessageContext) {
+
+        try {
+
+            String resource = DeprecationConstants.CFG_XML_FOLDER+"/"+DeprecationConstants.CFG_DEPRECATION_XML;
+            InputStream inStream = classLoader.getResourceAsStream(resource);
+            final DeprecationConfigurator deprecationConfigurator =
+                    new DeprecationConfigurator(inStream);
+            Map mediatorConfig = deprecationConfigurator
+                    .getConfig(synapseMessageContext.getTo());
+            loadConfiguration(mediatorConfig);
+            DeprecationRule rules[] = configuration.getRules();
+            boolean deprecated = false;
+
+            for (int i = 0, len = rules.length; i < len; i++) {
+
+                if (rules[i].isDeprecated()) {
+
+                    deprecated = true;
+                }
+
+            }
+
+            synapseMessageContext.setProperty(
+                    DeprecationConstants.CFG_DEPRECATION_RESULT,
+                    Boolean.valueOf(deprecated));
+
+            return !(deprecated);
+
+        } catch (Exception e) {
+
+            return false;
+        }
+    }
+
+    private void loadConfiguration(Map mediatorConfig) {
+        configuration = new DeprecationConfiguration();
+
+        for (int i = 0; true; i++) {
+
+            String serviceKey = DeprecationConstants.CFG_DEPRECATION_SERVICE +
+                    "[" + i + "]";
+            String fromDateKey = DeprecationConstants
+                    .CFG_DEPRECATION_FROM_DATE + "[" + i + "]";
+            String toDateKey = DeprecationConstants.CFG_DEPRECATION_TO_DATE +
+                    "[" + i + "]";
+            String enabledKey = DeprecationConstants.CFG_DEPRECATION_ENABLED +
+                    "[" + i + "]";
+
+            if (mediatorConfig.get(serviceKey) == null) {
+                break;
+            }
+
+
+            DeprecationRule rule = new DeprecationRule();
+            rule.setService((String) mediatorConfig.get(serviceKey));
+            rule.setFromDate((String) mediatorConfig.get(fromDateKey));
+            rule.setToDate((String) mediatorConfig.get(toDateKey));
+            rule.setEnabled((String) mediatorConfig.get(enabledKey));
+            configuration.addRule(rule);
+        }
+
+    }
+
+    public void setSynapseEnvironment(SynapseEnvironment se) {
+        //not used for now
+    }
+
+    public void setClassLoader(ClassLoader cl) {
+        this.classLoader = cl;
+    }
+}

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationRule.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationRule.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationRule.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/DeprecationRule.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.deprecation;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+public class DeprecationRule {
+
+    private String service;
+    private String fromDate;
+    private String toDate;
+    private String enabled;
+
+    public DeprecationRule() {
+
+    }
+
+    public DeprecationRule(String service) {
+        this.service = service;
+    }
+
+    public String getService() {
+        return this.service;
+    }
+
+    public void setService(String service) {
+        this.service = service;
+    }
+
+    public String getFromDate() {
+        return this.fromDate;
+    }
+
+    public void setFromDate(String fromDate) {
+        this.fromDate = fromDate;
+    }
+
+    public String getToDate() {
+        return this.toDate;
+    }
+
+    public void setToDate(String toDate) {
+        this.toDate = toDate;
+    }
+
+    public String getEnabled() {
+        return this.enabled;
+    }
+
+    public void setEnabled(String enabled) {
+        this.enabled = enabled;
+    }
+
+    public boolean isDeprecated() {
+        try {
+            if (Boolean.TRUE == Boolean.valueOf(enabled)) {
+                Calendar current = Calendar.getInstance();
+                TimeZone tz = current.getTimeZone();
+                int offset = tz.getRawOffset();
+                Calendar calendar = new GregorianCalendar(tz);
+
+                DateFormat df = new SimpleDateFormat("d/M/y:H:m");
+                df.setTimeZone(tz);
+
+                Date d1 = df.parse(fromDate);
+                Calendar fromCalendar = new GregorianCalendar(tz);
+                d1.setTime(d1.getTime() + offset);
+                fromCalendar.setTime(d1);
+
+                if (toDate == null || (toDate.length() == 0)) {
+                    return calendar.before(fromCalendar);
+                }
+
+                Date d2 = df.parse(toDate);
+                Calendar toCalendar = new GregorianCalendar(tz);
+                d2.setTime(d2.getTime() + offset);
+                toCalendar.setTime(d2);
+
+                return (calendar.after(fromCalendar) && calendar.before(toCalendar));
+            }
+        } catch (ParseException e) {
+            return false;
+        }
+
+        return false;
+    }
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer(1024);
+        buf.append("Service : ").append(getService()).append("\n");
+        buf.append("FromDate: ").append(getFromDate()).append("\n");
+        buf.append("ToDate: ").append(getToDate()).append("\n");
+        buf.append("Enabled: ").append(getEnabled()).append("\n");
+
+        return buf.toString();
+    }
+
+}

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml Tue Mar 21 22:54:17 2006
@@ -0,0 +1,11 @@
+<!-- The time format is dd/mm/yyyy:H:m and its with respect to UTC.
+TimeZone is that of the system, offset from UTC is calculated internally -->
+<deprecationConfig>
+    <deprecationService Id="http://www.webservicex.net/stockquote.asmx">
+        <parameterSet>
+            <deprecationFromdate>06/09/2005:00:00</deprecationFromdate>
+            <deprecationTodate>07/02/2006:00:00</deprecationTodate>
+            <deprecationEnabled>true</deprecationEnabled>
+        </parameterSet>
+    </deprecationService>
+</deprecationConfig>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/services.xml?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/services.xml (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/META-INF/services.xml Tue Mar 21 22:54:17 2006
@@ -0,0 +1,10 @@
+<!-- Can be used if the mediator is to be provided as an axis2 service-->
+<service name="DeprecationMediator">
+    <parameter name="ServiceClass" locked="false">
+        sampleMediators.deprecation.DeprecationMediator</parameter>
+    <operation name="mediate">
+        <messageReceiver
+                class="org.apache.synapse.axis2.ServiceMediatorMessageReceiver"/>
+    </operation>
+</service>
+  
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/README.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/README.txt?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/README.txt (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/deprecation/README.txt Tue Mar 21 22:54:17 2006
@@ -0,0 +1,44 @@
+Hi everybody,
+
+Note
+-----
+
+This is the first shot towards a Deprecation mediator.
+A trivial explanation would be - A service configured as deprecated between certain 
+dates/time will not
+be accessible for requests coming in between those dates.
+You are free to declare more than one set of dates/time and enable or disable the set when required.
+
+The mediator depends on the UTC - Date/time settings and these are converted 
+and offset to local time,during processing, internally.
+
+It implements the Mediator interface and hence has the "boolean mediate(SynapseMessage)" method.
+The configuration data about the deprecation for a particular service is provided in a 
+"deprecation.xml" file.
+
+When a SynapseContext is sent to the DeprecationMediator it checks wether the service 
+to which the request is addressed is deprecatd or not. 
+It sets the value in the "synapse.deprecation.result" property in the synapseContext.
+
+Return Values
+--------------
+True - Service is not deprecated, the request can go on.
+False - The service is deprecated, need not send the request to the service.
+
+Running Deprecation Mediator Sample
+===================================
+
+1. Copy synapse.xml in this repository to synapse_repository in the binary distribution.
+2. Place the DeprecationMediator.aar in the synape_repository/services.
+3. Using the Ant command "ant synapse", start the stand-alone synapse server.
+   This will be start at port 8080. 
+4. Use Ant command "ant" StockQuoteClient available in this folder to run the sample. 
+ 
+You will get an answer if the system date is not between 06/09/2005:00:00 and 07/02/2006:00:00 
+[DD/MM/yyyy:HH:mm]
+
+The prior configuration is available in deprecation.xml, which is located in 
+DeprecationMediator.aar's META-INF folder. 
+
+Note : 
+The service is deprecated between these dates, i.e. it is not available or is not to be used.

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/CallService.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/CallService.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/CallService.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/CallService.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,126 @@
+package org.apache.synapse.mediators.failover;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMDocument;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.axis2.Axis2FlexibleMEPClient;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Vikas
+ * Date: Dec 29, 2005
+ * Time: 11:51:21 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class CallService {
+    public SynapseEnvironment environment;
+    private Log log = LogFactory.getLog(getClass());
+    private MessageContext newMsg = new MessageContext();
+    Axis2SynapseMessage synapseMessage;
+
+     public CallService(SynapseEnvironment synapseEnvironment) {
+        //Setting the environment
+        this.environment = synapseEnvironment;
+        log.info("Call Service Constructor");
+    }
+
+    public SynapseMessage execute(long timeoutValue, SynapseMessage synapseMsg) {
+        synapseMessage = (Axis2SynapseMessage) synapseMsg;
+        log.info("Execute Called");
+        if (timeoutValue == 0) {
+            try {
+                newMsg = Axis2FlexibleMEPClient.send(synapseMessage.getMessageContext());
+                synapseMessage = new Axis2SynapseMessage(newMsg);
+            }
+            catch (AxisFault axisFault) {
+                thePivot();
+                axisFault.printStackTrace();
+            }
+        } else {
+            final CallThread thread  = new CallThread();
+            Timer timer = new Timer(false);
+            log.info("Timer Defined");
+            TimerTask task = new TimerTask() {
+                public void run() {
+
+                    if (thread.completed) {
+                        thread.interrupt();
+                    }
+                    /* The above method does not stop blocking SoapThread*/
+                    thread.interrupted = true;
+                }
+            };
+
+            timer.schedule(task, timeoutValue);
+            thread.start();
+            log.info("Thread started!");
+            while (!thread.interrupted) {
+
+                try {
+
+                    Thread.sleep(timeoutValue / 100);
+                } catch (Exception exception) {
+                    exception.printStackTrace();
+                }
+            }
+            timer.cancel();
+            if (thread.fault != null) {
+                thread.interrupted = true;
+            }
+        }
+        return synapseMessage;
+    }
+
+    private void thePivot() {
+        log.info("EXCEPTION CAUGHT FOR FAILOVER!");
+
+        SOAPFactory factory;
+        SOAPEnvelope envelope = synapseMessage.getEnvelope();
+        if (envelope.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+            factory = OMAbstractFactory.getSOAP12Factory();
+        } else {
+            factory = OMAbstractFactory.getSOAP11Factory();
+        }
+        try {
+            OMDocument soapFaultDocument = factory.createOMDocument();
+            SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
+            soapFaultDocument.addChild(faultEnvelope);
+            newMsg.setEnvelope(faultEnvelope);
+            synapseMessage = new Axis2SynapseMessage(newMsg);
+            synapseMessage.setFaultResponse(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+     public class CallThread extends Thread {
+
+        public boolean interrupted = false;
+        public boolean completed = false;
+        String fault;
+
+        public void run() {
+            try {
+                newMsg = Axis2FlexibleMEPClient.send(synapseMessage.getMessageContext());
+                synapseMessage = new Axis2SynapseMessage(newMsg);
+                this.completed = true;
+            } catch (AxisFault axisFault) {
+                axisFault.printStackTrace();
+                thePivot();
+            }
+
+        }
+    }
+}

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfiguration.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfiguration.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfiguration.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,68 @@
+/*
+ *
+ * Copyright ©2002-2005 Infravio, Inc. All rights reserved.
+ *
+ * Infravio PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ *
+ *   This software is the confidential and proprietary information of Infravio, Inc
+ *   ("Confidential Information").  You shall not disclose such Confidential 
+ *   Information and shall use it only in accordance with the terms of the license  
+ *   agreement you entered into with Infravio.
+ *
+ *
+ */
+
+package org.apache.synapse.mediators.failover;
+
+public class FailoverConfiguration {
+
+    FailoverRule rules[] = new FailoverRule[0];
+
+    public FailoverConfiguration() {
+
+    }
+
+    public FailoverRule[] getRules() {
+        return rules;
+    }
+
+    public void addRule(FailoverRule rule) {
+        FailoverRule tmp[] = new FailoverRule[rules.length + 1];
+        for (int i = 0; i < rules.length; i++) {
+            tmp[i] = rules[i];
+        }
+        tmp[rules.length] = rule;
+        this.rules = tmp;
+    }
+
+    public void removeRule() {
+        if (rules.length == 0)
+            return;
+        FailoverRule tmp[] = new FailoverRule[rules.length - 1];
+        for (int i = 0; i < rules.length - 1; i++) {
+            tmp[i] = rules[i];
+        }
+        this.rules = tmp;
+    }
+
+    public boolean hasRule(String service) {
+        for (int i = 0; i < rules.length; i++) {
+            if (rules[i].getService().equals(service)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer(1024);
+        for (int i = 0; i < rules.length; i++) {
+            if (rules[i] != null) {
+                buf.append(rules[i].toString());
+            }
+        }
+        return buf.toString();
+    }
+
+}

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfigurator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfigurator.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfigurator.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConfigurator.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.failover;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+public class FailoverConfigurator {
+    private Log log = LogFactory.getLog(getClass());
+    /*
+    *** MAP STRUCTURE ***
+    The config map contains the parameter-sets for all the services and also a default
+    parameter set. The key to this map is the endPoint reference of the service and the
+    value associated with it is the parameter map corresponding to it.
+
+    <failoverService Id="ServiceEPR to distnguish this set when the request comes in">
+        <timeoutEnabled>
+            A boolean to denote if failover happens on Timeout
+        </timeoutEnabled>
+        <soapFaultEnabled>
+            A boolean to denote if failover happens on soapFault
+        </soapFaultEnabled>
+        <networkErrorEnabled>
+            A boolean, denotes if failover happens on networkError
+        </networkErrorEnabled>
+        <parameterSet>
+            <service>SomeServiceEPR</service>
+            <primary>A boolean to denote if this the primary service</primary>
+            <active>A boolean to denote if the service is active</active>
+            <timeout>Timeout Value for the service in milliseconds</timeout>
+        </parameterSet>
+    </failoverService>
+
+    This should map to
+    key is ("serviceEPR")
+    value is (map of parameterSet and the extra mets-data) i.e.
+        map with key (parameter name), value (parameter value).
+    */
+
+    public Map failoverConfig;
+    private Map configMap;
+
+    public FailoverConfigurator(InputStream instream) {
+
+        //Read from some source, probably a file and set the config map here.
+        //If the source is service specific, we can use getConfig() and only access
+        //service based parameters else make a general config and filter out the needed parameters
+        //and create a Map in the getConfig(EndpointReference to)
+
+        try {
+            configMap = generateMap(instream);
+            setConfig(configMap);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private Map generateMap(InputStream instream) throws Exception {
+
+        log.info("Generating map for failover");
+
+        StAXOMBuilder staxOMBuilder;
+
+        staxOMBuilder = new StAXOMBuilder(instream);
+
+        //Read the source and generate a map of the
+        Map generatedMap = new HashMap();
+
+        OMElement config = staxOMBuilder.getDocumentElement();
+        config.build();
+        Iterator serviceItr = config.getChildrenWithName(new QName(FailoverConstants.CFG_FAILOVER_SERVICE));
+
+        while (serviceItr.hasNext()) {
+            OMElement serviceEle = (OMElement) serviceItr.next();
+            String serviceKey = serviceEle.getAttributeValue(new QName("Id"));
+            Iterator paramItr = serviceEle.getChildrenWithName(new QName(FailoverConstants.CFG_PARAMSET));
+            Map dataMap = new HashMap();
+            int counter = 0;
+            while (paramItr.hasNext()) {
+                OMElement paramEle = (OMElement) paramItr.next();
+                Iterator dataItr = paramEle.getChildElements();
+
+                while (dataItr.hasNext()) {
+                    OMElement dataEle = (OMElement) dataItr.next();
+                    String dataName = dataEle.getLocalName() + "[" + counter + "]";
+                    String dataValue = dataEle.getText();
+                    dataMap.put(dataName, dataValue);
+                }
+
+                counter++;
+            }
+
+            String isTimeOutEnabled = serviceEle.getFirstChildWithName(new QName
+                    (FailoverConstants.CFG_FAILOVER_ON_TIMEOUT)).getText();
+            /*String isSOAPFaultEnabled = serviceEle.getFirstChildWithName(new QName
+                    (FailoverConstants.CFG_FAILOVER_ON_SOPAFAULT)).getText();
+            */
+            String isNTWRK_ErrorEnabled = serviceEle.getFirstChildWithName(new QName
+                    (FailoverConstants.CFG_FAILOVER_ON_NTWRK_ERROR)).getText();
+
+            dataMap.put(FailoverConstants.CFG_FAILOVER_ON_NTWRK_ERROR, Boolean.valueOf(isNTWRK_ErrorEnabled));
+            //dataMap.put(FailoverConstants.CFG_FAILOVER_ON_SOPAFAULT, Boolean.valueOf(isSOAPFaultEnabled));
+            dataMap.put(FailoverConstants.CFG_FAILOVER_ON_TIMEOUT, Boolean.valueOf(isTimeOutEnabled));
+            generatedMap.put(serviceKey, dataMap);
+
+        }
+
+        return generatedMap;
+    }
+
+    public Map getConfig(EndpointReference to) {
+
+        //Filter out the required parameters and generate the ConfigMap for this service
+        //This is done by using the EndPointReference as a key into the configMap.
+        //The value object corresponding to it is the required deprecationMap.
+        log.info("Giving failover map for " + to.getAddress());
+
+        failoverConfig = (Map) configMap.get(to.getAddress());
+
+        return failoverConfig;
+    }
+
+    public void setConfig(Map configMap) {
+
+        //In case we go for service-specific impl then the configMap will contain details
+        // for the single service alone, hence this line.
+        //If an aggregate approach is taken [i.e. all service data in a single source file]
+        // then this method should not assign configMap to failoverConfig.
+
+        this.failoverConfig = configMap;
+
+    }
+
+}
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConstants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConstants.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConstants.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverConstants.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.failover;
+
+public interface FailoverConstants {
+
+    public static final String CFG_FAILOVER_SERVICE = "failoverService";
+    public static final String CFG_FAILOVER_ON_TIMEOUT = "timeoutEnabled";
+    public static final String CFG_FAILOVER_ON_SOPAFAULT = "soapFaultEnabled";
+    //public static final String CFG_FAILOVER_ON_NTWRK_ERROR = "networkErrorEnabled";
+    public static final String CFG_FAILOVER_ON_NTWRK_ERROR = "errorEnabled";
+    public static final String CFG_PARAM_SERVICE = "service";
+    public static final String CFG_PARAM_ACTIVE = "active";
+    public static final String CFG_PARAM_PRIMARY = "primary";
+    public static final String CFG_PARAM_TIMEOUT = "timeout";
+    public static final String CFG_FAILOVER_RESULT = "synapse.failover.result";
+    public static final String CFG_FAILOVER_XML = "failover.xml";
+    public static final String CFG_XML_FOLDER = "META-INF";
+    public static final String CFG_PARAMSET = "parameterSet";
+    public static final String TIMEOUT_MSG = "";
+
+}
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverMediator.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverMediator.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverMediator.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.failover;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.api.EnvironmentAware;
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.axis2.Axis2Sender;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+
+import java.io.InputStream;
+import java.util.Map;
+
+
+public class FailoverMediator implements Mediator, EnvironmentAware {
+
+    FailoverConfiguration configuration;
+    private ClassLoader classLoader;
+    private SynapseEnvironment synapseEnvironment;
+    private Log log = LogFactory.getLog(getClass());
+    CallService callService;
+
+    Boolean isNetworkErrorEnabled, isSOAPFaultEnabled, isTimeoutEnabled;
+
+
+    public FailoverMediator() {
+    }
+
+    public boolean mediate(SynapseMessage synapseMessage) {
+         SynapseMessage request;
+        FailoverConfigurator failoverConfigurator;
+        try {
+
+
+            synapseEnvironment.setProperty("copy_message", ((Axis2SynapseMessage) synapseMessage).getMessageContext());
+            log.info("FAILOVER MEDIATION");
+            if(synapseEnvironment.getProperty("faoliver_config")!=null){
+            failoverConfigurator  = (FailoverConfigurator) synapseEnvironment.getProperty("faoliver_config");
+            }
+            else
+            {
+            InputStream failoverInStream;
+            String resource = FailoverConstants.CFG_XML_FOLDER + "/" + FailoverConstants.CFG_FAILOVER_XML;
+
+            if ((failoverInStream = this.classLoader.getResourceAsStream(resource)) == null)
+                log.info("INPUT STREAM NULL");
+
+            failoverConfigurator =
+                    new FailoverConfigurator(failoverInStream);
+            synapseEnvironment.setProperty("faoliver_config",failoverConfigurator);
+            }
+            Map mediatorConfig = failoverConfigurator
+                    .getConfig(synapseMessage.getTo());
+
+            loadConfiguration(mediatorConfig);
+
+            FailoverRule rules[] = configuration.getRules();
+            int length = rules.length;
+            boolean shouldFailover;
+            if (this.synapseEnvironment == null) log.info("EMPTY ENVIRONMENT TO PASS");
+            SynapseMessage reply = null;
+
+            for (int i = 0; i < length; i++) {
+
+
+                request = new Axis2SynapseMessage((MessageContext) synapseEnvironment.getProperty("copy_message"));
+
+
+
+                String currentService = rules[i].getService();
+                log.info("Service" + i + " : " + currentService);
+                request.setTo(new EndpointReference(currentService));
+				long timeoutValue = 0;
+				if(isTimeoutEnabled.booleanValue())
+				{
+					timeoutValue=rules[i].getTimeout();
+				}
+                reply = callService.execute(timeoutValue, request);
+                if (reply.isFaultResponse()) {
+                    shouldFailover = evaluateFailoverScenario(reply);
+                    if (!shouldFailover) break;
+                } else break;
+            }
+
+            synapseMessage.getEnvelope().getBody().getFirstElement().detach();
+            synapseMessage.getEnvelope().getBody().setFirstChild(reply.getEnvelope().getBody().getFirstElement());
+            EndpointReference temp = synapseMessage.getTo();
+            synapseMessage.setTo(synapseMessage.getReplyTo());
+            synapseMessage.setReplyTo(temp);
+            synapseMessage.setResponse(true);
+            Axis2Sender.sendBack(synapseMessage);
+            return true;
+        } catch (Exception e) {
+            log.info(e);
+            return false;
+        }
+    }
+
+
+    private boolean evaluateFailoverScenario(SynapseMessage synMessage) {
+
+        // TODO : work out for the fault string
+
+        return isNetworkErrorEnabled.booleanValue();
+    }
+
+
+    private void loadConfiguration(Map mediatorConfig) {
+
+        configuration = new FailoverConfiguration();
+        isNetworkErrorEnabled = (Boolean) mediatorConfig.get(FailoverConstants.CFG_FAILOVER_ON_NTWRK_ERROR);
+        //isSOAPFaultEnabled = (Boolean) mediatorConfig.get(FailoverConstants.CFG_FAILOVER_ON_SOPAFAULT);
+        isTimeoutEnabled = (Boolean) mediatorConfig.get(FailoverConstants.CFG_FAILOVER_ON_TIMEOUT);
+
+        for (int i = 0; true; i++) {
+
+            String serviceKey = FailoverConstants.CFG_PARAM_SERVICE +
+                    "[" + i + "]";
+            String activeKey = FailoverConstants.CFG_PARAM_ACTIVE + "[" + i + "]";
+            String primaryKey = FailoverConstants.CFG_PARAM_PRIMARY + "[" + i + "]";
+            String timeoutKey = FailoverConstants.CFG_PARAM_TIMEOUT + "[" + i + "]";
+
+            if (mediatorConfig.get(serviceKey) == null) {
+                break;
+            }
+
+
+            FailoverRule rule = new FailoverRule();
+            rule.setService((String) mediatorConfig.get(serviceKey));
+            rule.setActive((String) mediatorConfig.get(activeKey));
+            rule.setPrimary((String) mediatorConfig.get(primaryKey));
+            long temp = Long.parseLong(mediatorConfig.get(timeoutKey).toString());
+            rule.setTimeout(temp);
+            configuration.addRule(rule);
+        }
+
+        log.info("FAILOVER CONFIG MAP LOADED INTO RULESET!");
+
+    }
+
+    public void setSynapseEnvironment(SynapseEnvironment se) {
+
+        if (se == null) {
+            log.info("The Environment is null");
+        }
+        this.synapseEnvironment = se;
+        callService = new CallService(this.synapseEnvironment);
+    }
+
+    public void setClassLoader(ClassLoader cl) {
+        this.classLoader = cl;
+    }
+}

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverRule.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverRule.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverRule.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/FailoverRule.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,70 @@
+/*
+ *
+ * Copyright ©2002-2005 Infravio, Inc. All rights reserved.
+ *
+ * Infravio PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ *
+ *   This software is the confidential and proprietary information of Infravio, Inc
+ *   ("Confidential Information").  You shall not disclose such Confidential 
+ *   Information and shall use it only in accordance with the terms of the license  
+ *   agreement you entered into with Infravio.
+ *
+ *
+ */
+
+package org.apache.synapse.mediators.failover;
+
+public class FailoverRule {
+
+    public FailoverRule() {
+    }
+
+    private String service;
+    private String active;
+    private String primary;
+    private long timeout;
+
+    public String getService() {
+        return service;
+    }
+
+    public void setService(String service) {
+        this.service = service;
+    }
+
+    public String getActive() {
+        return active;
+    }
+
+    public void setActive(String active) {
+        this.active = active;
+    }
+
+    public String getPrimary() {
+        return primary;
+    }
+
+    public void setPrimary(String primary) {
+        this.primary = primary;
+    }
+
+    public long getTimeout() {
+        return timeout;
+    }
+
+    public void setTimeout(long timeout) {
+        this.timeout = timeout;
+    }
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer(1024);
+        buf.append("Rule:").append("\n");
+        buf.append("Service : ").append(getService()).append("\n");
+        buf.append("Active : ").append(getActive()).append("\n");
+        buf.append("Primary : ").append(getPrimary()).append("\n");
+        buf.append("Timeout : ").append(getTimeout()).append("\n");
+        return buf.toString();
+    }
+
+}

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/failover.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/failover.xml?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/failover.xml (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/failover.xml Tue Mar 21 22:54:17 2006
@@ -0,0 +1,38 @@
+<!--
+    <failoverService Id="ServiceEPR to distnguish this set when the request comes in">
+        <timeoutEnabled>
+            A boolean to denote if failover happens on Timeout
+        </timeoutEnabled>
+        <soapFaultEnabled>
+            A boolean to denote if failover happens on soapFault
+        </soapFaultEnabled>
+        <networkErrorEnabled>
+            A boolean, denotes if failover happens on networkError
+        </networkErrorEnabled>
+        <parameterSet>
+            <service>SomeServiceEPR</service>
+            <primary>A boolean to denote if this the primary service</primary>
+            <active>A boolean to denote if the service is active</active>
+            <timeout>Timeout Value for the service in milliseconds</timeout>
+        </parameterSet>
+    </failoverService>
+-->
+<failoverConfig>
+    <failoverService Id="http://somehost:8080/failoverService">
+        <timeoutEnabled>true</timeoutEnabled>
+        <!--<soapFaultEnabled>true</soapFaultEnabled>-->
+        <errorEnabled>true</errorEnabled>
+        <parameterSet>
+            <service>http://ost:8080/service1</service>
+            <primary>true</primary>
+            <active>true</active>
+            <timeout>5000</timeout>
+        </parameterSet>
+        <parameterSet>
+            <service>http://www.webservicex.net/stockquote.asmx</service>
+            <primary>false</primary>
+            <active>true</active>
+            <timeout>10000</timeout>
+        </parameterSet>
+    </failoverService>
+</failoverConfig>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/services.xml?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/services.xml (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/META-INF/services.xml Tue Mar 21 22:54:17 2006
@@ -0,0 +1,9 @@
+<!-- Can be used if the mediator is to be provided as an axis2 service-->
+<service name="DeprecationMediator">
+    <parameter name="ServiceClass" locked="false">
+        sampleMediators.failover.FailoverMediator</parameter>
+    <operation name="mediate">
+        <messageReceiver
+                class="org.apache.synapse.axis2.ServiceMediatorMessageReceiver"/>
+    </operation>
+</service>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/README.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/README.txt?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/README.txt (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/failover/README.txt Tue Mar 21 22:54:17 2006
@@ -0,0 +1,35 @@
+Hi everybody,
+
+Note
+-----
+
+Failover is the act of switching to a secondary service in case the primary service fails.
+Hence, logically, we can configure failover only when we have 2 or more endpoints providing similar
+service.
+
+The failover process can be initiated on timeout and or faults.
+
+In case of 'failover on faults' the FailoverMediator keeps switching to secondary services,
+until all the secondary services are tried or one of them returns a successful result.
+
+In case failover based on timeout is active, the participating end-points would be given 
+timeout values and the connection would be forced to close and a fault would be returned if no 
+response arrives within that many milliseconds and then 'failover on fault' logic kicks in.
+
+
+Return Values
+--------------
+True - Failover performed successfully.
+False - Error while processing.
+
+Running Failover Mediator Sample
+===================================
+
+1. Copy synapse.xml in this repository to synapse_repository in the binary distribution.
+2. Place the FailoverMediator.aar in the synape_repository/services.
+3. Using the Ant command "ant synapse", start the stand-alone synapse server. 
+   This will start at port 8080. 
+4. Use Ant command "ant" StockQuoteClient available in this folder to run the sample. 
+
+The configuration is available in failover.xml, which is located in FailoverMediator.aar's 
+META-INF folder. 
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfiguration.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfiguration.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfiguration.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,69 @@
+/*
+ *
+ * Copyright ©2002-2005 Infravio, Inc. All rights reserved.
+ *
+ * Infravio PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ *
+ *   This software is the confidential and proprietary information of Infravio, Inc
+ *   ("Confidential Information").  You shall not disclose such Confidential 
+ *   Information and shall use it only in accordance with the terms of the license  
+ *   agreement you entered into with Infravio.
+ *
+ *
+ */
+
+package org.apache.synapse.mediators.loadbalancing;
+
+public class LoadBalancingConfiguration {
+
+    LoadBalancingRule rules[] = new LoadBalancingRule[0];
+
+
+    public LoadBalancingConfiguration() {
+
+    }
+
+    public LoadBalancingRule[] getRules() {
+        return rules;
+    }
+
+    public void addRule(LoadBalancingRule rule) {
+        LoadBalancingRule tmp[] = new LoadBalancingRule[rules.length + 1];
+        for (int i = 0; i < rules.length; i++) {
+            tmp[i] = rules[i];
+        }
+        tmp[rules.length] = rule;
+        this.rules = tmp;
+    }
+
+    public void removeRule() {
+        if (rules.length == 0)
+            return;
+        LoadBalancingRule tmp[] = new LoadBalancingRule[rules.length - 1];
+        for (int i = 0; i < rules.length - 1; i++) {
+            tmp[i] = rules[i];
+        }
+        this.rules = tmp;
+    }
+
+    public boolean hasRule(String service) {
+        for (int i = 0; i < rules.length; i++) {
+            if (rules[i].getService().equals(service)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer(1024);
+        for (int i = 0; i < rules.length; i++) {
+            if (rules[i] != null) {
+                buf.append(rules[i].toString());
+            }
+        }
+        return buf.toString();
+    }
+
+}

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfigurator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfigurator.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfigurator.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConfigurator.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.loadbalancing;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+public class LoadBalancingConfigurator {
+      private Log log = LogFactory.getLog(getClass());
+    /*
+    *** MAP STRUCTURE ***
+    The config map contains the parameter-sets for all the services and also a default
+    parameter set. The key to this map is the endPoint reference of the service and the
+    value associated with it is the parameter map corresponding to it.
+
+    <loadBalancingService Id="ServiceEPR to distnguish this set when the request comes in">
+        <strategy>
+            Specifies the load-balancing criteria. [performance/round-robin]
+        </strategy>
+        <count>
+            number of last requests on which to evaluate performance criteria
+        </count>
+        <lastService>
+            keeps track of the service last called in round-robin fashion
+        </lastService>
+        <parameterSet>
+            <service>SomeServiceEPR</service>
+            <active>A boolean to denote if the service is active</active>
+            <requestCount>Number of requests it has received till now</requestCount>
+            <averageResponseTime>
+                Average response time for 'count' requests in milliseconds
+            </averageResponseTime>
+            <lastResponseTime>
+                Last response time for the service in milliseconds
+            </lastResponseTime>
+        </parameterSet>
+    </loadBalancingService>
+
+    This should map to
+    key is ("serviceEPR")
+    value is (map of parameterSet and the extra mets-data) i.e.
+        map with key (parameter name), value (parameter value).
+    */
+
+    public Map loadbalancingConfig;
+
+    public static Map getConfigMap() {
+        return configMap;
+    }
+
+    public static void setConfigMap(Map configMap) {
+        LoadBalancingConfigurator.configMap = configMap;
+    }
+
+    public static Map configMap;
+
+    public LoadBalancingConfigurator(InputStream instream) {
+
+        log.info("LoadBalancing Configurator created!");
+        try {
+            configMap = generateMap(instream);
+            setConfig(configMap);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private Map generateMap(InputStream instream) throws Exception {
+
+        log.info("Generating map for LoadBalancing");
+        //Read the source and generate a map of the
+        Map generatedMap = new HashMap();
+
+        StAXOMBuilder staxOMBuilder;
+
+        staxOMBuilder = new StAXOMBuilder(instream);
+
+        OMElement config = staxOMBuilder.getDocumentElement();
+        config.build();
+        Iterator serviceItr = config.getChildrenWithName(new QName(LoadBalancingConstants.CFG_LOADBALANCING_SERVICE));
+
+        while (serviceItr.hasNext()) {
+            OMElement serviceEle = (OMElement) serviceItr.next();
+            String serviceKey = serviceEle.getAttributeValue(new QName("Id"));
+            Iterator paramItr = serviceEle.getChildrenWithName(new QName(LoadBalancingConstants.CFG_PARAMSET));
+            Map dataMap = new HashMap();
+            int counter=0;
+            while (paramItr.hasNext()) {
+                OMElement paramEle = (OMElement) paramItr.next();
+                Iterator dataItr = paramEle.getChildElements();
+
+                while (dataItr.hasNext()) {
+                    OMElement dataEle = (OMElement) dataItr.next();
+                    String dataName = dataEle.getLocalName() + "[" + counter + "]";
+                    String dataValue = dataEle.getText();
+                    dataMap.put(dataName, dataValue);
+                }
+
+                counter++;
+            }
+
+            String strategy = serviceEle.getFirstChildWithName(new QName
+                                              (LoadBalancingConstants.CFG_LOADBALANCING_STRATEGY)).getText();
+            String count = serviceEle.getFirstChildWithName(new QName
+                                              (LoadBalancingConstants.CFG_LOADBALANCING_PERF_COUNT)).getText();
+            dataMap.put(LoadBalancingConstants.CFG_LOADBALANCING_STRATEGY,strategy);
+            dataMap.put(LoadBalancingConstants.CFG_LOADBALANCING_PERF_COUNT,count);
+            dataMap.put(LoadBalancingConstants.CFG_LOADBALANCING_LAST_SERVICE,"0");
+            generatedMap.put(serviceKey, dataMap);
+
+        }
+
+        return generatedMap;
+    }
+            
+
+    public Map getConfig(EndpointReference to) {
+
+        //Filter out the required parameters and generate the ConfigMap for this service
+        //This is done by using the EndPointReference as a key into the configMap.
+        //The value object corresponding to it is the required deprecationMap.
+        log.info("Giving loadbalancing map for " + to.getAddress());
+        loadbalancingConfig = (Map) configMap.get(to.getAddress());
+
+        return loadbalancingConfig;
+    }
+
+    public void setConfig(Map configMap) {
+
+        //In case we go for service-specific impl then the configMap will contain details
+        // for the single service alone, hence this line.
+        //If an aggregate approach is taken [i.e. all service data in a single source file]
+        // then this method should not assign configMap to failoverConfig.
+
+        this.loadbalancingConfig = configMap;
+
+    }
+
+}
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConstants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConstants.java?rev=387760&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConstants.java (added)
+++ incubator/synapse/trunk/scratch/infravio/Mediators-NoSynapseObject/org/apache/synapse/mediators/loadbalancing/LoadBalancingConstants.java Tue Mar 21 22:54:17 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.synapse.mediators.loadbalancing;
+
+public interface LoadBalancingConstants {
+
+    public static final String CFG_LOADBALANCING_SERVICE = "loadBalancingService";
+    public static final String CFG_LOADBALANCING_STRATEGY = "strategy";
+    public static final String CFG_LOADBALANCING_PERF_COUNT = "count";
+    public static final String CFG_LOADBALANCING_LAST_SERVICE = "lastService";
+    public static final String CFG_PARAM_SERVICE = "service";
+    public static final String CFG_PARAM_ACTIVE = "active";
+    public static final String CFG_PARAM_AVG_TIME = "averageResponseTime";
+    public static final String CFG_PARAM_LAST_TIME = "lastResponseTime";
+    public static final String CFG_PARAM_REQ_COUNT = "requestCount";
+    public static final String CFG_LOADBALANCING_RESULT = "synapse.loadBalancing.result";
+    public static final String CFG_LOADBALANCING_XML = "loadbalancing.xml";
+    public static final String CFG_XML_FOLDER = "META-INF";
+    public static final String CFG_PARAMSET = "parameterSet";
+    public static final String STRATEGY_PERF = "performance";
+    public static final String STRATEGY_RR = "roundRobin";
+}
\ No newline at end of file



---------------------------------------------------------------------
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