cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r498671 [1/3] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/ws/policy/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/main/java/org/apache/c...
Date Mon, 22 Jan 2007 16:17:32 GMT
Author: andreasmyth
Date: Mon Jan 22 08:17:27 2007
New Revision: 498671

URL: http://svn.apache.org/viewvc?view=rev&rev=498671
Log:
Start of a WS-Policy framework 
* using neethi for in memory representation of policy objects (policy, policy reference, assertion, etc.) and associated logic (merge, normalisation)
* axiom dependent parts of neethi replaced with CXF specific versions (interfaces for the latter will be relocated to the api module at a later stage)
* processing of wsdl 1.1 attachments to policy subjects port, port type and binding
Fixed service model to store extensions of the service element with ServiceInfo (in stead extensions of the global definition element).
Extended service model to allow access to extensors of definition/description element.

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractDescriptionElement.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAttachmentManager.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyException.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/AssertionBuilder.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertion.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilder.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/Messages.properties   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200409.xjb
      - copied, changed from r497413, incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy.xjb
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200409.xsd
      - copied unchanged from r497413, incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy.xsd
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200607.xjb   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200607.xsd   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAttachmentManagerTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/jaxb/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilderTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/jaxb/foo.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/calculator-abstract.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/calculator-binding.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/calculator.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/calculator.xsd   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test0.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test1.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test100.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test2.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test3.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test4.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test5.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test6.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test7.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test8.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test1.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test10.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test11.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test12.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test13.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test14.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test15.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test16.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test17.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test18.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test19.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test2.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test20.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test21.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test22.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test23.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test24.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test25.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test3.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test4.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test5.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test6.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test7.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test8.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/normalized/test9.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test1.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test10.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test11.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test12.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test13.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test14.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test15.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test16.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test17.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test18.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test19.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test2.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test20.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test21.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test22.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test23.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test24.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test25.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test3.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test4.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test5.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test6.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test7.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test8.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/samples/test9.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/schemas/
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/schemas/foo.xsd   (with props)
Removed:
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstantsImpl.java
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy.xjb
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy.xsd
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/rt/ws/policy/pom.xml
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
    incubator/cxf/trunk/rt/ws/rm/pom.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractDescriptionElement.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractDescriptionElement.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractDescriptionElement.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractDescriptionElement.java Mon Jan 22 08:17:27 2007
