You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2007/08/15 06:08:06 UTC
svn commit: r566017 [1/3] - in /incubator/woden/trunk/java:
src/org/apache/woden/ src/org/apache/woden/internal/
src/org/apache/woden/internal/util/ src/org/apache/woden/internal/wsdl20/
src/org/apache/woden/internal/wsdl20/extensions/ src/org/apache/w...
Author: jkaputin
Date: Tue Aug 14 21:08:03 2007
New Revision: 566017
URL: http://svn.apache.org/viewvc?view=rev&rev=566017
Log:
WODEN-177
Introduced WSDLContext for sharing user-configurable
objects across the woden implementation.
Added:
incubator/woden/trunk/java/src/org/apache/woden/internal/WSDLContext.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java
- copied, changed from r565356, incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java
Removed:
incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java
Modified:
incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java
incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java
incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLFactory.java
incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLReader.java
incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties
incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLFactory.java
incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLReader.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/WSDLElementImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/PopulatedExtensionRegistry.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/ArgumentArrayAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/BooleanAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/StringAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/TokenAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/URIAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/xml/XMLAttrImpl.java
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/DescriptionElement.java
incubator/woden/trunk/java/src/org/apache/woden/xml/UnknownAttr.java
incubator/woden/trunk/java/src/org/apache/woden/xml/XMLAttr.java
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/BindingFaultReferenceTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/BindingFaultTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/BindingMessageReferenceTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/BindingOperationTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/BindingTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/DescriptionTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/EndpointTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultReferenceTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceOperationTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/ServiceTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingFaultElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingFaultReferenceElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingOperationElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ChildElementCreationTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DescriptiontElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DocumentationElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ImportElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/IncludeElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultReferenceElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceOperationElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/NameAttributeTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/OMServiceElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ServiceElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/xml/IntOrTokenAttrTest.java
incubator/woden/trunk/java/test/org/apache/woden/xml/TokenAttrTest.java
Modified: incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java Tue Aug 14 21:08:03 2007
@@ -208,6 +208,13 @@
*/
public String getFactoryImplName();
+ /**
+ * Set the extension registry to the specified registry reference.
+ * The registry parameter cannot be null.
+ *
+ * @param extReg an ExtensionRegistry
+ * @throws NullPointerException if extReg is null
+ */
public void setExtensionRegistry(ExtensionRegistry extReg);
public ExtensionRegistry getExtensionRegistry();
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java Tue Aug 14 21:08:03 2007
@@ -81,18 +81,16 @@
private final String DEFAULT_RESOLVER_PROPERTY="org.apache.woden.resolver.default";
- private WSDLFactory fFactory;
- private String fFactoryImplName = null;
- private ErrorReporter fErrorReporter;
- private ExtensionRegistry fExtReg;
+ private String fFactoryImplName = null; //TODO deprecate/remove?
private URIResolver fResolver = null;
- protected ReaderFeatures features;
+ final protected WSDLContext fWsdlContext;
+ final protected ReaderFeatures features;
- BaseWSDLReader(WSDLFactory factory) throws WSDLException {
- fFactory = factory;
- fFactoryImplName = factory.getClass().getName();
- fErrorReporter= new ErrorReporterImpl();
+ BaseWSDLReader(WSDLContext wsdlContext) throws WSDLException {
+ fWsdlContext = wsdlContext;
+ //TODO decide what to do with fact impl name...re- only known use case is to change newDescription factory method
+ fFactoryImplName = fWsdlContext.wsdlFactory.getClass().getName();
features = new ReaderFeatures();
/* Establish the default URIResolver.
@@ -148,17 +146,21 @@
*/
public ErrorReporter getErrorReporter()
{
- return fErrorReporter;
+ return fWsdlContext.errorReporter;
}
/**
* Get the cached WSDLFactory if there is one, otherwise
* create and cache a new one.
*
+ * TODO see setFactoryImplName todo
+ *
* @return Returns a.
*/
protected WSDLFactory getFactory() throws WSDLException
{
+ return fWsdlContext.wsdlFactory;
+ /*
if(fFactory == null)
{
fFactory = (fFactoryImplName != null)
@@ -166,6 +168,7 @@
: WSDLFactory.newInstance();
}
return fFactory;
+ */
}
/**
@@ -173,11 +176,13 @@
* any subsequent WSDLFactory requests, first discarding any cached factory
* object.
*
+ * TODO the use case is changing the factory that creates Description objects. Decide if/how this works with WSDLContext.
+ *
* @param factoryImplName the WSDLFactory implementation classname
*/
public void setFactoryImplName(String factoryImplName) {
- fFactory = null;
+ //fFactory = null;
fFactoryImplName = factoryImplName;
}
@@ -191,12 +196,18 @@
public void setExtensionRegistry(ExtensionRegistry extReg)
{
- fExtReg = extReg;
+ if(extReg == null) {
+ String msg = fWsdlContext.errorReporter.getFormattedMessage(
+ "WSDL014", new Object[] {});
+ throw new NullPointerException(msg);
+ }
+
+ fWsdlContext.setExtensionRegistry(extReg);
}
public ExtensionRegistry getExtensionRegistry()
{
- return fExtReg;
+ return fWsdlContext.getExtensionRegistry();
}
/**
@@ -219,7 +230,7 @@
{
//name must not be null
throw new IllegalArgumentException(
- fErrorReporter.getFormattedMessage("WSDL005", null));
+ fWsdlContext.errorReporter.getFormattedMessage("WSDL005", null));
}
try
{
@@ -230,7 +241,7 @@
// Feature name is not recognized, so throw an exception.
Object[] args = new Object[] {name};
throw new IllegalArgumentException(
- fErrorReporter.getFormattedMessage("WSDL006", args));
+ fWsdlContext.errorReporter.getFormattedMessage("WSDL006", args));
}
}
@@ -247,7 +258,7 @@
{
//name must not be null
throw new IllegalArgumentException(
- fErrorReporter.getFormattedMessage("WSDL005", null));
+ fWsdlContext.errorReporter.getFormattedMessage("WSDL005", null));
}
try
@@ -259,7 +270,7 @@
// Feature name is not recognized, so throw an exception.
Object[] args = new Object[] {name};
throw new IllegalArgumentException(
- fErrorReporter.getFormattedMessage("WSDL006", args));
+ fWsdlContext.errorReporter.getFormattedMessage("WSDL006", args));
}
}
@@ -283,7 +294,7 @@
{
//name must not be null
throw new IllegalArgumentException(
- fErrorReporter.getFormattedMessage("WSDL007", null));
+ fWsdlContext.errorReporter.getFormattedMessage("WSDL007", null));
}
else if(name.equals("xyz"))
{
@@ -295,7 +306,7 @@
//property name is not recognized, so throw an exception
Object[] args = new Object[] {name};
throw new IllegalArgumentException(
- fErrorReporter.getFormattedMessage("WSDL008", args));
+ fWsdlContext.errorReporter.getFormattedMessage("WSDL008", args));
}
}
@@ -312,7 +323,7 @@
{
//name must not be null
throw new IllegalArgumentException(
- fErrorReporter.getFormattedMessage("WSDL007", null));
+ fWsdlContext.errorReporter.getFormattedMessage("WSDL007", null));
}
//Return the property's value or throw an exception if the property
@@ -329,7 +340,7 @@
//property name is not recognized, so throw an exception
Object[] args = new Object[] {name};
throw new IllegalArgumentException(
- fErrorReporter.getFormattedMessage("WSDL008", args));
+ fWsdlContext.errorReporter.getFormattedMessage("WSDL008", args));
}
}
@@ -370,6 +381,7 @@
wsdlModules = new HashMap();
}
+ /*JKctx
if(getExtensionRegistry() != null)
{
desc.setExtensionRegistry(getExtensionRegistry());
@@ -379,6 +391,7 @@
{
(desc.getExtensionRegistry()).setErrorReporter(getErrorReporter());
}
+ */
desc.setDocumentBaseURI(getURI(documentBaseURI));
@@ -1546,8 +1559,9 @@
return null;
}
- ExtensionRegistry extReg = desc.getExtensionRegistry();
+ ExtensionRegistry extReg = fWsdlContext.getExtensionRegistry();
+ /*JKctx
if (extReg == null)
{
getErrorReporter().reportError(
@@ -1557,9 +1571,9 @@
ErrorReporter.SEVERITY_ERROR);
return null;
}
+ */
- ExtensionDeserializer extDS = extReg.queryDeserializer(parentType,
- elementType);
+ ExtensionDeserializer extDS = extReg.queryDeserializer(parentType, elementType);
return extDS.unmarshall(parentType, parent, elementType, el, desc, extReg);
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLFactory.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLFactory.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLFactory.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLFactory.java Tue Aug 14 21:08:03 2007
@@ -30,25 +30,25 @@
*/
public class DOMWSDLFactory extends WSDLFactory {
+ private WSDLContext fWsdlContext;
+
+ public DOMWSDLFactory() throws WSDLException {
+ fWsdlContext = new WSDLContext(this, new ErrorReporterImpl());
+ ExtensionRegistry extReg = newPopulatedExtensionRegistry();
+ fWsdlContext.setExtensionRegistry(extReg);
+ }
+
public WSDLReader newWSDLReader() throws WSDLException {
-
- return new DOMWSDLReader(this);
-
+ return new DOMWSDLReader(fWsdlContext);
}
public DescriptionElement newDescription() {
-
- DescriptionElement desc = new DescriptionImpl();
-
- ExtensionRegistry extReg = newPopulatedExtensionRegistry();
- desc.setExtensionRegistry(extReg);
-
- return desc;
+ return new DescriptionImpl(fWsdlContext);
}
public ExtensionRegistry newPopulatedExtensionRegistry()
{
- return new PopulatedExtensionRegistry();
+ return new PopulatedExtensionRegistry(fWsdlContext);
}
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLReader.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLReader.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLReader.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLReader.java Tue Aug 14 21:08:03 2007
@@ -85,8 +85,8 @@
*/
private WSDLComponentValidator compValidator = null;
- DOMWSDLReader(WSDLFactory factory) throws WSDLException {
- super(factory);
+ DOMWSDLReader(WSDLContext wsdlContext) throws WSDLException {
+ super(wsdlContext);
}
/* ************************************************************
@@ -439,7 +439,8 @@
String namespaceURI = domAttr.getNamespaceURI();
String prefix = domAttr.getPrefix();
QName attrType = new QName(namespaceURI, localName, (prefix != null ? prefix : ""));
-
+ String attrValue = domAttr.getValue();
+
if (namespaceURI != null && !namespaceURI.equals(Constants.NS_URI_WSDL20))
{
if (!namespaceURI.equals(Constants.NS_URI_XMLNS) &&
@@ -448,24 +449,11 @@
//TODO reg namespaces at appropriate element scope, not just at desc.
//DOMUtils.registerUniquePrefix(prefix, namespaceURI, desc);
- XMLAttr xmlAttr = null;
- ExtensionRegistry extReg = desc.getExtensionRegistry();
- if (extReg != null)
- {
- xmlAttr = extReg.createExtAttribute(wsdlClass, attrType);
- if(xmlAttr != null) //TODO use an 'UnknownAttr' class in place of null
- {
- String attrValue = domAttr.getValue();
- //Wrap the domEl in DOMXMLElement
- XMLElement domElSource = createXMLElement(domEl);
- xmlAttr.init(domElSource, attrType, attrValue);
- wsdlObj.setExtensionAttribute(attrType, xmlAttr);
- }
- }
- else
+ ExtensionRegistry extReg = fWsdlContext.getExtensionRegistry();
+ XMLAttr xmlAttr = extReg.createExtAttribute(wsdlClass, attrType, extEl, attrValue);
+ if(xmlAttr != null) //TODO use an 'UnknownAttr' class in place of null
{
- //This reader cannot handle extensions, so stop.
- break;
+ wsdlObj.setExtensionAttribute(attrType, xmlAttr);
}
}
else
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties Tue Aug 14 21:08:03 2007
@@ -48,7 +48,7 @@
WSDL011=The Java class "{0}" does not implement the "Attr" interface.
WSDL012=No Java type was registered for the extension element "{0}" in the context of "{1}".
WSDL013=The Java class "{0}" does not implement the "ExtensionElement" interface.
-WSDL014=No Extension Registry was set on the DescriptionElement so cannot handle the extension element "{0}" in the context of "{1}".
+WSDL014=Cannot specify a null Extension Registry.
WSDL015=The extension namespace "{0}" in the context of "{1}" does not have a Java class registered.
WSDL016=The Java class "{0}" does not implement the "ComponentExtensions" interface.
WSDL017=WSDL source represented by the type "{0}" cannot be read by the WSDLReader implementation class "{1}".
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLFactory.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLFactory.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLFactory.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLFactory.java Tue Aug 14 21:08:03 2007
@@ -26,20 +26,25 @@
public class OMWSDLFactory extends WSDLFactory {
+ private WSDLContext fWsdlContext;
+
+ public OMWSDLFactory() throws WSDLException {
+ fWsdlContext = new WSDLContext(this, new ErrorReporterImpl());
+ ExtensionRegistry extReg = newPopulatedExtensionRegistry();
+ fWsdlContext.setExtensionRegistry(extReg);
+ }
+
//Returns an OMWSDLReader
public WSDLReader newWSDLReader() throws WSDLException {
- return new OMWSDLReader(this);
+ return new OMWSDLReader(fWsdlContext);
}
public DescriptionElement newDescription() {
- DescriptionElement desc = new DescriptionImpl();
- ExtensionRegistry extReg = newPopulatedExtensionRegistry();
- desc.setExtensionRegistry(extReg);
- return desc;
+ return new DescriptionImpl(fWsdlContext);
}
public ExtensionRegistry newPopulatedExtensionRegistry() {
- return new PopulatedExtensionRegistry();
+ return new PopulatedExtensionRegistry(fWsdlContext);
}
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLReader.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLReader.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLReader.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLReader.java Tue Aug 14 21:08:03 2007
@@ -61,8 +61,8 @@
//A map of imported schema definitions keyed by schema location URI
private Map fImportedSchemas = new Hashtable();
- OMWSDLReader(WSDLFactory factory) throws WSDLException {
- super(factory);
+ OMWSDLReader(WSDLContext wsdlContext) throws WSDLException {
+ super(wsdlContext);
}
public Description readWSDL(String wsdlURI) throws WSDLException {
Added: incubator/woden/trunk/java/src/org/apache/woden/internal/WSDLContext.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/WSDLContext.java?view=auto&rev=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/WSDLContext.java (added)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/WSDLContext.java Tue Aug 14 21:08:03 2007
@@ -0,0 +1,53 @@
+/**
+ * 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.internal;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+
+/**
+ * A container of objects shared across Woden within the context of a WSDLFactory.
+ *
+ * TODO may need to be API, if so interface is WSDLContext, class name is WSDLContextImpl, add getters and make variables private
+ * TODO check for use cases that break the WSDLFactory context concept (ie WSDLReader.setFactoryImplName).
+ * TODO decide if anything else should be kept here (e.g. woden feats & props, Description factory)
+ *
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public class WSDLContext {
+ final public WSDLFactory wsdlFactory;
+ final public ErrorReporter errorReporter;
+ private ExtensionRegistry extensionRegistry;
+
+ //package private ctor - should only be created by WSDLFactory impl class
+ WSDLContext(WSDLFactory wsdlFactory,
+ ErrorReporter errorReporter) {
+ this.wsdlFactory = wsdlFactory;
+ this.errorReporter = errorReporter;
+ }
+
+ //package private - should only be called by WSDLReader.setExtensionRegistry impls
+ void setExtensionRegistry(ExtensionRegistry extensionRegistry) {
+ this.extensionRegistry = extensionRegistry;
+ }
+
+ public ExtensionRegistry getExtensionRegistry() {
+ return this.extensionRegistry;
+ }
+}
Copied: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java (from r565356, incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java)
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java?view=diff&rev=566017&p1=incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java&r1=565356&p2=incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java Tue Aug 14 21:08:03 2007
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.woden.internal.util;
+package org.apache.woden.internal.wsdl20;
import java.net.URI;
import java.util.Iterator;
@@ -25,19 +25,6 @@
import org.apache.woden.WSDLException;
import org.apache.woden.internal.schema.SchemaConstants;
-import org.apache.woden.internal.wsdl20.BindingFaultImpl;
-import org.apache.woden.internal.wsdl20.BindingFaultReferenceImpl;
-import org.apache.woden.internal.wsdl20.BindingImpl;
-import org.apache.woden.internal.wsdl20.BindingMessageReferenceImpl;
-import org.apache.woden.internal.wsdl20.BindingOperationImpl;
-import org.apache.woden.internal.wsdl20.Constants;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.internal.wsdl20.ElementDeclarationImpl;
-import org.apache.woden.internal.wsdl20.EndpointImpl;
-import org.apache.woden.internal.wsdl20.InterfaceImpl;
-import org.apache.woden.internal.wsdl20.InterfaceOperationImpl;
-import org.apache.woden.internal.wsdl20.ServiceImpl;
-import org.apache.woden.internal.wsdl20.TypeDefinitionImpl;
import org.apache.woden.internal.wsdl20.extensions.ComponentExtensionsImpl;
import org.apache.woden.internal.wsdl20.extensions.rpc.RPCConstants;
import org.apache.woden.schema.Schema;
@@ -380,7 +367,7 @@
* Create a ComponentExtensions object for each registered extension
* namespace used within this operation by extension elements or attributes.
*/
- ExtensionRegistry er = fDesc.getExtensionRegistry();
+ ExtensionRegistry er = fDesc.getWsdlContext().getExtensionRegistry();
URI[] extNamespaces = er
.queryComponentExtensionNamespaces(InterfaceOperation.class);
@@ -604,7 +591,7 @@
*/
private ComponentExtensions createComponentExtensions(Class parentClass,
WSDLElement parentElem, URI extNS) {
- ExtensionRegistry er = fDesc.getExtensionRegistry();
+ ExtensionRegistry er = fDesc.getWsdlContext().getExtensionRegistry();
ComponentExtensions compExt = null;
try {
compExt = er.createComponentExtension(parentClass, extNS);
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java Tue Aug 14 21:08:03 2007
@@ -28,7 +28,7 @@
import org.apache.woden.WSDLException;
import org.apache.woden.internal.MessageFormatter;
-import org.apache.woden.internal.util.ComponentModelBuilder;
+import org.apache.woden.internal.WSDLContext;
import org.apache.woden.wsdl20.Binding;
import org.apache.woden.wsdl20.Description;
import org.apache.woden.wsdl20.ElementDeclaration;
@@ -36,6 +36,8 @@
import org.apache.woden.wsdl20.Service;
import org.apache.woden.wsdl20.TypeDefinition;
import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+import org.apache.woden.wsdl20.fragids.DescriptionPart;
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
import org.apache.woden.wsdl20.xml.BindingElement;
import org.apache.woden.wsdl20.xml.DescriptionElement;
import org.apache.woden.wsdl20.xml.ImportElement;
@@ -46,9 +48,6 @@
import org.apache.woden.wsdl20.xml.TypesElement;
import org.apache.woden.wsdl20.xml.WSDLElement;
-import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
-import org.apache.woden.wsdl20.fragids.DescriptionPart;
-
/**
* This class provides the implementation for a Description component from
* the WSDL Component Model, as described in the WSDL 2.0 specification.
@@ -72,9 +71,6 @@
* WSDL Component model data (flattened properties of Description Component)
* TODO cache top-level components here with a flush-on-update mechanism
*/
- private List fAllInterfaces = null;
- private List fAllBindings = null;
- private List fAllServices = null;
private List fAllElementDeclarations = new Vector();
private List fAllTypeDefinitions = new Vector();
@@ -100,8 +96,16 @@
*/
private boolean fComponentsInitialized = false;
- private ExtensionRegistry fExtReg = null;
+ private WSDLContext fWsdlContext;
+ /*
+ * Constructors
+ */
+ private DescriptionImpl() {};
+
+ public DescriptionImpl(WSDLContext wsdlContext) {
+ fWsdlContext = wsdlContext;
+ }
/* ************************************************************
* Description interface methods (the WSDL Component model)
@@ -453,8 +457,7 @@
fTypesElement.setParentElement(this);
return fTypesElement;
} else {
- String msg = new MessageFormatter().formatMessage(
- null,
+ String msg = fWsdlContext.errorReporter.getFormattedMessage(
"WSDL523",
new Object[] {});
throw new WSDLException(WSDLException.OTHER_ERROR, msg);
@@ -519,15 +522,19 @@
return service;
}
+ /*JKctx
public void setExtensionRegistry(ExtensionRegistry extReg)
{
+ //method has been deprecated, to be removed pre or post M8
fExtReg = extReg;
}
public ExtensionRegistry getExtensionRegistry()
{
+ //method has been deprecated, to be removed pre or post M8
return fExtReg;
}
+ */
/*
* @see org.apache.woden.wsdl20.xml.DescriptionElement#toComponent()
@@ -545,6 +552,12 @@
* Non-API implementation methods
* ************************************************************/
+ //package private, only needed by impl classes in this package
+ WSDLContext getWsdlContext() {
+ return fWsdlContext;
+ }
+
+ //TODO make this package private (several tests use it, these must chg to correct API pgm model)
public void addElementDeclaration(ElementDeclaration elDec)
{
if(elDec != null) {
@@ -552,6 +565,7 @@
}
}
+ //TODO make this package private (one test uses it, this must chg to correct API pgm model)
public void addTypeDefinition(TypeDefinition typeDef)
{
if(typeDef != null) {
@@ -612,6 +626,14 @@
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier()
+ */
+ public FragmentIdentifier getFragmentIdentifier() {
+ return new FragmentIdentifier(new DescriptionPart());
+ }
+
/**
* Nested elements within a <code><description></code> have attributes of type
* <i>xs:NCName</i>. The setter method for the attribute will take an NCName object as
@@ -648,11 +670,4 @@
return namespace;
}
- /*
- * (non-Javadoc)
- * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier()
- */
- public FragmentIdentifier getFragmentIdentifier() {
- return new FragmentIdentifier(new DescriptionPart());
- }
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/WSDLElementImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/WSDLElementImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/WSDLElementImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/WSDLElementImpl.java Tue Aug 14 21:08:03 2007
@@ -20,9 +20,11 @@
import javax.xml.namespace.QName;
+import org.apache.woden.internal.WSDLContext;
import org.apache.woden.internal.wsdl20.extensions.AttributeExtensibleImpl;
import org.apache.woden.internal.wsdl20.extensions.ElementExtensibleImpl;
import org.apache.woden.wsdl20.extensions.ExtensionElement;
+import org.apache.woden.wsdl20.xml.NestedElement;
import org.apache.woden.wsdl20.xml.WSDLElement;
import org.apache.woden.xml.XMLAttr;
@@ -119,4 +121,19 @@
return fElemExt.hasExtensionElementsForNamespace(namespace);
}
+ //package private
+ WSDLContext getWsdlContext() {
+ return getWsdlContext(this);
+ }
+
+ static private WSDLContext getWsdlContext(WSDLElement wElem) {
+ if (wElem instanceof NestedElement) {
+ WSDLElement parent = ((NestedElement) wElem).getParentElement();
+ return getWsdlContext(parent);
+ }
+
+ //This is not a nested element, so the WSDL context is in this element, at the top of the tree.
+ //This element will override the getWsdlContext() method defined in WSDLElementImpl.
+ return ((WSDLElementImpl)wElem).getWsdlContext();
+ }
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/PopulatedExtensionRegistry.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/PopulatedExtensionRegistry.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/PopulatedExtensionRegistry.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/PopulatedExtensionRegistry.java Tue Aug 14 21:08:03 2007
@@ -16,6 +16,8 @@
*/
package org.apache.woden.internal.wsdl20.extensions;
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.internal.WSDLContext;
import org.apache.woden.internal.wsdl20.extensions.http.HTTPBindingExtensionsImpl;
import org.apache.woden.internal.wsdl20.extensions.http.HTTPBindingFaultExtensionsImpl;
import org.apache.woden.internal.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensionsImpl;
@@ -78,7 +80,13 @@
*/
public class PopulatedExtensionRegistry extends ExtensionRegistry {
- public PopulatedExtensionRegistry() {
+ final private WSDLContext fWsdlContext;
+
+ public PopulatedExtensionRegistry(WSDLContext wsdlContext) {
+
+ super(wsdlContext.errorReporter);
+ fWsdlContext = wsdlContext;
+
// ------------ Default type for unregistered extension attributes
// ------------
@@ -313,4 +321,9 @@
HTTPEndpointExtensionsImpl.class);
}
+
+ public ErrorReporter getErrorReporter()
+ {
+ return fWsdlContext.errorReporter;
+ }
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/ArgumentArrayAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/ArgumentArrayAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/ArgumentArrayAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/ArgumentArrayAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -42,13 +42,7 @@
public class ArgumentArrayAttrImpl extends XMLAttrImpl implements
ArgumentArrayAttr {
- public ArgumentArrayAttrImpl() {}
-
- /*
- * This ctor is not used for extension attributes, but may be useful if
- * parsing of native attributes is changed to use the XMLAttr interface.
- */
- protected ArgumentArrayAttrImpl(XMLElement ownerEl, QName attrType,
+ public ArgumentArrayAttrImpl(XMLElement ownerEl, QName attrType,
String attrValue, ErrorReporter errRpt) throws WSDLException {
super(ownerEl, attrType, attrValue, errRpt);
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/BooleanAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/BooleanAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/BooleanAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/BooleanAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -34,14 +34,8 @@
*/
public class BooleanAttrImpl extends XMLAttrImpl implements BooleanAttr
{
- public BooleanAttrImpl() {}
-
- /*
- * TODO This ctor is not used for extension attributes, but may be useful if
- * parsing of native WSDL attributes is changed to use the XMLAttr interface.
- */
- public BooleanAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt)
- throws WSDLException
+ public BooleanAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
{
super(ownerEl, attrType, attrValue, errRpt);
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -16,6 +16,8 @@
*/
package org.apache.woden.internal.xml;
+import javax.xml.namespace.QName;
+
import org.apache.woden.ErrorReporter;
import org.apache.woden.WSDLException;
import org.apache.woden.XMLElement;
@@ -32,6 +34,12 @@
public class HTTPAuthenticationSchemeAttrImpl extends XMLAttrImpl implements
HTTPAuthenticationSchemeAttr {
+ public HTTPAuthenticationSchemeAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
+ {
+ super(ownerEl, attrType, attrValue, errRpt);
+ }
+
/*
* (non-Javadoc)
*
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -16,6 +16,8 @@
*/
package org.apache.woden.internal.xml;
+import javax.xml.namespace.QName;
+
import org.apache.woden.ErrorReporter;
import org.apache.woden.WSDLException;
import org.apache.woden.XMLElement;
@@ -32,6 +34,12 @@
public class IntOrTokenAnyAttrImpl extends XMLAttrImpl implements IntOrTokenAttr
{
+ public IntOrTokenAnyAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
+ {
+ super(ownerEl, attrType, attrValue, errRpt);
+ }
+
/* ************************************************************
* QNameOrTokenAttr interface declared methods
* ************************************************************/
@@ -41,7 +49,7 @@
*/
public boolean isInt()
{
- return fContent instanceof Integer;
+ return getContent() instanceof Integer;
}
/* (non-Javadoc)
@@ -58,7 +66,7 @@
public Integer getInt()
{
if(isInt()) {
- return (Integer)fContent;
+ return (Integer)getContent();
} else {
return null;
}
@@ -70,7 +78,7 @@
public String getToken()
{
if(!isInt() && isValid()) {
- return (String)fContent;
+ return (String)getContent();
} else {
return null;
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -31,18 +31,12 @@
*/
public class QNameAttrImpl extends XMLAttrImpl implements QNameAttr
{
- public QNameAttrImpl() {}
-
- /*
- * TODO This ctor is not used for extension attributes, but may be useful if
- * parsing of native WSDL attributes is changed to use the XMLAttr interface.
- */
- public QNameAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt)
- throws WSDLException
+ public QNameAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
{
super(ownerEl, attrType, attrValue, errRpt);
}
-
+
/* ************************************************************
* QNameAttr interface declared methods
* ************************************************************/
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -37,14 +37,8 @@
*/
public class QNameListAttrImpl extends XMLAttrImpl implements QNameListAttr
{
- public QNameListAttrImpl() {}
-
- /*
- * TODO This ctor is not used for extension attributes, but may be useful if
- * parsing of native WSDL attributes is changed to use the XMLAttr interface.
- */
- public QNameListAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt)
- throws WSDLException
+ public QNameListAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
{
super(ownerEl, attrType, attrValue, errRpt);
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -39,7 +39,11 @@
public class QNameListOrTokenAnyAttrImpl extends XMLAttrImpl
implements QNameListOrTokenAttr
{
- public QNameListOrTokenAnyAttrImpl() {}
+ public QNameListOrTokenAnyAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
+ {
+ super(ownerEl, attrType, attrValue, errRpt);
+ }
/* ************************************************************
* QNameListOrTokenAttr interface declared methods
@@ -50,7 +54,7 @@
*/
public boolean isQNameList()
{
- return fContent instanceof QName[];
+ return getContent() instanceof QName[];
}
/* (non-Javadoc)
@@ -67,7 +71,7 @@
public QName[] getQNames()
{
if(isQNameList()) {
- return (QName[])fContent;
+ return (QName[])getContent();
} else {
return null;
}
@@ -79,7 +83,7 @@
public String getToken()
{
if(!isQNameList() && isValid()) {
- return (String)fContent;
+ return (String)getContent();
} else {
return null;
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -34,7 +34,11 @@
public class QNameOrTokenAnyAttrImpl extends XMLAttrImpl
implements QNameOrTokenAttr
{
- public QNameOrTokenAnyAttrImpl() {}
+ public QNameOrTokenAnyAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
+ {
+ super(ownerEl, attrType, attrValue, errRpt);
+ }
/* ************************************************************
* QNameOrTokenAttr interface declared methods
@@ -45,7 +49,7 @@
*/
public boolean isQName()
{
- return fContent instanceof QName;
+ return getContent() instanceof QName;
}
/* (non-Javadoc)
@@ -66,7 +70,7 @@
public QName getQName()
{
if(isQName()) {
- return (QName)fContent;
+ return (QName)getContent();
} else {
return null;
}
@@ -78,7 +82,7 @@
public String getToken()
{
if(!isQName() && isValid()) {
- return (String)fContent;
+ return (String)getContent();
} else {
return null;
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/StringAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/StringAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/StringAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/StringAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -32,14 +32,8 @@
*/
public class StringAttrImpl extends XMLAttrImpl implements StringAttr
{
- public StringAttrImpl() {}
-
- /*
- * TODO This ctor is not used for extension attributes, but may be useful if
- * parsing of native WSDL attributes is changed to use the XMLAttr interface.
- */
- public StringAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt)
- throws WSDLException
+ public StringAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
{
super(ownerEl, attrType, attrValue, errRpt);
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/TokenAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/TokenAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/TokenAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/TokenAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -35,14 +35,8 @@
*/
public class TokenAttrImpl extends XMLAttrImpl implements TokenAttr
{
- public TokenAttrImpl() {}
-
- /*
- * TODO This ctor is not used for extension attributes, but may be useful if
- * parsing of native WSDL attributes is changed to use the XMLAttr interface.
- */
- public TokenAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt)
- throws WSDLException
+ public TokenAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
{
super(ownerEl, attrType, attrValue, errRpt);
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/URIAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/URIAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/URIAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/URIAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -34,17 +34,12 @@
*/
public class URIAttrImpl extends XMLAttrImpl implements URIAttr
{
- public URIAttrImpl() {}
-
- /*
- * TODO This ctor is not used for extension attributes, but may be useful if
- * parsing of native WSDL attributes is changed to use the XMLAttr interface.
- */
- public URIAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt)
- throws WSDLException
+ public URIAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
{
super(ownerEl, attrType, attrValue, errRpt);
}
+
/* ************************************************************
* URIAttr interface declared methods
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/xml/XMLAttrImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/xml/XMLAttrImpl.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/xml/XMLAttrImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/xml/XMLAttrImpl.java Tue Aug 14 21:08:03 2007
@@ -22,6 +22,7 @@
import org.apache.woden.WSDLException;
import org.apache.woden.XMLElement;
import org.apache.woden.internal.ErrorReporterImpl;
+import org.apache.woden.internal.WSDLContext;
import org.apache.woden.xml.XMLAttr;
/**
@@ -32,41 +33,28 @@
*/
public abstract class XMLAttrImpl implements XMLAttr
{
- protected QName fAttrType = null;
- protected Object fContent = null;
- protected String fExternalForm = null;
- protected boolean fValid = true;
+ private QName fAttrType = null;
+ private Object fContent = null;
+ private String fExternalForm = null;
+ private boolean fValid = true;
private ErrorReporter fErrorReporter = null;
- protected XMLAttrImpl() {}
-
- /*
- * This ctor is not used for extension attributes, but may be useful if
- * parsing of native attributes is changed to use the XMLAttr interface.
- */
- protected XMLAttrImpl(XMLElement ownerEl, QName attrType, String attrValue, ErrorReporter errRpt)
- throws WSDLException
+ protected XMLAttrImpl(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
{
fErrorReporter = errRpt;
- init(ownerEl, attrType, attrValue);
+ fAttrType = attrType;
+ fExternalForm = attrValue;
+ fContent = convert(ownerEl, attrValue);
+ if(fContent == null) {
+ fValid = false;
+ }
}
/* ************************************************************
* XMLAttr interface declared methods
* ************************************************************/
- public void setErrorReporter(ErrorReporter errRpt) {
- fErrorReporter = errRpt;
- }
-
- public void init(XMLElement ownerEl, QName attrType, String attrValue) throws WSDLException
- {
- fAttrType = attrType;
- fExternalForm = attrValue;
- fContent = convert(ownerEl, attrValue);
- if(fContent == null) fValid = false;
- }
-
public QName getAttributeType() {
return fAttrType;
}
@@ -89,11 +77,8 @@
abstract protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException;
- protected ErrorReporter getErrorReporter() throws WSDLException
+ protected ErrorReporter getErrorReporter()
{
- if(fErrorReporter == null) {
- fErrorReporter = new ErrorReporterImpl();
- }
return fErrorReporter;
}
@@ -105,7 +90,7 @@
*
* TODO confirm this method is needed, otherwise remove it.
*/
- public void setValid(boolean validity) {
+ protected void setValid(boolean validity) {
fValid = validity;
}
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java Tue Aug 14 21:08:03 2007
@@ -16,6 +16,8 @@
*/
package org.apache.woden.wsdl20.extensions;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.util.Hashtable;
import java.util.Map;
@@ -25,6 +27,7 @@
import org.apache.woden.ErrorReporter;
import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
import org.apache.woden.wsdl20.xml.WSDLElement;
import org.apache.woden.xml.UnknownAttr;
import org.apache.woden.xml.XMLAttr;
@@ -40,7 +43,7 @@
* TODO update method javadocs.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
- * @author jkaputin@apache.org
+ * @author John Kaputin (jkaputin@apache.org)
*/
public class ExtensionRegistry
{
@@ -51,8 +54,9 @@
* UnknownExtensionSerializer, and an UnknownExtensionDeserializer,
* respectively.
*/
- public ExtensionRegistry()
+ public ExtensionRegistry(ErrorReporter errorReporter)
{
+ this.errorReporter = errorReporter;
setDefaultSerializer(new UnknownExtensionSerializer());
setDefaultDeserializer(new UnknownExtensionDeserializer());
}
@@ -89,14 +93,15 @@
private ErrorReporter errorReporter = null;
+ /*JKctx
public void setErrorReporter(ErrorReporter errRpt)
{
this.errorReporter = errRpt;
}
+ */
public ErrorReporter getErrorReporter()
{
- //TODO create a newErrorReporter method on WSDLFactory, then lazy init this field.
return this.errorReporter;
}
@@ -531,7 +536,7 @@
return attrClass;
}
- public XMLAttr createExtAttribute(Class ownerClass, QName attrQName)
+ public XMLAttr createExtAttribute(Class ownerClass, QName attrQName, XMLElement ownerElement, String attrValue)
throws WSDLException
{
Map innerExtensionAttributeReg = (Map)extAttributeReg.get(ownerClass);
@@ -586,20 +591,21 @@
}
try {
- attr = (XMLAttr)implClass.newInstance();
- attr.setErrorReporter(getErrorReporter());
+ 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 (InstantiationException e)
- {
- String msg = getErrorReporter().getFormattedMessage("WSDL009",
+ 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);
}
- catch (IllegalAccessException e) {
- String msg = getErrorReporter().getFormattedMessage("WSDL009",
- new Object[] {implClass.getName()});
- throw new WSDLException(WSDLException.CONFIGURATION_ERROR, msg, e);
- }
return attr;
}
@@ -712,7 +718,6 @@
}
catch (InstantiationException e)
{
- e.printStackTrace();
String msg = getErrorReporter().getFormattedMessage("WSDL009",
new Object[] {compExtClass.getName()});
throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "WSDL009: " + msg, e);
Modified: incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/DescriptionElement.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/DescriptionElement.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/DescriptionElement.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/DescriptionElement.java Tue Aug 14 21:08:03 2007
@@ -21,7 +21,6 @@
import org.apache.woden.WSDLException;
import org.apache.woden.wsdl20.Description;
-import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
/**
* Represents the WSDL 2.0 <description> element.
@@ -241,22 +240,6 @@
* @return an array of ServiceElement
*/
public ServiceElement[] getServiceElements();
-
- /**
- * Specify the ExtensionRegistry to be used handle WSDL extensions defined by this
- * DescriptionElement and by any WSDL elements nested within it.
- *
- * @param extReg the ExtensionRegistry used with this description
- */
- public void setExtensionRegistry(ExtensionRegistry extReg);
-
- /**
- * Return the ExtensionRegistry used handle WSDL extensions defined by this
- * DescriptionElement and by any WSDL elements nested within it.
- *
- * @return the ExtensionRegistry used with this description
- */
- public ExtensionRegistry getExtensionRegistry();
/**
* Return the Description component derived from this DescriptionElement.
Modified: incubator/woden/trunk/java/src/org/apache/woden/xml/UnknownAttr.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/xml/UnknownAttr.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/xml/UnknownAttr.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/xml/UnknownAttr.java Tue Aug 14 21:08:03 2007
@@ -35,24 +35,20 @@
private Object fContent = null;
private String fExternalForm = null;
private boolean fValid = true;
+ private ErrorReporter fErrorReporter = null;
- /* (non-Javadoc)
- * @see org.apache.woden.xml.XMLAttr#setErrorReporter(org.apache.woden.ErrorReporter)
- */
- public void setErrorReporter(ErrorReporter errRpt) {
- }
-
- /* (non-Javadoc)
- * @see org.apache.woden.xml.XMLAttr#init(org.w3c.dom.Element, java.lang.String)
- */
- public void init(XMLElement ownerEl, QName attrType, String attrValue) throws WSDLException
+ public UnknownAttr(XMLElement ownerEl, QName attrType,
+ String attrValue, ErrorReporter errRpt) throws WSDLException
{
+ fErrorReporter = errRpt;
fAttrType = attrType;
fExternalForm = attrValue;
fContent = attrValue;
- if(fContent == null) fValid = false;
+ if(fContent == null) {
+ fValid = false;
+ }
}
-
+
/* (non-Javadoc)
* @see org.apache.woden.xml.XMLAttr#getAttributeType()
*/
Modified: incubator/woden/trunk/java/src/org/apache/woden/xml/XMLAttr.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/xml/XMLAttr.java?view=diff&rev=566017&r1=566016&r2=566017
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/xml/XMLAttr.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/xml/XMLAttr.java Tue Aug 14 21:08:03 2007
@@ -35,16 +35,6 @@
*/
public interface XMLAttr
{
- public void setErrorReporter(ErrorReporter errRpt);
-
- /**
- * Take the external string form of the attribute and initialize
- * its internal object representation.
- *
- * @throws WSDLException if conversion errors occur
- */
- public void init(XMLElement ownerEl, QName attrType, String attrValue) throws WSDLException;
-
public QName getAttributeType();
public Object getContent();
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org