Author: indika
Date: Sun Jan 18 23:06:10 2009
New Revision: 28909
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=28909

Log:
update with  throttle truck ...fix for carbon jira

Modified:
   
branches/synapse/1.2.wso2v1/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
   
branches/synapse/1.2.wso2v1/modules/extensions/src/test/java/org/apache/synapse/mediators/throttle/ThrottleMediatorTest.java
   branches/synapse/1.2.wso2v1/pom.xml

Modified: 
branches/synapse/1.2.wso2v1/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java?rev=28909&r1=28908&r2=28909&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
    (original)
+++ 
branches/synapse/1.2.wso2v1/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
    Sun Jan 18 23:06:10 2009
@@ -19,17 +19,17 @@
 package org.apache.synapse.mediators.throttle;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axis2.clustering.ClusteringAgent;
+import org.apache.axis2.clustering.ClusteringFault;
+import org.apache.axis2.clustering.state.Replicator;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.neethi.PolicyEngine;
 import org.apache.synapse.Mediator;
 import org.apache.synapse.MessageContext;
-import org.apache.synapse.transport.nhttp.NhttpConstants;
 import org.apache.synapse.config.Entry;
 import org.apache.synapse.core.axis2.Axis2MessageContext;
 import org.apache.synapse.mediators.AbstractMediator;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.clustering.state.Replicator;
-import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.clustering.ClusteringAgent;
+import org.apache.synapse.transport.nhttp.NhttpConstants;
 import org.wso2.throttle.*;
 
 /**
@@ -125,8 +125,7 @@
                         }
                         try {
                             // process the policy
-                            throttle = ThrottlePolicyProcessor.processPolicy(
-                                PolicyEngine.getPolicy(inLinePolicy));
+                            throttle = 
ThrottleFactory.createServiceThrottle(PolicyEngine.getPolicy(inLinePolicy));
 
                             //At this point concurrent access controller 
definitely 'null'
                             // f the clustering is disable.
@@ -187,8 +186,8 @@
 
                                     try {
                                         // Creates the throttle from the policy
-                                        throttle = 
ThrottlePolicyProcessor.processPolicy(
-                                            PolicyEngine.getPolicy((OMElement) 
entryValue));
+                                        throttle = 
ThrottleFactory.createServiceThrottle(
+                                                
PolicyEngine.getPolicy((OMElement) entryValue));
 
                                         //For non-clustered  environment , 
must re-initiates
                                         //For  clustered  environment,
@@ -364,8 +363,9 @@
 
                         try {
                             //Checks for access state
-                            canAccess = accessControler.canAccess(context,
+                            AccessInformation accessInformation = 
accessControler.canAccess(context,
                                 callerId, ThrottleConstants.DOMAIN_BASE);
+                            canAccess = accessInformation.isAccessAllowed();
 
                             if (traceOrDebugOn) {
                                 traceOrDebug(traceOn, "Access " + (canAccess ? 
"allowed" : "denied")
@@ -427,9 +427,9 @@
                                     context.setThrottleId(id);
                                 }
                                 //Checks access state
-                                canAccess = accessControler.canAccess(context,
+                                AccessInformation accessInformation= 
accessControler.canAccess(context,
                                     callerId, ThrottleConstants.IP_BASE);
-
+                                canAccess  = 
accessInformation.isAccessAllowed();
                                 if (traceOrDebugOn) {
                                     traceOrDebug(traceOn, "Access " +
                                         (canAccess ? "allowed" : "denied")

Modified: 
branches/synapse/1.2.wso2v1/modules/extensions/src/test/java/org/apache/synapse/mediators/throttle/ThrottleMediatorTest.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/extensions/src/test/java/org/apache/synapse/mediators/throttle/ThrottleMediatorTest.java?rev=28909&r1=28908&r2=28909&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/extensions/src/test/java/org/apache/synapse/mediators/throttle/ThrottleMediatorTest.java
        (original)
+++ 
branches/synapse/1.2.wso2v1/modules/extensions/src/test/java/org/apache/synapse/mediators/throttle/ThrottleMediatorTest.java
        Sun Jan 18 23:06:10 2009
@@ -27,8 +27,8 @@
 import org.apache.neethi.PolicyEngine;
 import org.apache.synapse.MessageContext;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.config.Entry;
+import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.core.SynapseEnvironment;
 import org.apache.synapse.core.axis2.Axis2MessageContext;
 import org.apache.synapse.core.axis2.Axis2SynapseEnvironment;
@@ -129,8 +129,7 @@
             XMLStreamReader reader = XMLInputFactory
                     .newInstance().createXMLStreamReader(new 
StringReader(xml));
             StAXOMBuilder builder = new StAXOMBuilder(reader);
-            OMElement omElement = builder.getDocumentElement();
-            return omElement;
+            return builder.getDocumentElement();
         }
         catch (XMLStreamException e) {
             throw new RuntimeException(e);
@@ -244,7 +243,8 @@
                 AccessRateController accessControler;
                 try {
                     accessControler =new AccessRateController();
-                    boolean canAccess = 
accessControler.canAccess(throttleContext, remoteIP,ThrottleConstants.IP_BASE);
+                    boolean canAccess = accessControler.canAccess(
+                            throttleContext, remoteIP, 
ThrottleConstants.IP_BASE).isAccessAllowed();
                     if (!canAccess) {
                         throw new SynapseException("Access has currently been 
denied by the IP_BASE throttle for IP :\t" + remoteIP);
                     }
@@ -296,8 +296,7 @@
         protected void createThrottleMetaData(OMElement policyOmElement) {
 
             try {
-                throttle = ThrottlePolicyProcessor
-                        
.processPolicy(PolicyEngine.getPolicy(policyOmElement));
+                throttle = 
ThrottleFactory.createServiceThrottle(PolicyEngine.getPolicy(policyOmElement));
             }
             catch (ThrottleException e) {
 

Modified: branches/synapse/1.2.wso2v1/pom.xml
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/pom.xml?rev=28909&r1=28908&r2=28909&view=diff
==============================================================================
--- branches/synapse/1.2.wso2v1/pom.xml (original)
+++ branches/synapse/1.2.wso2v1/pom.xml Sun Jan 18 23:06:10 2009
@@ -1208,7 +1208,7 @@
         <!-- dependencies of Synapse extensions module -->
         <wso2commons.version>1.2</wso2commons.version>
         <wso2caching.version>1.6.1</wso2caching.version>
-        <wso2throttle.version>1.6</wso2throttle.version>
+        <wso2throttle.version>SNAPSHOT</wso2throttle.version>
         <spring.version>1.2.8</spring.version>
         <springws.version>1.0.3</springws.version>
         <xbean.version>2.2.0</xbean.version>

_______________________________________________
Esb-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to