@@ -0,0 +1,34 @@
+/**
+ * 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.service.model;
+
+public abstract class AbstractDescriptionElement extends AbstractPropertiesHolder {
+
+    DescriptionInfo description;
+
+    public void setDescription(DescriptionInfo d) {
+        description = d;
+    }
+
+    public DescriptionInfo getDescription() {
+        return description;
+    }
+    
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractDescriptionElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractDescriptionElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java?view=diff&rev=498671&r1=498670&r2=498671
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java Mon Jan 22 08:17:27 2007
@@ -30,7 +30,7 @@
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 
-public class BindingInfo extends AbstractPropertiesHolder {
+public class BindingInfo extends AbstractDescriptionElement {
     
     private static final Logger LOG = LogUtils.getL7dLogger(BindingInfo.class);
     

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java Mon Jan 22 08:17:27 2007
@@ -0,0 +1,46 @@
+/**
+ * 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.service.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+public class DescriptionInfo extends AbstractPropertiesHolder {
+    QName name;
+    String uri;
+
+    List<AbstractDescriptionElement> described = new ArrayList<AbstractDescriptionElement>();
+
+    public DescriptionInfo() {
+    }
+    
+    public void setName(QName n) {
+        name = n;
+    }
+    public QName getName() {
+        return name;
+    }
+   
+    public List<AbstractDescriptionElement> getDescribed() {
+        return described;
+    }
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java?view=diff&rev=498671&r1=498670&r2=498671
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java Mon Jan 22 08:17:27 2007
@@ -21,7 +21,7 @@
 
 import javax.xml.namespace.QName;
 
-public class EndpointInfo extends AbstractPropertiesHolder {
+public class EndpointInfo extends AbstractDescriptionElement {
     String transportId;
     ServiceInfo service;
     BindingInfo binding;

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java?view=diff&rev=498671&r1=498670&r2=498671
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java Mon Jan 22 08:17:27 2007
@@ -30,7 +30,7 @@
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 
-public class InterfaceInfo extends AbstractPropertiesHolder {
+public class InterfaceInfo extends AbstractDescriptionElement {
     private static final Logger LOG = LogUtils.getL7dLogger(InterfaceInfo.class);
     
     QName name;

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java?view=diff&rev=498671&r1=498670&r2=498671
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java Mon Jan 22 08:17:27 2007
@@ -27,10 +27,9 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import javax.xml.namespace.QName;
-
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 
-public class ServiceInfo extends AbstractPropertiesHolder {
+public class ServiceInfo extends AbstractDescriptionElement {
     QName name;
     String targetNamespace;
     InterfaceInfo intf;

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=498671&r1=498670&r2=498671
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Mon Jan 22 08:17:27 2007
@@ -56,6 +56,7 @@
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.DescriptionInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.FaultInfo;
 import org.apache.cxf.service.model.InterfaceInfo;
@@ -107,22 +108,41 @@
     
     @SuppressWarnings("unchecked")
     public List<ServiceInfo> buildService(Definition d) {
+        DescriptionInfo description = new DescriptionInfo();
+        description.setName(d.getQName());
+        copyExtensors(description, d.getExtensibilityElements());
+       
         List<ServiceInfo> serviceList = new ArrayList<ServiceInfo>();
         for (java.util.Iterator<QName> ite = d.getServices().keySet().iterator(); ite.hasNext();) {
             QName qn = ite.next();            
-            serviceList.add(buildService(d, qn));
+            serviceList.add(buildService(d, qn, description));
         }
         return serviceList;
     }
 
     public ServiceInfo buildService(Definition d, QName name) {
-        Service service = d.getService(name);
+        return buildService(d, name, null);
+    }
 
-        return buildService(d, service);
+    private ServiceInfo buildService(Definition d, QName name, DescriptionInfo description) {
+        Service service = d.getService(name);
+        return buildService(d, service, description);
     }
 
     public ServiceInfo buildService(Definition def, Service serv) {
+        return buildService(def, serv, null);
+    }
+
+    private ServiceInfo buildService(Definition def, Service serv, DescriptionInfo d) {
+        DescriptionInfo description = d;
+        if (null == description) {
+            description = new DescriptionInfo();
+            description.setName(def.getQName());
+            copyExtensors(description, def.getExtensibilityElements());
+        }
         ServiceInfo service = new ServiceInfo();
+        service.setDescription(description);
+        description.getDescribed().add(service);
         service.setProperty(WSDL_DEFINITION, def);
         service.setProperty(WSDL_SERVICE, serv);
 
@@ -130,7 +150,7 @@
         service.setProperty(WSDL_SCHEMA_LIST, schemas);
         service.setTargetNamespace(def.getTargetNamespace());
         service.setName(serv.getQName());
-        copyExtensors(service, def.getExtensibilityElements());
+        copyExtensors(service, serv.getExtensibilityElements());
 
         PortType portType = null;
         for (Port port : cast(serv.getPorts().values(), Port.class)) {
@@ -251,6 +271,11 @@
         copyExtensors(ei, port.getExtensibilityElements());
 
         service.addEndpoint(ei);
+        DescriptionInfo d = service.getDescription();
+        if (null != d) {
+            ei.setDescription(d);
+            d.getDescribed().add(ei);
+        }
         return ei;
     }
 
@@ -302,6 +327,11 @@
         }
 
         service.addBinding(bi);
+        DescriptionInfo d = service.getDescription();
+        if (null != d) {
+            bi.setDescription(d);
+            d.getDescribed().add(bi);
+        }
         return bi;
     }
 
@@ -323,6 +353,11 @@
 
     public void buildInterface(ServiceInfo si, PortType p) {
         InterfaceInfo inf = si.createInterface(p.getQName());
+        DescriptionInfo d = si.getDescription();
+        if (null != d) {
+            inf.setDescription(si.getDescription());
+            d.getDescribed().add(inf);
+        }
         this.copyExtensors(inf, p.getExtensibilityElements());
         inf.setProperty(WSDL_PORTTYPE, p);
         for (Operation op : cast(p.getOperations(), Operation.class)) {

Modified: incubator/cxf/trunk/rt/ws/policy/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/pom.xml?view=diff&rev=498671&r1=498670&r2=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/pom.xml (original)
+++ incubator/cxf/trunk/rt/ws/policy/pom.xml Mon Jan 22 08:17:27 2007
@@ -1,5 +1,5 @@
 <!--
-  Licensed to the Apache Software Foundation (ASF) under one
+ .  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
@@ -35,8 +35,70 @@
 
     <dependencies>
         <dependency>
+            <groupId>org.apache.ws.commons.neethi</groupId>
+            <artifactId>neethi</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.ws</groupId>
+            <artifactId>jaxws-api</artifactId>
+        </dependency>
+	<dependency>
+	    <groupId>javax.annotation</groupId>
+	    <artifactId>jsr250-api</artifactId>
+	</dependency>
+        <!--
+        <dependency>
             <groupId>javax.xml.ws</groupId>
             <artifactId>jaxws-api</artifactId>
+        </dependency>
+        -->
+        <!--
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+        </dependency>
+        -->
+        <!--
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        -->
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-common-utilities</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-core</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymockclassextension</artifactId>
+            <scope>test</scope>
         </dependency>  
     </dependencies>
 
@@ -54,18 +116,64 @@
                             <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
                             <xsdOptions>
                                 <xsdOption>
-                                    <xsd>${basedir}/src/main/resources/schemas/ws-policy.xsd</xsd>
-                                    <bindingFile>${basedir}/src/main/resources/schemas/ws-policy.xjb</bindingFile>
+                                    <xsd>${basedir}/src/main/resources/schemas/ws-policy-200409.xsd</xsd>
+                                    <bindingFile>${basedir}/src/main/resources/schemas/ws-policy-200409.xjb</bindingFile>
                                     <catalog>${basedir}/src/main/resources/schemas/catalog.cat</catalog>
                                     <deleteDirs>
                                         <deleteDir>${basedir}/target/generated/src/main/java/org/oasis_open</deleteDir>
                                         <deleteDir>${basedir}/target/generated/src/main/java/org/w3</deleteDir>
                                     </deleteDirs>
                                 </xsdOption>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/main/resources/schemas/ws-policy-200607.xsd</xsd>
+                                    <bindingFile>${basedir}/src/main/resources/schemas/ws-policy-200607.xjb</bindingFile>
+                                    <catalog>${basedir}/src/main/resources/schemas/catalog.cat</catalog>
+                                    <deleteDirs>
+                                        <deleteDir>${basedir}/target/generated/src/main/java/org/oasis_open</deleteDir>
+                                        <deleteDir>${basedir}/target/generated/src/main/java/org/w3</deleteDir>
+                                    </deleteDirs>
+                                </xsdOption>
+                            </xsdOptions>
+                        </configuration>
+                        <goals>
+                            <goal>xsdtojava</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>generate-test-sources</id>
+                        <phase>generate-test-sources</phase>
+                        <configuration>
+                            <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
+                            <xsdOptions>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/test/resources/schemas/foo.xsd</xsd>
+                                </xsdOption>
                             </xsdOptions>
                         </configuration>
                         <goals>
                             <goal>xsdtojava</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-codegen-plugin</artifactId>
+                <version>${project.version}</version>
+                <executions>
+                    <execution>
+                        <id>generate-test-sources</id>
+                        <phase>generate-test-sources</phase>
+                        <configuration>
+                            <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>                            
+                            <wsdlOptions>
+                                <wsdlOption>
+                                    <wsdl>${basedir}/src/test/resources/attachment/wsdl11/calculator-binding.wsdl</wsdl>
+                                </wsdlOption>
+                            </wsdlOptions>
+                        </configuration>
+                        <goals>
+                            <goal>wsdl2java</goal>
                         </goals>
                     </execution>
                 </executions>

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java Mon Jan 22 08:17:27 2007
@@ -0,0 +1,112 @@
+/**
+ * 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.ws.policy;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.ws.policy.builders.AssertionBuilder;
+import org.apache.neethi.Assertion;
+
+
+/**
+ * AssertionBuilderRegistry is used to manage AssertionBuilders and
+ * create Assertion objects from given xml elements.
+ */
+public class AssertionBuilderRegistry {
+
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AssertionBuilderRegistry.class);
+
+    private Bus bus;
+    private Map<QName, AssertionBuilder> builders 
+        = new HashMap<QName, AssertionBuilder>();
+    
+    public AssertionBuilderRegistry() {
+    }
+
+    public Bus getBus() {
+        return bus;
+    }
+
+    @Resource
+    public void setBus(Bus b) {
+        bus = b;
+    }
+    
+    @PostConstruct
+    public void register() {
+        if (null != bus) {
+            bus.setExtension(this, AssertionBuilderRegistry.class);
+        }
+    }
+
+    /**
+     * Registers an AssertionBuilder with a specified QName. 
+     *  
+     * @param key the QName that the AssertionBuilder understands.
+     * @param builder the AssertionBuilder that can build an Assertion from
+     * an element of the type specified by the QName.
+     */
+    public void registerBuilder(QName key, AssertionBuilder builder) {
+        builders.put(key, builder);
+    }
+
+    /**
+     * Returns an assertion that is built using the specified xml element.
+     * 
+     * @param element the element from which to build an Assertion.
+     * @return an Assertion that is built using the specified element.
+     */
+    public Assertion build(Element element) {
+
+        AssertionBuilder builder;
+
+        QName qname = new QName(element.getNamespaceURI(), element.getLocalName());
+        builder = (AssertionBuilder) builders.get(qname);
+        
+        if (null == builder) {
+            throw new PolicyException(new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString()));
+        }
+
+        return builder.build(element);
+        
+    }
+    
+    /**
+     * Returns an AssertionBuilder that can build an Assertion for an xml element with
+     * the specified type.
+     * 
+     * @param qname the type for which an assertion builder is requested
+     * @return an AssertionBuilder that understands the type
+     */
+    public AssertionBuilder getBuilder(QName qname) {
+        return builders.get(qname);
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties Mon Jan 22 08:17:27 2007
@@ -0,0 +1,24 @@
+#
+#
+#    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.
+#
+#
+NO_ASSERTIONBUILDER_EXC = No assertion builder for type {0} registered.
+REMOTE_POLICY_RESOLUTION_NOT_SUPPORTED_EXC = Resolution of remote policies is not supported.
+NOT_A_POLICY_ELEMENT_EXC = Specified element is not a Policy element.
+NOT_A_POLICYREF_ELEMENT_EXC = Specified element is not a PolicyReference element.
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAttachmentManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAttachmentManager.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAttachmentManager.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAttachmentManager.java Mon Jan 22 08:17:27 2007
@@ -0,0 +1,153 @@
+/**
+ * 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.ws.policy;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.service.model.AbstractDescriptionElement;
+import org.apache.cxf.service.model.DescriptionInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyReference;
+
+
+/**
+ * PolicyAttachmentManager provides methods to retrieve element policies and
+ * calculate effective policies based on the policy subject's scope.
+ * Currently supports WSDL 1.1 only.
+ * To transparently support both WSDL 2.0 and WSDL 1.1, convert this class
+ * to an interface and provide implementations for WSDL 1.1, WSDL 2.0.
+ * The WSDL version can be retrieved from the service model.
+ * 
+ */
+public class PolicyAttachmentManager {
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(PolicyAttachmentManager.class);
+    
+    private PolicyBuilder builder;
+    private Map<DescriptionInfo, Map<String, Policy>> resolved = 
+        new HashMap<DescriptionInfo, Map<String, Policy>>();
+    
+    void setBuilder(PolicyBuilder b) {
+        builder = b;
+    }
+    
+    Policy getEffectivePolicy(ServiceInfo si) {
+        return getSubjectPolicy(si);
+    }
+    
+    Policy getSubjectPolicy(ServiceInfo si) {
+        return getElementPolicy(si);
+    }
+      
+    Policy getEffectivePolicy(EndpointInfo ei) {
+        Policy p = getSubjectPolicy(ei.getService());
+        return p.merge(getSubjectPolicy(ei));
+    }
+    
+    Policy getSubjectPolicy(EndpointInfo ei) {
+        Policy p = getElementPolicy(ei);
+        p = p.merge(getElementPolicy(ei.getInterface()));
+        p = p.merge(getElementPolicy(ei.getBinding()));
+        return p;
+    }
+
+    Policy getElementPolicy(AbstractDescriptionElement aph) {
+        List<UnknownExtensibilityElement> extensions = 
+            aph.getExtensors(UnknownExtensibilityElement.class);
+        
+        Policy elementPolicy = new Policy();
+        
+        if (null != extensions) {
+            
+            for (UnknownExtensibilityElement e : extensions) {
+                Policy p = null;
+                if (PolicyConstants.getPolicyQName().equals(e.getElementType())) {
+                    p = builder.getPolicy(e.getElement());
+
+                } else if (PolicyConstants.getPolicyReferenceQName().equals(e.getElementType())) {
+                    PolicyReference ref = builder.getPolicyReference(e.getElement());
+                    if (null != ref) {
+                        p = resolveReference(ref, aph);
+                    }
+                }
+                if (null != p) { 
+                    elementPolicy = elementPolicy.merge(p);
+                }
+            }
+        }
+
+        return elementPolicy;
+    }
+    
+    
+    Policy resolveReference(PolicyReference ref, AbstractDescriptionElement aph) {
+        String uri = ref.getURI();
+        if (isExternal(ref)) {
+            return resolveExternal(ref);
+        }
+        
+        DescriptionInfo description = aph.getDescription();  
+        return resolveLocal(uri, description);
+    }
+
+    Policy resolveLocal(String uri, DescriptionInfo description) {
+        Policy p = null;
+        Map<String, Policy> policyMap = resolved.get(description);
+        if (null == policyMap) {
+            policyMap = new HashMap<String, Policy>();
+            resolved.put(description, policyMap);
+        } else {
+            p = policyMap.get(uri);
+            if (null != p) {
+                return p;
+            }
+        }
+        
+        List<UnknownExtensibilityElement> extensions = 
+            description.getExtensors(UnknownExtensibilityElement.class);
+        for (UnknownExtensibilityElement e : extensions) {
+            if (PolicyConstants.getPolicyQName().equals(e.getElementType())) {
+                p = builder.getPolicy(e.getElement());
+                if (uri.equals(p.getId())) {
+                    policyMap.put(uri, p);
+                    return p;
+                }                
+            }
+        }
+        return null;
+    }
+    
+    Policy resolveExternal(PolicyReference ref) {
+        throw new PolicyException(new Message("REMOTE_POLICY_RESOLUTION_NOT_SUPPORTED_EXC", BUNDLE));
+    }
+    
+    private boolean isExternal(PolicyReference ref) {
+        return !ref.getURI().startsWith("#");
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAttachmentManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAttachmentManager.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java Mon Jan 22 08:17:27 2007
@@ -0,0 +1,196 @@
+/**
+ * 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.ws.policy;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ResourceBundle;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+import org.xml.sax.SAXException;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyOperator;
+import org.apache.neethi.PolicyReference;
+
+/**
+ * PolicyBuilder provides methods to create Policy and PolicyReferenceObjects
+ * from an inout stream, an xml element etc.
+ * It maintains a reference to the PolicyManager so that is can use the 
+ * AssertionBuilderFactories registered with the PolicyManager when creating a
+ * Policy object from an xml element.
+ */
+public class PolicyBuilder {
+    
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(PolicyBuilder.class);
+    private AssertionBuilderRegistry assertionBuilderRegistry;
+    
+    void setAssertionBuilderRegistry(AssertionBuilderRegistry abr) {
+        assertionBuilderRegistry = abr;        
+    }
+    
+    /**
+     * Creates a PolicyReference object from an InputStream.
+     * 
+     * @param inputStream the input stream
+     * @return the PolicyReference constructed from the input stream
+     */
+    public PolicyReference getPolicyReference(InputStream is)
+        throws IOException, ParserConfigurationException, SAXException {
+        Element element = DOMUtils.readXml(is).getDocumentElement();
+        return getPolicyReference(element);
+    }
+    
+    /**
+     * Creates a PolicyReference object from an xml element.
+     * 
+     * @param element the xml element
+     * @return the PolicyReference object constructed from the element
+     */
+    public PolicyReference getPolicyReference(Element element) {
+        if (!(Constants.URI_POLICY_NS.equals(element.getNamespaceURI())
+            && Constants.ELEM_POLICY_REF.equals(element.getLocalName()))) {
+            throw new PolicyException(new Message("NOT_A_POLICYREF_ELEMENT", BUNDLE));
+        }
+
+        PolicyReference reference = new PolicyReference();
+        
+        // setting the URI value
+        String uri = element.getAttribute("URI");
+        if (uri.startsWith("#")) {
+            uri = element.getBaseURI() + uri;
+        }
+        reference.setURI(uri);
+        return reference;
+    }
+    
+    /**
+     * Creates a Policy object from an InputStream.
+     * 
+     * @param inputStream the input stream
+     * @return the Policy object constructed from the input stream
+     */
+    public Policy getPolicy(InputStream is) 
+        throws IOException, ParserConfigurationException, SAXException {
+        Element element = DOMUtils.readXml(is).getDocumentElement();
+        return getPolicy(element);
+    }
+    
+    /**
+     * Creates a Policy object from an xml element.
+     * 
+     * @param element the xml element
+     * @retun the Policy object constructed from the element
+     */
+    public Policy getPolicy(Element element) {
+        return getPolicyOperator(element);
+    }
+    
+    private Policy getPolicyOperator(Element element) {
+        return (Policy) processOperationElement(element, new Policy());
+    }
+
+    private ExactlyOne getExactlyOneOperator(Element element) {
+        return (ExactlyOne) processOperationElement(element, new ExactlyOne());
+    }
+
+    private All getAllOperator(Element element) {
+        return (All) processOperationElement(element, new All());
+    }
+
+    private PolicyOperator processOperationElement(Element operationElement, PolicyOperator operator) {
+
+        
+        /*
+        System.out.println("Constructing policy operator from element of type: {"
+            + operationElement.getNamespaceURI() + "}" 
+            + operationElement.getLocalName());
+        }
+        */
+        
+        if (Constants.TYPE_POLICY == operator.getType()) {
+            Policy policyOperator = (Policy)operator;
+
+            QName key;
+
+            NamedNodeMap nnm = operationElement.getAttributes();
+            for (int i = 0; i < nnm.getLength(); i++) {
+                Node n = nnm.item(i);
+                if (Node.ATTRIBUTE_NODE == n.getNodeType()) {
+                    String namespace = n.getNamespaceURI();    
+                    if (namespace == null) {
+                        key = new QName(n.getLocalName());
+
+                    } else if (n.getPrefix() == null) {
+                        key = new QName(namespace, n.getLocalName());
+
+                    } else {
+                        key = new QName(namespace, n.getLocalName(), n.getPrefix());
+                    }
+                    policyOperator.addAttribute(key, n.getNodeValue());
+                }
+            }            
+        }
+
+        Element childElement;
+        for (Node n = operationElement.getFirstChild(); n != null; n = n.getNextSibling()) {
+            if (Node.ELEMENT_NODE != n.getNodeType()) {
+                continue;
+            }
+            childElement = (Element)n;
+            String namespaceURI = childElement.getNamespaceURI();
+            String localName = childElement.getLocalName();
+
+            if (Constants.URI_POLICY_NS.equals(namespaceURI)) {
+
+                if (Constants.ELEM_POLICY.equals(localName)) {
+                    operator.addPolicyComponent(getPolicyOperator(childElement));
+
+                } else if (Constants.ELEM_EXACTLYONE.equals(localName)) {
+                    operator.addPolicyComponent(getExactlyOneOperator(childElement));
+
+                } else if (Constants.ELEM_ALL.equals(localName)) {
+                    operator.addPolicyComponent(getAllOperator(childElement));
+
+                } else if (Constants.ELEM_POLICY_REF.equals(localName)) {
+                    operator.addPolicyComponent(getPolicyReference(childElement));
+                }
+
+            } else if (null != assertionBuilderRegistry) {
+                Assertion a = assertionBuilderRegistry.build(childElement);
+                operator.addPolicyComponent(a);
+            }
+        }
+        return operator;
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java?view=diff&rev=498671&r1=498670&r2=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java Mon Jan 22 08:17:27 2007
@@ -24,25 +24,48 @@
 /**
  * Encapsulation of version-specific WS-Policy constants.
  */
-public interface PolicyConstants {
+public final class PolicyConstants {
+    
+    private static final String NAMESPACE_URI = 
+        "http://schemas.xmlsoap.org/ws/2004/09/policy";
+    
+    private static final String POLICY_ELEM_NAME = "Policy";
+    
+    private static final String POLICYREF_ELEM_NAME = "PolicyReference";
+    
+    private static final QName POLICY_ELEM_QNAME = 
+        new QName(NAMESPACE_URI, POLICY_ELEM_NAME);
+    
+    private static final QName POLICYREF_QNAME = 
+        new QName(NAMESPACE_URI, POLICYREF_ELEM_NAME);
+    
+    
     /**
-     * @return namespace defined by the WS-Policy schema
+     * Prevents instantiation.
      */
-    String getNamespaceURI();
+    
+    private PolicyConstants() {
+    }
     
     /**
-     * @return namespace defined by the WS Security Utility schema
+     * @return namespace defined by the WS-Policy schema
      */
-    String getWSUNamespaceURI();
+    public static String getNamespaceURI() {
+        return NAMESPACE_URI;
+    }
     
     /**
      * @return the QName of the Policy element
      */
-    QName getPolicyQName();
+    public static QName getPolicyQName() {
+        return POLICY_ELEM_QNAME;
+    }
     
     /**
      * @return the QName of the PolicyReference element
      */
-    QName getPolicyReferenceQName();
+    public static QName getPolicyReferenceQName() {
+        return POLICYREF_QNAME;
+    }
     
 }

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyException.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyException.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyException.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyException.java Mon Jan 22 08:17:27 2007
@@ -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.ws.policy;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.i18n.UncheckedException;
+
+/**
+ * PolicyException is the type of RuntimeException thrown by any exceptions encountered
+ * by the policy framework.
+ */
+public class PolicyException extends UncheckedException {
+    public PolicyException(Message msg, Throwable t) {
+        super(msg, t);
+    }
+
+    public PolicyException(Message msg) {
+        super(msg);
+    }
+
+    public PolicyException(Throwable cause) {
+        super(cause);
+    }
+
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/AssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/AssertionBuilder.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/AssertionBuilder.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/AssertionBuilder.java Mon Jan 22 08:17:27 2007
@@ -0,0 +1,59 @@
+/**
+ * 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.ws.policy.builders;
+
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.neethi.Assertion;
+
+
+/**
+ * AssertionBuilder is an interface used to build an Assertion object from a
+ * given xml element. 
+ * Domain Policy authors write custom AssertionBuilders to build Assertions for 
+ * domain specific assertions. 
+ * Note that assertions can include nested policy expressions. To do so, they can
+ * obtain other AssertionBuilders by accessing the AssertionBuilderRegistry as a
+ * Bus extension, hence the registry is not passes as an argument here.
+ * 
+ */
+public interface AssertionBuilder {
+
+    /**
+     * Constructs an assertion from an xml element.
+     * 
+     * @param element the element from which to build an assertion
+     * @return an Assertion built from the given element
+     */
+    Assertion build(Element element);
+
+
+    /**
+     * Returns a collection of QNames describing the xml schema types for which this
+     * builder can build assertions.
+     * 
+     * @return collection of QNames of known schema types
+     */
+    Collection<QName> getKnownElements();
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/AssertionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/AssertionBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertion.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertion.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertion.java Mon Jan 22 08:17:27 2007
@@ -0,0 +1,111 @@
+/**
+ * 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.ws.policy.builders.jaxb;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+
+
+/**
+ * 
+ */
+public class JaxbAssertion<T> implements Assertion {
+    
+    private T data;
+    private QName name;
+    private boolean optional;
+    
+    void setData(T d) {
+        data = d;
+    }
+
+    void setName(QName n) {
+        name = n;
+    }
+    
+    void setOptional(boolean o) {
+        optional = o;
+    }
+    
+    public T getData() {
+        return data;
+    }
+    
+    public QName getName() {
+        return name;
+    }
+
+    public boolean isOptional() {
+        return optional;
+    }
+
+    /**
+     * Returns the partial normalized version of the wrapped element, that
+     * is assumed to be an assertion.
+     */
+    public PolicyComponent normalize() {
+        if (optional) {
+            Policy policy = new Policy();
+            ExactlyOne exactlyOne = new ExactlyOne();
+            All all = new All();
+            JaxbAssertion<T> a = new JaxbAssertion<T>();
+            a.setData(getData());
+            a.setName(getName());
+            all.addPolicyComponent(this);
+            exactlyOne.addPolicyComponent(all);
+            exactlyOne.addPolicyComponent(new All());
+            policy.addPolicyComponent(exactlyOne);
+            return policy;
+        }
+
+        return this;
+    }
+
+    public boolean equal(PolicyComponent policyComponent) {
+        if (policyComponent.getType() != Constants.TYPE_ASSERTION) {
+            return false;
+        }
+
+        if (!getName().equals(((Assertion)policyComponent).getName())) {
+            return false;
+        }
+        
+        return getData().equals(((JaxbAssertion)policyComponent).getData());
+    }
+
+    public short getType() {
+        return Constants.TYPE_ASSERTION;
+    }
+    
+    public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+        // TODO
+    }
+    
+
+    
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertion.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilder.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilder.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilder.java Mon Jan 22 08:17:27 2007
@@ -0,0 +1,92 @@
+/**
+ * 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.ws.policy.builders.jaxb;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.ws.policy.builders.AssertionBuilder;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+
+public class JaxbAssertionBuilder<T> implements AssertionBuilder {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(JaxbAssertionBuilder.class);
+    private Unmarshaller unmarshaller;
+    private Collection<QName> supportedTypes;
+    
+    
+    public JaxbAssertionBuilder(Class<T> type, QName qn) throws JAXBException {
+
+        JAXBContext context = JAXBContext.newInstance(type.getPackage().getName());
+        unmarshaller = context.createUnmarshaller();
+        supportedTypes = Collections.singletonList(qn);
+        
+    }
+   
+    
+    @SuppressWarnings("unchecked")
+    public Assertion build(Element element) {
+        Object obj = null;
+        try {
+            obj = unmarshaller.unmarshal(element);
+        } catch (JAXBException ex) {
+            LogUtils.log(LOG, Level.SEVERE, "UNMARSHAL_ELEMENT_EXC", ex);
+        }
+        if (obj instanceof JAXBElement<?>) {
+            JAXBElement<?> el = (JAXBElement<?>)obj;
+            obj = el.getValue();
+        } 
+
+        if (null != obj) {
+            if (LOG.isLoggable(Level.FINE)) {
+                LOG.fine("Unmarshaled element into object of type: " + obj.getClass().getName()
+                     + "    value: " + obj);
+            }
+            JaxbAssertion<T> a = new JaxbAssertion<T>();
+            a.setData((T)obj);
+            a.setName(new QName(element.getNamespaceURI(), element.getLocalName()));
+            String value = element.getAttributeNS(
+                               Constants.Q_ELEM_OPTIONAL_ATTR.getNamespaceURI(), 
+                               Constants.Q_ELEM_OPTIONAL_ATTR.getLocalPart());
+            if (Boolean.valueOf(value)) {
+                a.setOptional(true);
+            }
+            return a;
+        }
+        return null;
+    }
+    
+    public Collection<QName> getKnownElements() {
+        return supportedTypes;
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/Messages.properties?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/Messages.properties (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/Messages.properties Mon Jan 22 08:17:27 2007
@@ -0,0 +1 @@
+UNMARSHAL_ELEMENT_EXC = Failed to unmarshal element.
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java Mon Jan 22 08:17:27 2007
@@ -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.ws.policy.builders.xml;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.ws.policy.builders.AssertionBuilder;
+import org.apache.neethi.Assertion;
+
+public class XMLPrimitiveAssertionBuilder implements AssertionBuilder {
+
+    private Collection<QName> known = new ArrayList<QName>();
+    
+    public Assertion build(Element element) {
+        return new XmlPrimtiveAssertion(element);
+    }
+
+    public Collection<QName> getKnownElements() {
+        return known;
+    }
+    
+    
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java Mon Jan 22 08:17:27 2007
@@ -0,0 +1,162 @@
+/**
+ * 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.ws.policy.builders.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+
+
+/**
+ * XmlPrimitiveAssertion is a primitive implementation of an AssertionBuilder
+ * that simply wraps the underlying xml element.
+ * 
+ */
+public class XmlPrimtiveAssertion implements Assertion {
+
+    Element element;
+
+    boolean isOptional;
+
+    /**
+     * Constructs a XmlPrimitiveAssertion from an xml element.
+     * 
+     * @param element the xml element
+     */
+    public XmlPrimtiveAssertion(Element e) {
+        setValue(e);
+        setOptionality(e);
+    }
+
+    /**
+     * Returns the QName of the wrapped Element.
+     */
+    public QName getName() {
+        return (element != null) ? new QName(element.getNamespaceURI(), element.getLocalName()) : null;
+    }
+
+    /**
+     * Sets the wrapped xml element.
+     * 
+     * @param element the element to be wrapped
+     */
+    public final void setValue(Element e) {
+        element = e;
+    }
+
+    /**
+     * Returns the wrapped element.
+     * 
+     * @return the wrapped element
+     */
+    public Element getValue() {
+        return element;
+    }
+
+    /**
+     * Returns <tt>true</tt> if the wrapped element that is assumed to be an
+     * assertion, is optional.
+     */
+    public boolean isOptional() {
+        return isOptional;
+    }
+
+    /**
+     * Returns the partial normalized version of the wrapped element, that is
+     * assumed to be an assertion.
+     */
+    public PolicyComponent normalize() {
+        if (isOptional) {
+            Policy policy = new Policy();
+            ExactlyOne exactlyOne = new ExactlyOne();
+
+            All all = new All();
+            Element e = (Element)element.cloneNode(true);
+
+            e.removeAttributeNode(e.getAttributeNodeNS(Constants.Q_ELEM_OPTIONAL_ATTR.getNamespaceURI(),
+                                                       Constants.Q_ELEM_OPTIONAL_ATTR.getLocalPart()));
+            all.addPolicyComponent(new XmlPrimtiveAssertion(e));
+            exactlyOne.addPolicyComponent(all);
+
+            exactlyOne.addPolicyComponent(new All());
+            policy.addPolicyComponent(exactlyOne);
+
+            return policy;
+        }
+
+        return this;
+    }
+
+    /**
+     * Throws an UnsupportedOperationException since an assertion of an unknown
+     * element can't be fully normalized due to it's unknown composite.
+     */
+    public PolicyComponent normalize(boolean isDeep) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+        // TODO
+        /*
+        if (element != null) {
+            element.serialize(writer);
+
+        } else {
+            throw new RuntimeException("Wrapped Element is not set");
+        }
+        */
+    }
+
+    /**
+     * Returns Constants.TYPE_ASSERTION
+     */
+    public short getType() {
+        return Constants.TYPE_ASSERTION;
+    }
+
+    private void setOptionality(Element e) {
+        Attr attribute = e.getAttributeNodeNS(Constants.Q_ELEM_OPTIONAL_ATTR.getNamespaceURI(), 
+                                                    Constants.Q_ELEM_OPTIONAL_ATTR.getLocalPart());
+        if (attribute != null) {
+            this.isOptional = Boolean.valueOf(attribute.getValue());
+            
+        } else {
+            this.isOptional = false;
+        }
+    }
+
+    public boolean equal(PolicyComponent policyComponent) {
+        if (policyComponent.getType() != Constants.TYPE_ASSERTION) {
+            return false;
+        }
+
+        return getName().equals(((Assertion)policyComponent).getName());
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml Mon Jan 22 08:17:27 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+    
+    <bean id="org.apache.cxf.ws.policy.AssertionBuilderRegistry" class="org.apache.cxf.ws.policy.AssertionBuilderRegistry">
+        <property name="bus" ref="cxf"/>
+    </bean>
+    
+</beans>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200409.xjb (from r497413, incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy.xjb)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200409.xjb?view=diff&rev=498671&p1=incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy.xjb&r1=497413&p2=incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200409.xjb&r2=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy.xjb (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200409.xjb Mon Jan 22 08:17:27 2007
@@ -21,9 +21,9 @@
   xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
   xmlns:xs="http://www.w3.org/2001/XMLSchema" 
   jaxb:extensionBindingPrefixes="xjc">
-    <jaxb:bindings schemaLocation="ws-policy.xsd" node="/xs:schema">
+    <jaxb:bindings schemaLocation="ws-policy-200409.xsd" node="/xs:schema">
         <jaxb:schemaBindings>
-            <jaxb:package name="org.apache.cxf.ws.policy"/>
+            <jaxb:package name="org.apache.cxf.ws.policy.v200409"/>
         </jaxb:schemaBindings>
     </jaxb:bindings>
 </jaxb:bindings>

Added: incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200607.xjb
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200607.xjb?view=auto&rev=498671
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200607.xjb (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200607.xjb Mon Jan 22 08:17:27 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  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.
+-->
+<jaxb:bindings version="1.0" 
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  jaxb:extensionBindingPrefixes="xjc">
+    <jaxb:bindings schemaLocation="ws-policy-200607.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.ws.policy.v200607"/>
+        </jaxb:schemaBindings>
+    </jaxb:bindings>
+</jaxb:bindings>

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200607.xjb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200607.xjb
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/ws-policy-200607.xjb
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message