cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r751784 - in /cxf/trunk/rt/ws/policy/src/main: java/org/apache/cxf/ws/policy/ resources/schemas/
Date Mon, 09 Mar 2009 18:15:38 GMT
Author: dkulp
Date: Mon Mar  9 18:15:37 2009
New Revision: 751784

URL: http://svn.apache.org/viewvc?rev=751784&view=rev
Log:
Add ability to turn off the policy engine (since it now defaults to on)


Modified:
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
    cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy.xsd

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java?rev=751784&r1=751783&r2=751784&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
Mon Mar  9 18:15:37 2009
@@ -39,7 +39,8 @@
  * 
  */
 public class ClientPolicyInFaultInterceptor extends AbstractPolicyInterceptor {
-
+    public static final ClientPolicyInFaultInterceptor INSTANCE = new ClientPolicyInFaultInterceptor();
+    
     private static final Logger LOG = LogUtils.getL7dLogger(ClientPolicyInFaultInterceptor.class);
     
     public ClientPolicyInFaultInterceptor() {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=751784&r1=751783&r2=751784&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Mon
Mar  9 18:15:37 2009
@@ -111,9 +111,10 @@
 
     public synchronized void setEnabled(boolean e) {
         enabled = e;
-    
-        if (!addedBusInterceptors) {
+        if (enabled && !addedBusInterceptors) {
             addBusInterceptors();
+        } else if (!enabled && addedBusInterceptors) {
+            removeBusInterceptors();
         }
     }
 
@@ -292,9 +293,17 @@
     }
 
 
+    public synchronized void removeBusInterceptors() {
+        bus.getInInterceptors().remove(PolicyInInterceptor.INSTANCE);
+        bus.getOutInterceptors().remove(PolicyOutInterceptor.INSTANCE);
+        bus.getInFaultInterceptors().remove(ClientPolicyInFaultInterceptor.INSTANCE);
+        bus.getOutFaultInterceptors().remove(ServerPolicyOutFaultInterceptor.INSTANCE);
+        bus.getInFaultInterceptors().add(PolicyVerificationInFaultInterceptor.INSTANCE);
+        addedBusInterceptors = false;
+    }
 
     @PostConstruct
-    public void addBusInterceptors() {
+    public synchronized void addBusInterceptors() {
     
         if (null == alternativeSelector) {
             alternativeSelector = new MinimalAlternativeSelector();
@@ -309,18 +318,11 @@
             abr.setIgnoreUnknownAssertions(ignoreUnknownAssertions);
         }
 
-        PolicyInInterceptor serverIn = new PolicyInInterceptor();
-        bus.getInInterceptors().add(serverIn);
-        PolicyOutInterceptor serverOut = new PolicyOutInterceptor();
-        bus.getOutInterceptors().add(serverOut);
-        
-        
-        ClientPolicyInFaultInterceptor clientInFault = new ClientPolicyInFaultInterceptor();
-        bus.getInFaultInterceptors().add(clientInFault);
-        ServerPolicyOutFaultInterceptor serverOutFault = new ServerPolicyOutFaultInterceptor();
-        bus.getOutFaultInterceptors().add(serverOutFault);
-        PolicyVerificationInFaultInterceptor verifyInFault = new PolicyVerificationInFaultInterceptor();
-        bus.getInFaultInterceptors().add(verifyInFault);
+        bus.getInInterceptors().add(PolicyInInterceptor.INSTANCE);
+        bus.getOutInterceptors().add(PolicyOutInterceptor.INSTANCE);
+        bus.getInFaultInterceptors().add(ClientPolicyInFaultInterceptor.INSTANCE);
+        bus.getOutFaultInterceptors().add(ServerPolicyOutFaultInterceptor.INSTANCE);
+        bus.getInFaultInterceptors().add(PolicyVerificationInFaultInterceptor.INSTANCE);
     
         addedBusInterceptors = true;
     }  

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java?rev=751784&r1=751783&r2=751784&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
Mon Mar  9 18:15:37 2009
@@ -41,7 +41,8 @@
  * 
  */
 public class PolicyInInterceptor extends AbstractPolicyInterceptor {
-
+    public static final PolicyInInterceptor INSTANCE = new PolicyInInterceptor();
+    
     private static final Logger LOG = LogUtils.getL7dLogger(PolicyInInterceptor.class);
     
     public PolicyInInterceptor() {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java?rev=751784&r1=751783&r2=751784&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
Mon Mar  9 18:15:37 2009
@@ -41,7 +41,8 @@
  * 
  */
 public class PolicyOutInterceptor extends AbstractPolicyInterceptor {
-
+    public static final PolicyOutInterceptor INSTANCE = new PolicyOutInterceptor();
+    
     private static final Logger LOG = LogUtils.getL7dLogger(PolicyOutInterceptor.class);
     
     public PolicyOutInterceptor() {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java?rev=751784&r1=751783&r2=751784&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
Mon Mar  9 18:15:37 2009
@@ -36,7 +36,8 @@
  * 
  */
 public class PolicyVerificationInFaultInterceptor extends AbstractPolicyInterceptor {
-
+    public static final PolicyVerificationInFaultInterceptor INSTANCE 
+        = new PolicyVerificationInFaultInterceptor();
     private static final Logger LOG 
         = LogUtils.getL7dLogger(PolicyVerificationInFaultInterceptor.class);
 

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java?rev=751784&r1=751783&r2=751784&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
Mon Mar  9 18:15:37 2009
@@ -41,7 +41,7 @@
  * 
  */
 public class ServerPolicyOutFaultInterceptor extends AbstractPolicyInterceptor {
-
+    public static final ServerPolicyOutFaultInterceptor INSTANCE = new ServerPolicyOutFaultInterceptor();
     private static final Logger LOG = LogUtils.getL7dLogger(ServerPolicyOutFaultInterceptor.class);
     
     public ServerPolicyOutFaultInterceptor() {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java?rev=751784&r1=751783&r2=751784&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java Mon
Mar  9 18:15:37 2009
@@ -62,8 +62,10 @@
     private boolean ignoreUnknownAssertions;
     private AlternativeSelector alternativeSelector; 
     private ApplicationContext context;
+    private boolean enabled = true;
   
        
+
     public WSPolicyFeature() {
         super();
     }
@@ -73,6 +75,14 @@
         policies = new ArrayList<Policy>();
         Collections.addAll(policies, ps);
     }
+
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
     
     public void setApplicationContext(ApplicationContext c) throws BeansException {
         context = c;  
@@ -87,7 +97,7 @@
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         
         synchronized (pe) {
-            pe.setEnabled(true);
+            pe.setEnabled(enabled);
             pe.setIgnoreUnknownAssertions(ignoreUnknownAssertions);
             if (null != alternativeSelector) {
                 pe.setAlternativeSelector(alternativeSelector);

Modified: cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy.xsd?rev=751784&r1=751783&r2=751784&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy.xsd (original)
+++ cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy.xsd Mon Mar  9 18:15:37 2009
@@ -62,6 +62,7 @@
       <xsd:attribute name="ignoreUnknownAssertions" type="xsd:boolean" default="false"/>
       <xsd:attribute name="namespace" type="xsd:string"/>
       <xsd:attribute name="id" type="xsd:string"/>
+      <xsd:attribute name="enabled" type="xsd:boolean"/>
     </xsd:complexType>
   </xsd:element>
   



Mime
View raw message