ws-woden-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sag...@apache.org
Subject svn commit: r809835 [3/11] - in /webservices/woden/trunk/java/woden-api: ./ src/ src/main/ src/main/java/ src/main/java/javax/ src/main/java/javax/xml/ src/main/java/javax/xml/namespace/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/ap...
Date Tue, 01 Sep 2009 05:54:21 GMT
Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/InterfaceMessageReference.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/InterfaceMessageReference.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/InterfaceMessageReference.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/InterfaceMessageReference.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,76 @@
+/**
+ * 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.woden.wsdl20;
+
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.enumeration.Direction;
+import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
+
+
+/**
+ * Represents the InterfaceMessageReference component from the WSDL 2.0 Component model.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public interface InterfaceMessageReference extends NestedComponent {
+    
+    /**
+     * Returns an NCName representing the {message label} property of this 
+     * InterfaceMessageReference. This associates the message with a placeholder message
+     * in the message exchange pattern specified by the parent interface operation.
+     * 
+     * @return an NCName representing the message label
+     */
+    public NCName getMessageLabel();
+    
+    /**
+     * Returns an enumerated type, Direction, that indicates the direction of this message.
+     * Direction.IN corresponds to an input message.
+     * Direction.OUT corresponds to an output message.
+     * 
+     * @return the Direction of this message
+     */
+    public Direction getDirection();
+    
+    /**
+     * Returns a String representing the {message content model} property of this
+     * InterfaceMessageReference. This specifies a token indicating the type of message content. 
+     * '#any' means any single element, '#none' means no message content, 
+     * '#other' means non-XML extension type system and '#element' means 
+     * XML Schema global element definition.
+     *   
+     * @return String representing the type of message content
+     */
+    public String getMessageContentModel();
+    
+    /**
+     * Returns the ElementDeclaration representing the {element declaration} property
+     * of this InterfaceMessageReference. This describes the content or "payload" of the message.
+     * 
+     * @return the ElementDeclaration that describes the message content.
+     */
+    public ElementDeclaration getElementDeclaration();
+    
+    /**
+     * Returns a WSDLElement that represents the element information item from the WSDL 2.0 
+     * infoset that maps to this WSDLComponent. 
+     * 
+     * @return the InterfaceMessageReferenceElement that maps to this InterfaceMessageReference
+     */
+    public InterfaceMessageReferenceElement toElement();
+    
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/InterfaceOperation.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/InterfaceOperation.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/InterfaceOperation.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/InterfaceOperation.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,85 @@
+/**
+ * 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.woden.wsdl20;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+
+/**
+ * Represents the InterfaceMessageReference component from the WSDL 2.0 Component model.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public interface InterfaceOperation extends NestedComponent {
+
+    /**
+     * Returns the qualified name representing the {name} property of this InterfaceOperation.
+     * 
+     * @return QName representing the name of this InterfaceOperation
+     */
+    public QName getName();
+    
+    /**
+     * Returns a URI representing the {message exchange pattern} property of this 
+     * InterfaceOperation.
+     * 
+     * @return URI of the message exchange pattern.
+     */
+    public URI getMessageExchangePattern();
+    
+    /**
+     * Represents the {interface message references} property of the InterfaceOperation component.
+     * This is the set of interface message references declared by this interface operation.
+     * This method will return an empty array if there are no interface message references for
+     * this interface operation.
+     * 
+     * @return an array of InterfaceMessageReference
+     */
+    public InterfaceMessageReference[] getInterfaceMessageReferences();
+    
+    /**
+     * Represents the {interface fault references} property of the InterfaceOperation component.
+     * This is the set of interface fault references defined by this interface operation.
+     * This method will return an empty array if there are no interface fault references for
+     * this interface operation.
+     * 
+     * @return an array of InterfaceFaultReference
+     */
+    public InterfaceFaultReference[] getInterfaceFaultReferences();
+    
+    /**
+     * Represents the {style} property of the InterfaceOperation component.
+     * This is a set of URIs which specify the rules that constrain the content of
+     * input and output messages and faults of the interface operation.
+     * This method will return an empty array if there are no style URIs.
+     * 
+     * @return an array of URI
+     */
+    public URI[] getStyle();
+    
+    /**
+     * Returns a WSDLElement that represents the element information item from the WSDL 2.0 
+     * infoset that maps to this WSDLComponent. 
+     * 
+     * @return the InterfaceOperationElement that maps to this InterfaceOperation
+     */
+    public InterfaceOperationElement toElement();
+    
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/NestedComponent.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/NestedComponent.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/NestedComponent.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/NestedComponent.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,49 @@
+/**
+ * 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.woden.wsdl20;
+
+/**
+ * Represents a super-type of all WSDL Components which are 'nested' directly
+ * or indirectly within the 'top-level' WSDL components; Interface, Binding 
+ * and Service. 
+ * This interface defines behaviour for retrieving the parent WSDL component.
+ * <p>
+ * The nested WSDL components are:
+ * <ul>
+ *   <li>InterfaceFault</li>
+ *   <li>InterfaceOperation</li>
+ *   <li>InterfaceFaultReference</li>
+ *   <li>InterfaceMessageReference</li>
+ *   <li>BindingFault</li>
+ *   <li>BindingOperation</li>
+ *   <li>BindingFaultReference</li>
+ *   <li>BindingMessageReference</li>
+ *   <li>Endpoint</li>
+ * </ul>
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public interface NestedComponent extends WSDLComponent {
+
+    /**
+     * Returns a WSDLComponent representing the parent of this nested component.
+     * 
+     * @return the parent WSDLComponent
+     */
+    public WSDLComponent getParent();
+    
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/Service.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/Service.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/Service.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/Service.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,74 @@
+/**
+ * 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.woden.wsdl20;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.xml.ServiceElement;
+
+/**
+ * Represents the Service component from the WSDL 2.0 Component model.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public interface Service extends WSDLComponent
+{
+    /**
+     * Returns the qualified name representing the {name} property of this Service.
+     * 
+     * @return QName representing the name of this Service
+     */
+    public QName getName();
+    
+    /**
+     * Represents the {interface} property of the Service component. This is the Interface component
+     * that this Service defines Endpoints for.
+     * 
+     * @return Interface associated with this Service
+     */
+    public Interface getInterface();
+    
+    /**
+     * Represents the {endpoints} property of the Service component. This is the set of
+     * Endpoints declared by this Service. The method will return an empty array if there
+     * are no endpoints.
+     * 
+     * @return an array of Endpoint objects
+     */
+    public Endpoint[] getEndpoints();
+    
+    
+    /**
+     * Returns the Endpoint with the specified local name from the {endpoints}
+     * property of this Service. That is, from the set of Endpoints defined 
+     * by this Service.
+     * If the name parameter is null, this method will return null.
+     * 
+     * @param name the local name of the Endpoint
+     * @return the named Endpoint
+     */
+    public Endpoint getEndpoint(NCName name);
+    
+    /**
+     * Returns a WSDLElement that represents the element information item from the WSDL 2.0 
+     * infoset that maps to this WSDLComponent. 
+     * 
+     * @return the ServiceElement that maps to this Service
+     */
+    public ServiceElement toElement();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/TypeDefinition.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/TypeDefinition.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/TypeDefinition.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/TypeDefinition.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,108 @@
+/**
+ * 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.woden.wsdl20;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents the TypeDefinition component described in the WSDL 2.0 component model 
+ * (within the Description Component section of the W3C WSDL 2.0 spec). 
+ * This component represents global data type definitions such as top-level,
+ * named type definitions in W3C XML Schema (e.g. &lt;xs:simpleType&gt; or 
+ * &lt;xs:complexType&gt;).
+ * <p>
+ * However, it does not mandate W3C XML Schema as the type system. 
+ * It defines behaviour to query the type system and the underlying content
+ * model or API being used to represent the type definitions, and to 
+ * return a java.lang.Object representing the actual type definition object.
+ * Based on the type system and content model, the application must cast this
+ * Object to the appropriate type to manipulate its contents.
+ * <p>
+ * Note that while TypeDefinition is described along with the Component model
+ * in the W3C WSDL 2.0 specification, it is not a WSDL component itself. 
+ * It simply provides a way of representing components from the underlying type 
+ * system within the WSDL Component model.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public interface TypeDefinition {
+    
+    /**
+     * A constant representing the DOM API. This may be used to indicate the 
+     * content model of the underlying type definition.
+     */
+    public static final String API_W3C_DOM =
+        "org.w3c.dom";
+
+    /**
+     * A constant representing the Apache WS-Commons XmlSchema API. This may be used to 
+     * indicate the content model of the underlying type definition.
+     */
+    public static final String API_APACHE_WS_XS =
+        "org.apache.ws.commons.schema";
+
+    /**
+     * Representing the {name} property of the TypeDefinition component, this 
+     * method returns the qualified name of this TypeDefinition.
+     * 
+     * @return the QName that identifies this TypeDefinition
+     */
+    public QName getName();
+    
+    /**
+     * Representing the {system} property of the TypeDefinition component, this
+     * method indicates the type system from which this type definition is derived.
+     * For example, "http://www.w3.org/2001/XMLSchema" indicates the W3C XML Schema
+     * type system.
+     *  
+     * @return the URI identifying the type system
+     */
+    public URI getSystem();
+    
+    /**
+     * Indicates the type of object model or API which should be used to 
+     * access the content of the underlying type definition.
+     * This can be used to determine how to cast the Object returned by
+     * the <code>getContent()</code> method.
+     * <p>
+     * For example:
+     * <ul>
+     * <li>The content model "org.w3c.dom" indicates that the DOM API should be used, 
+     * so the type org.w3c.dom.Element will be used to represent the content of the
+     * type definition.
+     * <li>The content model "org.apache.ws.commons.schema" indicates that the 
+     * WS-Commons XmlSchema API from the Apache WebServices project is used, 
+     * so an org.apache.ws.commons.schema.XmlSchemaType will be used to represent the 
+     * content of the type definition. 
+     * </ul>
+     * 
+     * @return a String identifying the type definition's content model
+     */
+    public String getContentModel();
+    
+    /**
+     * Returns the underlying type definition as a java.lang.Object, which should
+     * be cast to the appropriate type as indicated by the <code>getContentModel()</code> 
+     * method.
+     * 
+     * @return the Object representing the content of the type definition
+     */
+    public Object getContent();
+
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/WSDLComponent.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/WSDLComponent.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/WSDLComponent.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/WSDLComponent.java Tue Sep  1 05:54:15 2009
@@ -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.woden.wsdl20;
+
+import java.net.URI;
+
+import org.apache.woden.wsdl20.extensions.ComponentExtensionContext;
+import org.apache.woden.wsdl20.extensions.PropertyExtensible;
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+
+/**
+ * Represents the top-level super-type of all WSDL 2.0 Components. 
+ * Every WSDL 2.0 Component interface must extend this interface, directly or indirectly.
+ * It provides a common way to refer to any type of WSDL Component.
+ * It defines behaviour common to all WSDL components, such as testing for 
+ * equivalence and accessing extension properties. 
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public interface WSDLComponent extends PropertyExtensible
+{
+    /**
+     * Tests whether this component is logically equivalent the specified component.
+     * Equivalence is determined per spec WSDL 2.0 Part 1 Section 2.17 Equivalence
+     * of Components.
+     * 
+     * @param comp the WSDL component that this component will be compared to
+     * @return true if the components are logically equivalent
+     */
+    public boolean equals(WSDLComponent comp);
+    
+    /**
+     * Stores the ComponentExtensionContext object that provides access to this WSDL component's
+     * extension properties from the specified namespace.
+     * 
+     * @param extNamespace the namespace URI of the extension properties 
+     * @param compExtCtx the ComponentExtensionContext object for accessing the extension properties
+     */
+    public void setComponentExtensionContext(URI extNamespace, ComponentExtensionContext compExtCtx);
+    
+    /**
+     * Returns the ComponentExtensionContext object that provides access to this WSDL component's
+     * extension properties from the specified namespace.
+     * 
+     * @param extNamespace the namespace URI of the extension properties 
+     * @return the ComponentExtensionContext object for accessing the extension properties
+     */
+    public ComponentExtensionContext getComponentExtensionContext(URI extNamespace);
+    
+   
+    /**
+     * Returns the fragment identifier for this WSDL 2.0 component.
+     * 
+     * @return a FragmentIdentifier for this WSDL 2.0 component.
+     */
+    public FragmentIdentifier getFragmentIdentifier();
+    
+    /**
+     * Returns a String serialisation of the fragment identifier for this WSDL 2.0 component.
+     * 
+     * @return a String the serialisation of the fragment identifier for this WSDL 2.0 component.
+     */
+    public String toString();
+    
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/enumeration/Direction.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/enumeration/Direction.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/enumeration/Direction.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/enumeration/Direction.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,57 @@
+/**
+ * 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.woden.wsdl20.enumeration;
+
+/**
+ * This class defines the values of the {direction} property of
+ * InterfaceMessageReference and InterfaceFaultReference. This property 
+ * indicates whether a message is coming "in" to the service or going "out" 
+ * from the service.
+ * <p>
+ * The property is represented in XML by the message or fault 
+ * reference element's tag name:
+ * <ul>
+ * <li>&lt;input&gt; and &lt;infault&gt; have the direction "in" - 
+ *     represented by the constant IN
+ * <li>&lt;output&gt; and &lt;outfault&gt; have the direction "out" - 
+ *     represented by the constant OUT
+ * </ul>
+ * This class uses the typesafe enum pattern. Applications should use the
+ * public static final constants defined in this class to specify or to 
+ * evaluate direction.
+ * <p>
+ * Examples:
+ * <pre>
+ *     msgRef.setDirection(Direction.IN);
+ *     if(msgRef.getDirection() == Direction.IN) ...
+ *     if(msgRef.getDirection().equals(Direction.IN)) ...
+ * 
+ *     Note that == and .equals() are equivalent.
+ * </pre>
+ * TODO if extensibility is required, chg ctor to protected 
+ * 
+ * @author jkaputin@apache.org
+ */
+public class Direction 
+{
+    private final String fValue;
+    private Direction(String value) { fValue = value; }
+    public String toString() {return fValue;}
+    
+    public static final Direction IN = new Direction("in");
+    public static final Direction OUT = new Direction("out");
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/enumeration/MessageLabel.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/enumeration/MessageLabel.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/enumeration/MessageLabel.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/enumeration/MessageLabel.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,33 @@
+/**
+ * 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.woden.wsdl20.enumeration;
+
+import org.apache.woden.types.NCName;
+
+
+/**
+ * This class defines the values of the {message label} property of
+ * InterfaceMessageReference and InterfaceFaultReference as used in the
+ * WSDL 2.0 specification. Other NCName values are also valid. 
+
+ * @author jkaputin@apache.org, hughesj@apache.org
+ */
+public class MessageLabel 
+{
+    public static final NCName IN = new NCName("In");
+    public static final NCName OUT = new NCName("Out");
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/AttributeExtensible.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/AttributeExtensible.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/AttributeExtensible.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/AttributeExtensible.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,62 @@
+/**
+ * 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.woden.wsdl20.extensions;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.xml.XMLAttr;
+
+/**
+ * This interface represents elements that may contain extension attributes.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface AttributeExtensible 
+{
+    /**
+     * Store the extension attribute object identified by the QName.
+     * If the attribute argument is null, remove the extension attribute identified
+     * by the specified QName argument.
+     * 
+     * TODO ? @throws IllegalArgumentException if the QName is null
+     */
+    public void setExtensionAttribute(QName attrType, XMLAttr attr);
+   
+    /**
+     * Return the extension attribute with this QName.
+     */
+    public XMLAttr getExtensionAttribute(QName attrType);
+    
+    /**
+     * Return the extension attributes from this namespace.
+     */
+    public XMLAttr[] getExtensionAttributesForNamespace(URI namespace);
+    
+    /**
+     * Return all extension attributes.
+     */
+    public XMLAttr[] getExtensionAttributes();
+    
+    /**
+     * Return true if the implementor has extension attributes belonging to this namespace,
+     * otherwise false.
+     */
+    public boolean hasExtensionAttributesForNamespace(URI namespace);
+
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/BaseComponentExtensionContext.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/BaseComponentExtensionContext.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/BaseComponentExtensionContext.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/BaseComponentExtensionContext.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,124 @@
+/**
+ * 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.woden.wsdl20.extensions;
+
+import java.net.URI;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.wsdl20.WSDLComponent;
+
+/**
+ * This abstract class partially implements the ComponentExtensionContext interface.
+ * It implements common behaviour, leaving the extension-specific methods abstract. 
+ * That is, it leaves the <code>getProperties</code> and <code>getProperty</code> methods 
+ * abstract, for subclasses to implement.
+ * <p>
+ * Implementors of WSDL 2.0 extensions may extend this class to reuse common behaviour 
+ * for accessing the parent component and the extension namespace. 
+ * It provides a constructor which subclasses should call that stores the parent component 
+ * and extension namespace.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public abstract class BaseComponentExtensionContext implements ComponentExtensionContext {
+    
+    private WSDLComponent parent;
+    private URI extNamespace;
+    protected ErrorReporter errorReporter;
+
+    /**
+     * Constructor accepts the parent component, the extension namespace and an error reporter.
+     * These parameters cannot be null. 
+     * <p>
+     * Normal behaviour is for these 3 parameters to be provided by the ExtensionRegistry when 
+     * it calls this constructor. 
+     * Woden client code should not need to call this constructor directly. 
+     * However, this assumes that extension properties from the required namespace have been 
+     * registered in the ExtensionRegistry. 
+     * This is done automatically by Woden for the extensions defined by the 
+     * WSDL 2.0 Recommendation (SOAP, HTTP, RPC, WSDLX), but implementors of other WSDL 2.0 
+     * extensions must ensure they register their extension properties so that this constructor 
+     * gets called by the ExtensionRegistry.
+     * 
+     * @param parent WSDLComponent containing these extension properties
+     * @param extNamespace extension namespace URI
+     * @param errorReporter ErrorReporter available to subclasses for reporting errors
+     * 
+     * @throws NullPointerException if any of the parameters are null
+     */
+    protected BaseComponentExtensionContext(WSDLComponent parent, 
+            URI extNamespace, ErrorReporter errorReporter) {
+        
+        if(errorReporter == null) {
+            throw new NullPointerException("ErrorReporter=null");
+        }
+        if(parent == null) {
+            throw new NullPointerException(errorReporter.getFormattedMessage("WSDL025", null));
+        }
+        if(extNamespace == null) {
+            throw new NullPointerException(errorReporter.getFormattedMessage("WSDL023", null));
+        }
+        
+        this.parent = parent;
+        this.extNamespace = extNamespace;
+        this.errorReporter = errorReporter;
+    }
+    
+    /* ************************************************************
+     *  Methods declared by ComponentExtensionContext
+     * ************************************************************/
+
+    /**
+     * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getParent()
+     */
+    public WSDLComponent getParent() {
+        return this.parent;
+    }
+    
+    /**
+     * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getNamespace()
+     */
+    public URI getNamespace() {
+        return this.extNamespace;
+    }
+
+    /**
+     * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperties()
+     */
+    abstract public ExtensionProperty[] getProperties();
+    
+    /**
+     * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext#getProperty(java.lang.String)
+     */
+    abstract public ExtensionProperty getProperty(String propertyName);
+
+    /* ************************************************************
+     *  Helper methods
+     * ************************************************************/
+
+    /**
+     * A factory-type method for instantiating and initialising ExtensionProperty objects. 
+     * This is a helper method for subclasses, as it automatically provides the extension namespace. 
+     * The only additional information the caller must provide is the property name and its content.
+     * The property name parameter must not be null.
+     * 
+     * @throws NullPointerException if the <code>name</code> parameter is null.
+     */
+    protected ExtensionProperty newExtensionProperty(String name, Object content) {
+            return new GenericExtensionProperty(name, getNamespace(), content);
+    }
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ComponentExtensionContext.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ComponentExtensionContext.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ComponentExtensionContext.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ComponentExtensionContext.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,81 @@
+/**
+ * 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.woden.wsdl20.extensions;
+
+import java.net.URI;
+
+import org.apache.woden.wsdl20.WSDLComponent;
+
+/**
+ * This interface defines a generic API for accessing the extension properties
+ * from a particular extension namespace that are attached to a particular 
+ * WSDL 2.0 component. That is, for accessing extension properties by namespace
+ * per component.
+ * <p>
+ * It provides accessor methods that return <code>ExtensionProperty</code> objects, 
+ * which callers can use to access the content of an extension property.
+ * <p>
+ * Implementors of WSDL 2.0 extensions must, as a minimum, implement this interface
+ * for each WSDL 2.0 component they extend. They must also <i>register</i> their
+ * extension implementations using the <code>ExtensionRegistry</code>. 
+ * Implementors may <i>optionally</i> extend this interface to add their own extension-specific 
+ * property accessor methods to the generic accessor methods declared by this interface.
+ * For examples of this, see the SOAP and HTTP binding extensions provided by Woden.
+ * <p>
+ * To document extensions consistently, implementors should copy the following Javadoc 
+ * fragment to use for their implementation classes or for their sub-interfaces of this
+ * interface, replacing the square bracket parts [...] accordingly.
+ * <p>
+ * <i>start of fragment:</i>
+ * <p>
+ * Provides access to the extension properties of the [parent component name] component 
+ * that are in the <code>[extension namespace]</code> namespace.
+ * These extension properties can be accessed as <code>ExtensionProperty</code> objects 
+ * via the <code>getProperties</code> and <code>getProperty</code> methods  
+ * using the property names and Java types shown in the following table.
+ * <p>
+ * <table border="1">
+ * <tr>
+ * <th>Property name</th>
+ * <th>Java type</th>
+ * </tr>
+ * <tr>
+ * <td>[property name]</td>
+ * <td>[java type]</td>
+ * </tr>
+ * <tr>
+ * <td>...</td>
+ * <td>...</td>
+ * </tr>
+ * </table>
+ * <p>
+ * <i>end of fragment:</i>
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ * 
+ * @see org.apache.woden.wsdl20.extensions.ExtensionProperty
+ */
+public interface ComponentExtensionContext {
+
+    public WSDLComponent getParent();
+    
+    public URI getNamespace();
+
+    public ExtensionProperty[] getProperties();
+    
+    public ExtensionProperty getProperty(String propertyName);
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ElementExtensible.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ElementExtensible.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ElementExtensible.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ElementExtensible.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,44 @@
+/**
+ * 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.woden.wsdl20.extensions;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface represents elements that may contain extension elements.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface ElementExtensible 
+{
+    public void addExtensionElement(ExtensionElement extEl);
+    
+    public void removeExtensionElement(ExtensionElement extEl);
+
+    public ExtensionElement[] getExtensionElements();
+    
+    public ExtensionElement[] getExtensionElementsOfType(QName extType);
+    
+    /**
+     * Return true if the implementor has extension elements belonging to this namespace,
+     * otherwise false.
+     */
+    public boolean hasExtensionElementsForNamespace(URI namespace);
+
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionDeserializer.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionDeserializer.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionDeserializer.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionDeserializer.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,61 @@
+/**
+ * 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.woden.wsdl20.extensions;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+
+/**
+ * This interface should be implemented by classes which deserialize
+ * org.w3c.dom.Elements into extension-specific instances of ExtensionElement.
+ * <p>
+ * Copied from WSDL4J.
+ *
+ * @author Matthew J. Duftler (duftler@us.ibm.com)
+ * @author jkaputin@apache.org (modified for Woden)
+ */
+public interface ExtensionDeserializer
+{
+  /**
+   * This method deserializes elements into instances of classes
+   * which implement the ExtensionElement interface. The
+   * return value should be explicitly cast to the more-specific
+   * implementing type.
+   *
+   * @param parentType a class object indicating where in the WSDL
+   * document this extension element was encountered. For
+   * example, org.apache.woden.Binding.class would be used to indicate
+   * this element was encountered as an immediate child of
+   * a &lt;wsdl:binding&gt; element.
+   * @param parent the parent object of this extension element 
+   * @param extType the qname of the extension element to deserialize
+   * @param extEl the extension element
+   * @param desc the &lt;description&gt; this extension element was
+   * encountered in
+   * @param extReg the ExtensionRegistry to use (if needed again)
+   */
+  public ExtensionElement unmarshall(Class parentType,
+                                     Object parent,
+                                     QName extType,
+                                     XMLElement extEl,
+                                     DescriptionElement desc,
+                                     ExtensionRegistry extReg)
+                                       throws WSDLException;
+}
\ No newline at end of file

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionElement.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionElement.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionElement.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionElement.java Tue Sep  1 05:54:15 2009
@@ -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.woden.wsdl20.extensions;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface represents WSDL 2.0 extension elements. That is, any XML element
+ * information items that appear as [children] of a WSDL 2.0 element and are not in 
+ * the WSDL 2.0 namespace (http://www.w3.org/ns/wsdl).
+ * <p>
+ * Based on a similar interface from WSDL4J element extensibility.
+ * 
+ * TODO change this URL if the WSDL 2.0 namespace changes before spec is finalized.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface ExtensionElement 
+{
+    public void setExtensionType(QName qname);
+    
+    public QName getExtensionType();
+    
+    public void setRequired(Boolean required);
+    
+    public Boolean isRequired();
+    
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionProperty.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionProperty.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionProperty.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionProperty.java Tue Sep  1 05:54:15 2009
@@ -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.woden.wsdl20.extensions;
+
+import java.net.URI;
+
+/**
+ * Represents a WSDL 2.0 component extension property. That is, a property derived from WSDL 2.0 
+ * extension elements or attributes. This is a generic representation of an extension property 
+ * that simply provides the property's name and namespace and its content as a 
+ * <code>java.lang.Object</code>.
+ * The caller must know what to do with this <i>content</i> Object. 
+ * For example, what Java type to cast it to or whether it provides a useful 
+ * <code>toString()</code> implementation.
+ * <p>
+ * WSDL 2.0 extensions should be defined by their own specification, which may include this type 
+ * of information.
+ * Implementors of WSDL 2.0 extensions in Woden should also specify the names and Java types of 
+ * their extension properties using Javadoc comments in their implementations of the 
+ * <code>ComponentExtensionContext</code> interface. 
+ * For examples, see the SOAP and HTTP binding extensions provided by Woden.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ *
+ * @see org.apache.woden.wsdl20.extensions.ComponentExtensionContext
+ * 
+ */
+public interface ExtensionProperty {
+    
+    /**
+     * Returns a String representing the name of the extension property.
+     */
+    public String getName();
+    
+    /**
+     * Returns a URI representing the namespace the extension property belongs to.
+     */
+    public URI getNamespace();
+    
+    /**
+     * Returns the content of the extension property as a <code>java.lang.Object</code>.
+     */
+    public Object getContent();
+
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistrar.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistrar.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistrar.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistrar.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,32 @@
+/**
+ * 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.woden.wsdl20.extensions;
+
+/**
+ * Registers Woden extensions with an existing registry.
+ * 
+ * @author Peter Danielsen 
+ *
+ */
+public interface ExtensionRegistrar {
+	
+	/**
+	 * Registers Woden extensions with an existing registry.
+	 * @param registry
+	 */
+	public void registerExtensions(ExtensionRegistry registry);
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,825 @@
+/**
+ * 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.woden.wsdl20.extensions;
+
+import java.lang.reflect.Constructor;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.wsdl20.WSDLComponent;
+import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.AssertionInfo;
+import org.apache.woden.wsdl20.xml.WSDLElement;
+import org.apache.woden.xml.UnknownAttr;
+import org.apache.woden.xml.XMLAttr;
+
+
+/**
+ * This class is used to associate serializers, deserializers, and
+ * Java implementation types with extension elements.
+ * It also associates Java implementation types only with extension attributes,
+ * but not serializers and deserializers.
+ * <p>
+ * This class has been copied from WSDL4J and modified for Woden.
+ * 
+ * TODO update method javadocs.
+ *
+ * @author Matthew J. Duftler (duftler@us.ibm.com)
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public class ExtensionRegistry
+{
+
+  /**
+   * Creates the extension registry, and sets the defaultSerializer
+   * and defaultDeserializer properties to instances of an
+   * UnknownExtensionSerializer, and an UnknownExtensionDeserializer,
+   * respectively.
+   */
+  public ExtensionRegistry(ErrorReporter errorReporter)
+  {
+    this.errorReporter = errorReporter;  
+    setDefaultSerializer(new UnknownExtensionSerializer());
+    setDefaultDeserializer(new UnknownExtensionDeserializer());
+    registerResourceBundle(CORE_RESOURCE_BUNDLE);
+  }
+
+  /**
+   * The property containing the comma-separated listed of ExtensionRegistrars.
+   * The property name is <code>org.apache.woden.extensionregistrars</code>.
+   */
+    public static final String REGISTRAR_PROPERTY = "org.apache.woden.extensionregistrars";
+
+  /**
+   * This property specifies the resource bundle containing the
+   * core Woden extension registry error messages.
+   * 
+   * TODO extract these errors to a new public (non-internal) bundle.
+   */
+    static final private String CORE_RESOURCE_BUNDLE = "org.apache.woden.internal.Messages";
+    
+  /*
+    This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
+    and the inner Maps are keyed by (QName)elementQN.
+  */
+  protected Map serializerReg = new Hashtable();
+  /*
+    This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
+    and the inner Maps are keyed by (QName)elementQN.
+  */
+  protected Map deserializerReg = new Hashtable();
+  /*
+    This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
+    and the inner Maps are keyed by (QName)elementQN.
+  */
+  protected Map extElementReg = new Hashtable();
+  protected ExtensionSerializer defaultSer = null;
+  protected ExtensionDeserializer defaultDeser = null;
+  /*
+    This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
+    and the inner Maps are keyed by (QName)attrName.
+  */
+  protected Map extAttributeReg = new Hashtable();
+  
+  /*
+   * This is a Map of Maps. The top-level Map is keyed by (Class)parentComponent
+   * and the inner Map is keyed by (URI)extensionNamespace with a value of
+   * (Class)componentExtensions.
+   */
+  protected Map compExtReg = new Hashtable();
+  
+  /*
+   * Error message property files.
+   */
+  private List fResourceBundleNames = new ArrayList();
+  
+  private ErrorReporter errorReporter = null;
+  
+  public ErrorReporter getErrorReporter()
+  {
+      return this.errorReporter;
+  }
+  
+  /*
+   * A Map of assertions, where the key is an assertion id string and 
+   * the value is an AssertionInfo object.
+   */
+  protected Map assertionReg = new Hashtable();
+
+  /**
+   * Set the serializer to be used when none is found for an extensibility
+   * element. Set this to null to have an exception thrown when
+   * unexpected extensibility elements are encountered. Default value is
+   * an instance of UnknownExtensionSerializer.
+   *
+   * @see UnknownExtensionSerializer
+   */
+  public void setDefaultSerializer(ExtensionSerializer defaultSer)
+  {
+    this.defaultSer = defaultSer;
+  }
+
+  /**
+   * Get the serializer to be used when none is found for an extensibility
+   * element. Default value is an instance of UnknownExtensionSerializer.
+   *
+   * @see UnknownExtensionSerializer
+   */
+  public ExtensionSerializer getDefaultSerializer()
+  {
+    return defaultSer;
+  }
+
+  /**
+   * Set the deserializer to be used when none is found for an encountered
+   * element. Set this to null to have an exception thrown when
+   * unexpected extensibility elements are encountered. Default value is
+   * an instance of UnknownExtensionDeserializer.
+   *
+   * @see UnknownExtensionDeserializer
+   */
+  public void setDefaultDeserializer(ExtensionDeserializer defaultDeser)
+  {
+    this.defaultDeser = defaultDeser;
+  }
+
+  /**
+   * Get the deserializer to be used when none is found for an encountered
+   * element. Default value is an instance of UnknownExtensionDeserializer.
+   *
+   * @see UnknownExtensionDeserializer
+   */
+  public ExtensionDeserializer getDefaultDeserializer()
+  {
+    return defaultDeser;
+  }
+
+  /**
+   * Declare that the specified serializer should be used to serialize
+   * all extensibility elements with a qname matching elementQN, when
+   * encountered as children of the specified parentType.
+   *
+   * @param parentType a class object indicating where in the WSDL
+   * definition this extension was encountered. For
+   * example, org.apache.woden.Binding.class would be used to indicate
+   * this extensibility element was found in the list of
+   * extensibility elements belonging to a org.apache.woden.Binding.
+   * @param elementType the qname of the extensibility element
+   * @param es the extension serializer to use
+   *
+   * @see #querySerializer(Class, QName)
+   */
+  public void registerSerializer(Class parentType,
+                                 QName elementType,
+                                 ExtensionSerializer es)
+  {
+    Map innerSerializerReg = (Map)serializerReg.get(parentType);
+
+    if (innerSerializerReg == null)
+    {
+      innerSerializerReg = new Hashtable();
+
+      serializerReg.put(parentType, innerSerializerReg);
+    }
+
+    innerSerializerReg.put(elementType, es);
+  }
+
+  /**
+   * Declare that the specified deserializer should be used to deserialize
+   * all extensibility elements with a qname matching elementQN, when
+   * encountered as immediate children of the element represented by the
+   * specified parentType.
+   *
+   * @param parentType a class object indicating where in the WSDL
+   * document this extensibility element was encountered. For
+   * example, org.apache.woden.Binding.class would be used to indicate
+   * this element was encountered as an immediate child of
+   * a &lt;wsdl:binding&gt; element.
+   * @param elementType the qname of the extensibility element
+   * @param ed the extension deserializer to use
+   *
+   * @see #queryDeserializer(Class, QName)
+   */
+  public void registerDeserializer(Class parentType,
+                                   QName elementType,
+                                   ExtensionDeserializer ed)
+  {
+    Map innerDeserializerReg = (Map)deserializerReg.get(parentType);
+
+    if (innerDeserializerReg == null)
+    {
+      innerDeserializerReg = new Hashtable();
+
+      deserializerReg.put(parentType, innerDeserializerReg);
+    }
+
+    innerDeserializerReg.put(elementType, ed);
+  }
+
+  /**
+   * Look up the serializer to use for the extensibility element with
+   * the qname elementQN, which was encountered as a child of the
+   * specified parentType.
+   *
+   * @param parentType a class object indicating where in the WSDL
+   * definition this extension was encountered. For
+   * example, org.apache.woden.Binding.class would be used to indicate
+   * this extensibility element was found in the list of
+   * extensibility elements belonging to a org.apache.woden.Binding.
+   * @param elementType the qname of the extensibility element
+   *
+   * @return the extension serializer, if one was found. If none was
+   * found, the behavior depends on the value of the defaultSerializer
+   * property. If the defaultSerializer property is set to a non-null
+   * value, that value is returned; otherwise, a WSDLException is
+   * thrown.
+   *
+   * @see #registerSerializer(Class, QName, ExtensionSerializer)
+   * @see #setDefaultSerializer(ExtensionSerializer)
+   */
+  public ExtensionSerializer querySerializer(Class parentType,
+                                             QName elementType)
+                                               throws WSDLException
+  {
+    Map innerSerializerReg = (Map)serializerReg.get(parentType);
+    ExtensionSerializer es = null;
+
+    if (innerSerializerReg != null)
+    {
+      es = (ExtensionSerializer)innerSerializerReg.get(elementType);
+    }
+
+    if (es == null)
+    {
+      es = defaultSer;
+    }
+
+    if (es == null)
+    {
+      throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                              "No ExtensionSerializer found " +
+                              "to serialize a '" + elementType +
+                              "' element in the context of a '" +
+                              parentType.getName() + "'.");
+    }
+
+    return es;
+  }
+
+  /**
+   * Look up the deserializer for the extensibility element with the
+   * qname elementQN, which was encountered as an immediate child
+   * of the element represented by the specified parentType.
+   *
+   * @param parentType a class object indicating where in the WSDL
+   * document this extensibility element was encountered. For
+   * example, org.apache.woden.Binding.class would be used to indicate
+   * this element was encountered as an immediate child of
+   * a &lt;wsdl:binding&gt; element.
+   * @param elementType the qname of the extensibility element
+   *
+   * @return the extension deserializer, if one was found. If none was
+   * found, the behavior depends on the value of the defaultDeserializer
+   * property. If the defaultDeserializer property is set to a non-null
+   * value, that value is returned; otherwise, a WSDLException is thrown.
+   *
+   * @see #registerDeserializer(Class, QName, ExtensionDeserializer)
+   * @see #setDefaultDeserializer(ExtensionDeserializer)
+   */
+  public ExtensionDeserializer queryDeserializer(Class parentType,
+                                                 QName elementType)
+                                                   throws WSDLException
+  {
+    Map innerDeserializerReg = (Map)deserializerReg.get(parentType);
+    ExtensionDeserializer ed = null;
+
+    if (innerDeserializerReg != null)
+    {
+      ed = (ExtensionDeserializer)innerDeserializerReg.get(elementType);
+    }
+
+    if (ed == null)
+    {
+      ed = defaultDeser;
+    }
+
+    if (ed == null)
+    {
+      throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                              "No ExtensionDeserializer found " +
+                              "to deserialize a '" + elementType +
+                              "' element in the context of a '" +
+                              parentType.getName() + "'.");
+    }
+
+    return ed;
+  }
+
+  /**
+   * Look up the type of the extensibility element with the specified qname, which
+   * was defined as a child of the element represented by the specified parent class.
+   *
+   * @param parentClass a class object indicating where in the WSDL
+   * document this extensibility attribute was encountered. For
+   * example, org.apache.woden.Binding.class would be used to indicate
+   * this attribute was defined on a &lt;wsdl:binding> element.
+   * @param elemQN the qname of the extensibility attribute
+   *
+   * @return one of the constants defined on the AttributeExtensible class
+   *
+   * @see #registerExtAttributeType(Class, QName, Class)
+   * @see AttributeExtensible
+   */
+  public Class queryExtElementType(Class parentClass, QName elemQN)
+  {
+    Map innerExtensionAttributeReg =
+      (Map)extAttributeReg.get(parentClass);
+    Class elemClass = null;
+
+    if (innerExtensionAttributeReg != null)
+    {
+        elemClass = (Class)innerExtensionAttributeReg.get(elemQN);
+    }
+
+    return elemClass;
+  }
+  
+  /**
+   * TODO make the return val typesafe, and create similar method for ext attrs.
+   * 
+   * Returns a set of QNames representing the extensibility elements
+   * that are allowed as children of the specified parent type.
+   * Basically, this method returns the keys associated with the set
+   * of extension deserializers registered for this parent type.
+   * Returns null if no extension deserializers are registered for
+   * this parent type.
+   */
+  public Set getAllowableExtensions(Class parentType)
+  {
+    Map innerDeserializerReg = (Map)deserializerReg.get(parentType);
+
+    return (innerDeserializerReg != null)
+           ? innerDeserializerReg.keySet()
+           : null;
+  }
+
+  /**
+   * Declare that the specified extensionType is the concrete
+   * class which should be used to represent extensibility elements
+   * with qnames matching elementQN, that are intended to exist as
+   * children of the specified parentType.
+   *
+   * @param parentType a class object indicating where in the WSDL
+   * definition this extension would exist. For example,
+   * org.apache.woden.Binding.class would be used to indicate
+   * this extensibility element would be added to the list of
+   * extensibility elements belonging to a org.apache.woden.Binding,
+   * after being instantiated.
+   * @param elementType the qname of the extensibility element
+   * @param extensionType the concrete class which should be instantiated
+   *
+   * @see #createExtElement(Class, QName)
+   */
+  public void registerExtElementType(Class parentType,
+                                QName elementType,
+                                Class extensionType)
+  {
+    Map innerExtensionTypeReg = (Map)extElementReg.get(parentType);
+
+    if (innerExtensionTypeReg == null)
+    {
+      innerExtensionTypeReg = new Hashtable();
+
+      extElementReg.put(parentType, innerExtensionTypeReg);
+    }
+
+    innerExtensionTypeReg.put(elementType, extensionType);
+  }
+
+  /**
+   * Create an instance of the type which was declared to be used to
+   * represent extensibility elements with qnames matching elementQN,
+   * when intended to exist as children of the specified parentType.
+   * This method allows a user to instantiate an extensibility element
+   * without having to know the implementing type.
+   *
+   * @param parentType a class object indicating where in the WSDL
+   * definition this extension will exist. For example,
+   * org.apache.woden.Binding.class would be used to indicate
+   * this extensibility element is going to be added to the list of
+   * extensibility elements belonging to a org.apache.woden.Binding,
+   * after being instantiated.
+   * @param elementType the qname of the extensibility element
+   *
+   * @return a new instance of the type used to represent the
+   * specified extension
+   *
+   * @see #registerExtElementType(Class, QName, Class)
+   */
+  public ExtensionElement createExtElement(Class parentType,
+                                              QName elementType)
+                                                throws WSDLException
+  {
+    Map innerExtensionTypeReg = (Map)extElementReg.get(parentType);
+    Class extensionType = null;
+
+    if (innerExtensionTypeReg != null)
+    {
+      extensionType = (Class)innerExtensionTypeReg.get(elementType);
+    }
+
+    if (extensionType == null)
+    {
+      //TODO use ErrorReporter to get formatted error msg WSDL012
+      throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                              "No Java extensionType found " +
+                              "to represent a '" + elementType +
+                              "' element in the context of a '" +
+                              parentType.getName() + "'.");
+    }
+    else if (!(ExtensionElement.class.isAssignableFrom(extensionType)))
+    {
+      //TODO use ErrorReporter to get formatted error msg WSDL013
+      throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                              "The Java extensionType '" +
+                              extensionType.getName() + "' does " +
+                              "not implement the ExtensibilityElement " +
+                              "interface.");
+    }
+
+    try
+    {
+        ExtensionElement ee = (ExtensionElement)extensionType.newInstance();
+      /*
+      if (ee.getElementType() == null)
+      {
+        ee.setElementType(elementQN);
+      }
+      */
+      
+      return ee;
+    }
+    catch (Exception e)
+    {
+      /*
+        Catches:
+                 InstantiationException
+                 IllegalAccessException
+      */
+      throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                              "Problem instantiating Java " +
+                              "extensionType '" + extensionType.getName() +
+                              "'.",
+                              e);
+    }
+  }
+
+  /**
+   * Declare that the type of the specified extension attribute, when it occurs
+   * as an attribute of the specified parent type, should be assumed to be
+   * attrType.
+   *
+   * @param ownerClass a class object indicating where in the WSDL
+   * document this extensibility attribute was encountered. For
+   * example, org.apache.woden.Binding.class would be used to indicate
+   * this attribute was defined on a &lt;wsdl:binding> element.
+   * @param attrQName the qname of the extensibility attribute
+   * @param attrClass one of the constants defined on the AttributeExtensible
+   * class
+   *
+   * @see #queryExtAttributeType(Class, QName)
+   * @see AttributeExtensible
+   */
+  public void registerExtAttributeType(Class ownerClass,
+                                       QName attrQName,
+                                       Class attrClass)
+  {
+    Map innerExtensionAttributeReg =
+      (Map)extAttributeReg.get(ownerClass);
+
+    if (innerExtensionAttributeReg == null)
+    {
+      innerExtensionAttributeReg = new Hashtable();
+
+      extAttributeReg.put(ownerClass, innerExtensionAttributeReg);
+    }
+
+    innerExtensionAttributeReg.put(attrQName, attrClass);
+  }
+
+  /**
+   * Look up the type of the extensibility attribute with the specified qname,
+   * which was defined on an element represented by the specified parent class.
+   *
+   * @param parentClass a class object indicating where in the WSDL
+   * document this extensibility attribute was encountered. For
+   * example, org.apache.woden.Binding.class would be used to indicate
+   * this attribute was defined on a &lt;wsdl:binding> element.
+   * @param attrQN the qname of the extensibility attribute
+   *
+   * @return one of the constants defined on the AttributeExtensible class
+   *
+   * @see #registerExtAttributeType(Class, QName, Class)
+   * @see AttributeExtensible
+   */
+  public Class queryExtAttributeType(Class parentClass, QName attrQN)
+  {
+    Map innerExtensionAttributeReg =
+      (Map)extAttributeReg.get(parentClass);
+    Class attrClass = null;
+
+    if (innerExtensionAttributeReg != null)
+    {
+        attrClass = (Class)innerExtensionAttributeReg.get(attrQN);
+    }
+
+    return attrClass;
+  }
+  
+  public XMLAttr createExtAttribute(Class ownerClass, QName attrQName, XMLElement ownerElement, String attrValue)
+                                          throws WSDLException
+  {
+      Map innerExtensionAttributeReg = (Map)extAttributeReg.get(ownerClass);
+      Class implClass = null;
+      XMLAttr attr = null;
+      
+      if (innerExtensionAttributeReg != null)
+      {
+          implClass = (Class)innerExtensionAttributeReg.get(attrQName);
+      }
+      
+      if (implClass == null)
+      {
+          /*
+           * Implementations MAY register a default class to handle unknown extension attributes,
+           * which will be retrieved here from the Extension Registry. For example, the
+           * StringAttr implementation class may be registered as the default.
+           * 
+           * TODO TBC, then add this info to javadoc and user docs. See sample code in PopulatedExtReg.
+           */
+          implClass = queryExtAttributeType(WSDLElement.class, 
+                  new QName("http://ws.apache.org/woden", "DefaultAttr"));
+
+          //If no default Java class is registered, use the UnknownAttr class.
+          if(implClass == null) implClass = UnknownAttr.class;
+          
+           
+          //Decided it is not necessary to report WSDL010 as a warning to the user, 
+          //however we will keep the message code for now in case we add logging capability 
+          //later and can capture it in a log (i.e. pull vs. push diagnositic information)
+          
+          /* TODO the following line was replaced by null in the reportError call below
+           * to avoid an API build problem for Milestone 2. This must be fixed, post-M2.
+           * e.g. provide some creator for error locator that hides the Impl class.
+           *  
+           * new ErrorLocatorImpl(),  //TODO line/col nos.
+           *
+          getErrorReporter().reportError( 
+              null,        //see comment above                   
+              "WSDL010", 
+              new Object[] {attrQName.toString(), 
+                            ownerClass.getName(), 
+                            implClass.getName()},
+              ErrorReporter.SEVERITY_WARNING);
+           */
+      }
+      else if (!(XMLAttr.class.isAssignableFrom(implClass)))
+      {
+          String msg = getErrorReporter().getFormattedMessage("WSDL011", 
+                           new Object[] {attrQName.toString()});    
+          throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL011: " + msg);
+      }
+      
+      try {
+          Class[] ctorParms = new Class[] {XMLElement.class, QName.class, String.class, ErrorReporter.class};
+          Constructor ctor = implClass.getConstructor(ctorParms);
+          Object[] ctorParmValues = new Object[] {ownerElement, attrQName, attrValue, getErrorReporter()};
+          attr = (XMLAttr)ctor.newInstance(ctorParmValues);
+      } 
+      catch (Exception e) {
+          //SecurityException
+          //NoSuchMethodException
+          //InvocationTargetException
+          //InstantiationException
+          //IllegalAccessException
+          String msg = getErrorReporter().getFormattedMessage("WSDL009", 
+                           new Object[] {implClass.getName()});
+          throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL009: " + msg, e);
+      } 
+      
+      return attr;
+  }
+  
+  /**
+   * Register the Java class which will represent extensions from a specified 
+   * namespace that will extend the specified WSDL component class.
+   * The Java class must implement <code>ComponentExtensionContext</code>.
+   * 
+   * @param parentClass the WSDL component class
+   * @param extNamespace the extension namespace
+   * @param compExtCtxClass the Java class representing these extensions
+   */
+  public void registerComponentExtension(Class parentClass,
+                                         URI extNamespace,
+                                         Class compExtCtxClass)
+  {
+      if(!(ComponentExtensionContext.class.isAssignableFrom(compExtCtxClass)))
+      {
+          String msg = getErrorReporter().getFormattedMessage("WSDL016", 
+                  new Object[] {compExtCtxClass.getName()});    
+          throw new IllegalArgumentException(msg);
+      }
+      
+      Map innerCompExtReg =
+          (Map)compExtReg.get(parentClass);
+      
+      if (innerCompExtReg == null)
+      {
+          innerCompExtReg = new Hashtable();
+          
+          compExtReg.put(parentClass, innerCompExtReg);
+      }
+      
+      innerCompExtReg.put(extNamespace, compExtCtxClass);
+  }
+  
+  /**
+   * Return the Java class that represents the extensions from the specified
+   * namespace that extend the specified WSDL component class.
+   * This class will be an implementation of <code>ComponentExtensionContext</code>.
+   * 
+   * @param parentClass the WSDL component
+   * @param extNamespace the extension namespace
+   * @return the Class of the component extensions
+   */
+  public Class queryComponentExtension(Class parentClass, URI extNamespace)
+  {
+      Map innerCompExtReg =
+          (Map)compExtReg.get(parentClass);
+      Class compExtClass = null;
+      
+      if (innerCompExtReg != null)
+      {
+          compExtClass = (Class)innerCompExtReg.get(extNamespace);
+      }
+      
+      return compExtClass;
+  }
+
+  /**
+   * Return the extension namespaces registered for the specified WSDL Component class.
+   * 
+   * @param parentClass the class of WSDL component extended by these namespaces
+   * @return an array of namespace URIs
+   */
+  public URI[] queryComponentExtensionNamespaces(Class parentClass)
+  {
+      Map innerCompExtReg =
+          (Map)compExtReg.get(parentClass);
+      
+      if (innerCompExtReg != null)
+      {
+          Set namespaceKeys = innerCompExtReg.keySet();
+          URI[] extNamespaces = new URI[namespaceKeys.size()];
+          namespaceKeys.toArray(extNamespaces);
+          return extNamespaces;
+      }
+      else
+      {
+          return new URI[0]; //return an empty array, rather than null
+      }
+      
+  }
+  
+  /**
+   * Return a ComponentExtensionContext object from the Java class registered for 
+   * the specified extension namespace against the specified WSDL component class.
+   * 
+   * @param parentClass the WSDL component class.
+   * @param extNamespace the extension namespace.
+   * @return a <code>ComponentExtensionContext</code> object
+   * @throws WSDLException if no Java class is registered for this namespace and WSDL component.
+   */
+  public ComponentExtensionContext createComponentExtension(Class parentClass,
+                                                      WSDLComponent parentComp,
+                                                      URI extNamespace)
+                                                      throws WSDLException
+  {
+      Class compExtCtxClass = queryComponentExtension(parentClass, extNamespace);
+      
+      if(compExtCtxClass == null)
+      {
+          String msg = getErrorReporter().getFormattedMessage("WSDL015",
+                  new Object[] {extNamespace.toString(), parentClass.getName()});
+          throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL015: " + msg);
+      }
+          
+      ComponentExtensionContext compExtCtx = null;
+      
+      /* TODO remove with woden-47
+      try {
+          compExtCtx = (ComponentExtensionContext)compExtCtxClass.newInstance();
+      } 
+      catch (InstantiationException e) 
+      {
+          String msg = getErrorReporter().getFormattedMessage("WSDL009",
+                  new Object[] {compExtCtxClass.getName()});
+          throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL009: " + msg, e);
+      } 
+      catch (IllegalAccessException e) {
+          String msg = getErrorReporter().getFormattedMessage("WSDL009",
+                  new Object[] {compExtCtxClass.getName()});
+          throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL009: " + msg, e);
+      }
+      */
+      
+      
+      try {
+          Class[] ctorParms = new Class[] {WSDLComponent.class, URI.class, ErrorReporter.class};
+          Constructor ctor = compExtCtxClass.getConstructor(ctorParms);
+          Object[] ctorParmValues = new Object[] {parentComp, extNamespace, getErrorReporter()};
+          compExtCtx = (ComponentExtensionContext)ctor.newInstance(ctorParmValues);
+      } 
+      catch (Exception e) {
+          //SecurityException
+          //NoSuchMethodException
+          //InvocationTargetException
+          //InstantiationException
+          //IllegalAccessException
+          String msg = getErrorReporter().getFormattedMessage("WSDL009", 
+                           new Object[] {compExtCtxClass.getName()});
+          throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL009: " + msg, e);
+      } 
+      
+      
+      return compExtCtx;
+  }
+  
+    public void registerResourceBundle(String resourceBundleName) {
+        fResourceBundleNames.add(resourceBundleName);
+    }
+    
+    public String[] queryResourceBundleNames() {
+        String[] array = new String[fResourceBundleNames.size()];
+        fResourceBundleNames.toArray(array);
+        return array;
+    }
+    
+    /**
+     * Register an Assertion along with the target Class that the assertion applies to.
+     * TODO assertion dependencies.
+     * 
+     * @param assertion an Assertion object representing the assertion to be registered.
+     * @param targetClass the Class representing the component in the WSDL that the assertion applies to.
+     */
+    public void registerAssertion(Assertion assertion, Class targetClass) {
+        if(assertion == null) {
+            String msg = this.errorReporter.getFormattedMessage("WSDL026", new Object[] {"assertion"});
+            throw new NullPointerException(msg);
+        } else if(targetClass == null) {
+            String msg = this.errorReporter.getFormattedMessage("WSDL026", new Object[] {"targetClass"});
+            throw new NullPointerException(msg);
+        }
+        
+        this.assertionReg.put(assertion.getId(), new AssertionInfo(assertion, targetClass));
+    }
+    
+    public AssertionInfo queryAssertion(String assertionId) {
+        return (AssertionInfo) this.assertionReg.get(assertionId);
+    }
+    
+    public AssertionInfo[] queryAssertions() {
+        Collection values = this.assertionReg.values();
+        AssertionInfo[] array = new AssertionInfo[values.size()];
+        values.toArray(array);
+        return array;
+    }
+    
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org


Mime
View raw message