cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashaki...@apache.org
Subject git commit: Activated UriDomainExpressionBuilder by default
Date Mon, 07 Jul 2014 09:12:27 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 9a5231905 -> 3cd2f8f4a


Activated UriDomainExpressionBuilder by default


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3cd2f8f4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3cd2f8f4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3cd2f8f4

Branch: refs/heads/master
Commit: 3cd2f8f4a1c6786be106b8b1fb23ef62e77dc698
Parents: 9a52319
Author: Andrei Shakirin <andrei.shakirin@gmail.com>
Authored: Mon Jul 7 11:12:12 2014 +0200
Committer: Andrei Shakirin <andrei.shakirin@gmail.com>
Committed: Mon Jul 7 11:12:12 2014 +0200

----------------------------------------------------------------------
 .../resources/META-INF/cxf/bus-extensions.txt   |  1 +
 .../JavaFirstURIDomainExpressionBuilder.java    | 45 +++++++++++
 .../ws/policy/JavaFirstUriDomainExpression.java | 79 ++++++++++++++++++++
 .../ws/policy/URIDomainExpressionBuilder.java   | 45 -----------
 .../systest/ws/policy/UriDomainExpression.java  | 79 --------------------
 .../ws/policy/UriDomainFactoryBeanListener.java | 42 +++++++++++
 .../resources/META-INF/cxf/bus-extensions.txt   |  1 +
 .../cxf/systest/ws/policy/javafirstserver.xml   |  2 +-
 8 files changed, 169 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/3cd2f8f4/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt
----------------------------------------------------------------------
diff --git a/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt b/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt
index 5202c31..71ab8b0 100644
--- a/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt
+++ b/rt/ws/policy/src/main/resources/META-INF/cxf/bus-extensions.txt
@@ -8,6 +8,7 @@ org.apache.cxf.ws.policy.PolicyAnnotationListener::true
 org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider::true
 org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry::true
 org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder::true
+org.apache.cxf.ws.policy.attachment.external.URIDomainExpressionBuilder::true
 org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider::true:true
 # MTOM Policy Support
 org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder::true

http://git-wip-us.apache.org/repos/asf/cxf/blob/3cd2f8f4/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstURIDomainExpressionBuilder.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstURIDomainExpressionBuilder.java
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstURIDomainExpressionBuilder.java
new file mode 100644
index 0000000..3a7bb0c
--- /dev/null
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstURIDomainExpressionBuilder.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.ws.policy;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.policy.attachment.external.DomainExpression;
+import org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilder;
+
+public class JavaFirstURIDomainExpressionBuilder implements DomainExpressionBuilder {
+    private static final Collection<QName> SUPPORTED_TYPES = Collections.unmodifiableList(
+             Arrays.asList(new QName[] {
+                 new QName("http://www.w3.org/ns/ws-policy", "URI"),
+                 new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "URI")}));
+
+    @Override
+    public DomainExpression build(Element paramElement) {
+        return new JavaFirstUriDomainExpression(paramElement.getTextContent());
+    }
+
+    @Override
+    public Collection<QName> getDomainExpressionTypes() {
+        return SUPPORTED_TYPES;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/3cd2f8f4/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstUriDomainExpression.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstUriDomainExpression.java
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstUriDomainExpression.java
new file mode 100644
index 0000000..ee649f2
--- /dev/null
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstUriDomainExpression.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.ws.policy;
+
+import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingMessageInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.ws.policy.attachment.external.DomainExpression;
+
+public class JavaFirstUriDomainExpression implements DomainExpression {
+    private final String url;
+    
+    public JavaFirstUriDomainExpression(final String url) {
+        this.url = url;
+    }
+
+    @Override
+    public boolean appliesTo(BindingFaultInfo paramBindingFaultInfo) {
+        return false;
+    }
+
+    @Override
+    public boolean appliesTo(BindingMessageInfo bmi) {
+        String serviceName = 
+            bmi.getBindingOperation().getBinding().getService().getName().getLocalPart();
+        
+        if ("JavaFirstAttachmentPolicyService".equals(serviceName) && "usernamepassword".equals(url))
{
+            return ("doInputMessagePolicy".equals(bmi.getBindingOperation().getName().getLocalPart())

+                && MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType()))
+                || ("doOutputMessagePolicy".equals(bmi.getBindingOperation().getName().getLocalPart())

+                && MessageInfo.Type.OUTPUT.equals(bmi.getMessageInfo().getType()));
+        } else if ("SslUsernamePasswordAttachmentService".equals(serviceName) 
+            && "sslusernamepassword".equals(url)) {
+            return MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType());
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public boolean appliesTo(BindingOperationInfo boi) {
+        if ("usernamepassword".equals(url)) {
+            return "doOperationLevelPolicy".equals(boi.getName().getLocalPart());
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public boolean appliesTo(EndpointInfo paramEndpointInfo) {
+        return false;
+    }
+
+    @Override
+    public boolean appliesTo(ServiceInfo paramServiceInfo) {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/3cd2f8f4/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
deleted file mode 100644
index 9435535..0000000
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.cxf.systest.ws.policy;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import javax.xml.namespace.QName;
-import org.w3c.dom.Element;
-import org.apache.cxf.ws.policy.attachment.external.DomainExpression;
-import org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilder;
-
-public class URIDomainExpressionBuilder implements DomainExpressionBuilder {
-    private static final Collection<QName> SUPPORTED_TYPES = Collections.unmodifiableList(
-             Arrays.asList(new QName[] {
-                 new QName("http://www.w3.org/ns/ws-policy", "URI"),
-                 new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "URI")}));
-
-    @Override
-    public DomainExpression build(Element paramElement) {
-        return new UriDomainExpression(paramElement.getTextContent());
-    }
-
-    @Override
-    public Collection<QName> getDomainExpressionTypes() {
-        return SUPPORTED_TYPES;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/3cd2f8f4/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
deleted file mode 100644
index fcd7809..0000000
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.cxf.systest.ws.policy;
-
-import org.apache.cxf.service.model.BindingFaultInfo;
-import org.apache.cxf.service.model.BindingMessageInfo;
-import org.apache.cxf.service.model.BindingOperationInfo;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.service.model.MessageInfo;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.ws.policy.attachment.external.DomainExpression;
-
-public class UriDomainExpression implements DomainExpression {
-    private final String url;
-    
-    public UriDomainExpression(final String url) {
-        this.url = url;
-    }
-
-    @Override
-    public boolean appliesTo(BindingFaultInfo paramBindingFaultInfo) {
-        return false;
-    }
-
-    @Override
-    public boolean appliesTo(BindingMessageInfo bmi) {
-        String serviceName = 
-            bmi.getBindingOperation().getBinding().getService().getName().getLocalPart();
-        
-        if ("JavaFirstAttachmentPolicyService".equals(serviceName) && "usernamepassword".equals(url))
{
-            return ("doInputMessagePolicy".equals(bmi.getBindingOperation().getName().getLocalPart())

-                && MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType()))
-                || ("doOutputMessagePolicy".equals(bmi.getBindingOperation().getName().getLocalPart())

-                && MessageInfo.Type.OUTPUT.equals(bmi.getMessageInfo().getType()));
-        } else if ("SslUsernamePasswordAttachmentService".equals(serviceName) 
-            && "sslusernamepassword".equals(url)) {
-            return MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType());
-        } else {
-            return false;
-        }
-    }
-
-    @Override
-    public boolean appliesTo(BindingOperationInfo boi) {
-        if ("usernamepassword".equals(url)) {
-            return "doOperationLevelPolicy".equals(boi.getName().getLocalPart());
-        } else {
-            return false;
-        }
-    }
-
-    @Override
-    public boolean appliesTo(EndpointInfo paramEndpointInfo) {
-        return false;
-    }
-
-    @Override
-    public boolean appliesTo(ServiceInfo paramServiceInfo) {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/3cd2f8f4/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainFactoryBeanListener.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainFactoryBeanListener.java
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainFactoryBeanListener.java
new file mode 100644
index 0000000..0317064
--- /dev/null
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainFactoryBeanListener.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.ws.policy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.bus.extension.ExtensionManager;
+import org.apache.cxf.bus.extension.ExtensionManagerImpl;
+import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
+import org.apache.cxf.service.factory.FactoryBeanListener;
+
+public class UriDomainFactoryBeanListener implements FactoryBeanListener {
+
+    @Override
+    public void handleEvent(Event ev, AbstractServiceFactoryBean factory, Object... args)
{
+        if (ev.equals(Event.START_CREATE)) {
+            // Remove original URIDomainExpressionBuilder to be replaced on custom one
+            ExtensionManagerImpl orig = (ExtensionManagerImpl)factory.getBus().getExtension(ExtensionManager.class);
+            List<String> names = new ArrayList<String>();
+            names.add(org.apache.cxf.ws.policy.attachment.external.URIDomainExpressionBuilder.class.getName());
+            ((ExtensionManagerImpl)orig).removeBeansOfNames(names);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/3cd2f8f4/systests/ws-security/src/test/resources/META-INF/cxf/bus-extensions.txt
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/META-INF/cxf/bus-extensions.txt b/systests/ws-security/src/test/resources/META-INF/cxf/bus-extensions.txt
new file mode 100644
index 0000000..e5da803
--- /dev/null
+++ b/systests/ws-security/src/test/resources/META-INF/cxf/bus-extensions.txt
@@ -0,0 +1 @@
+org.apache.cxf.systest.ws.policy.UriDomainFactoryBeanListener::true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/3cd2f8f4/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/javafirstserver.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/javafirstserver.xml
b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/javafirstserver.xml
index 4df452f..6ba01d5 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/javafirstserver.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/javafirstserver.xml
@@ -59,7 +59,7 @@
     <p:externalAttachment location="classpath:java_first_policies/UsernamePasswordAttachment.xml"/>
     <p:externalAttachment location="classpath:java_first_policies/SslUsernamePasswordAttachment.xml"/>
     <!-- register a policy attachment appliesto checker! -->
-    <bean id="uridomainexpressionbuilder" class="org.apache.cxf.systest.ws.policy.URIDomainExpressionBuilder"/>
+    <bean id="uridomainexpressionbuilder" class="org.apache.cxf.systest.ws.policy.JavaFirstURIDomainExpressionBuilder"/>
     <bean id="org.apache.cxf.systest.ws.policy.JavaFirstPolicyService" class="org.apache.cxf.systest.ws.policy.JavaFirstPolicyServiceImpl"/>
     <bean id="org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyService" class="org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyServiceImpl"/>
     <bean id="org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyService2" class="org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyServiceImpl"/>


Mime
View raw message