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/29 14:01:33 UTC
svn commit: r570770 - in
/incubator/woden/trunk/java/src/org/apache/woden/internal: ./ wsdl20/
wsdl20/extensions/
Author: jkaputin
Date: Wed Aug 29 05:01:32 2007
New Revision: 570770
URL: http://svn.apache.org/viewvc?rev=570770&view=rev
Log:
WODEN-177
Improvements to the use of WSDLContext across the
woden implementation. Includes refactoring common
behaviour into BaseWSDLFactory.
Added:
incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLFactory.java (with props)
Modified:
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/ErrorReporterImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLFactory.java
incubator/woden/trunk/java/src/org/apache/woden/internal/WSDLContext.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/PopulatedExtensionRegistry.java
Added: incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLFactory.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLFactory.java?rev=570770&view=auto
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLFactory.java (added)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLFactory.java Wed Aug 29 05:01:32 2007
@@ -0,0 +1,66 @@
+/**
+ * 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.WSDLException;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.WSDLReader;
+import org.apache.woden.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.internal.wsdl20.extensions.PopulatedExtensionRegistry;
+import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+
+/**
+ * This abstract class contains properties and methods common
+ * to WSDLFactory implementations.
+ *
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public abstract class BaseWSDLFactory extends WSDLFactory {
+
+ protected WSDLContext fWsdlContext;
+
+ protected BaseWSDLFactory() throws WSDLException {
+ ErrorReporter errRpt = new ErrorReporterImpl();
+ ExtensionRegistry extReg = new PopulatedExtensionRegistry(errRpt);
+ ((ErrorReporterImpl)errRpt).setExtensionRegistry(extReg);
+ fWsdlContext = new WSDLContext(this, errRpt, extReg);
+ }
+
+ abstract public WSDLReader newWSDLReader() throws WSDLException;
+
+ public ExtensionRegistry newPopulatedExtensionRegistry() {
+ return new PopulatedExtensionRegistry(fWsdlContext.errorReporter);
+ }
+
+ //TODO change the name of this API method to newDescriptionElement()
+ public DescriptionElement newDescription() {
+ return new DescriptionImpl(fWsdlContext);
+ }
+
+ /*
+ * Package private method used by the Woden implementation to create a description
+ * element object with a wsdl context different to the default context provided
+ * provided by this wsdl factory. For example, a wsdl reader or writer may pass
+ * its own context object to this method.
+ */
+ DescriptionElement newDescriptionElement(WSDLContext wsdlContext) {
+ return new DescriptionImpl(wsdlContext);
+ }
+
+}
Propchange: incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
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?rev=570770&r1=570769&r2=570770&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java Wed Aug 29 05:01:32 2007
@@ -75,7 +75,7 @@
* this class is currently WSDL version-independent and XML parser-independent;
* should try to keep it that way.
*
- * @author jkaputin@apache.org
+ * @author John Kaputin (jkaputin@apache.org)
*/
public abstract class BaseWSDLReader implements WSDLReader {
@@ -84,10 +84,10 @@
private String fFactoryImplName = null; //TODO deprecate/remove?
private URIResolver fResolver = null;
- final protected WSDLContext fWsdlContext;
+ protected WSDLContext fWsdlContext;
final protected ReaderFeatures features;
- BaseWSDLReader(WSDLContext wsdlContext) throws WSDLException {
+ protected 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();
@@ -157,18 +157,8 @@
*
* @return Returns a.
*/
- protected WSDLFactory getFactory() throws WSDLException
- {
+ protected WSDLFactory getFactory() throws WSDLException {
return fWsdlContext.wsdlFactory;
- /*
- if(fFactory == null)
- {
- fFactory = (fFactoryImplName != null)
- ? WSDLFactory.newInstance(fFactoryImplName)
- : WSDLFactory.newInstance();
- }
- return fFactory;
- */
}
/**
@@ -202,12 +192,14 @@
throw new NullPointerException(msg);
}
- fWsdlContext.setExtensionRegistry(extReg);
+ fWsdlContext = new WSDLContext(
+ fWsdlContext.wsdlFactory,
+ fWsdlContext.errorReporter,
+ extReg);
}
- public ExtensionRegistry getExtensionRegistry()
- {
- return fWsdlContext.getExtensionRegistry();
+ public ExtensionRegistry getExtensionRegistry() {
+ return fWsdlContext.extensionRegistry;
}
/**
@@ -372,7 +364,9 @@
ErrorReporter.SEVERITY_FATAL_ERROR);
}
- DescriptionElement desc = getFactory().newDescription();
+ //Get a new description in the context of this reader
+ DescriptionElement desc =
+ ((BaseWSDLFactory)getFactory()).newDescriptionElement(fWsdlContext);
if(wsdlModules == null)
{
@@ -1547,7 +1541,7 @@
return null;
}
- ExtensionRegistry extReg = fWsdlContext.getExtensionRegistry();
+ ExtensionRegistry extReg = fWsdlContext.extensionRegistry;
ExtensionDeserializer extDS = extReg.queryDeserializer(parentType, elementType);
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?rev=570770&r1=570769&r2=570770&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLFactory.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLFactory.java Wed Aug 29 05:01:32 2007
@@ -17,38 +17,20 @@
package org.apache.woden.internal;
import org.apache.woden.WSDLException;
-import org.apache.woden.WSDLFactory;
import org.apache.woden.WSDLReader;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.internal.wsdl20.extensions.PopulatedExtensionRegistry;
-import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
-import org.apache.woden.wsdl20.xml.DescriptionElement;
/**
* @author John Kaputin (jkaputin@apache.org)
*/
-public class DOMWSDLFactory extends WSDLFactory {
-
- private WSDLContext fWsdlContext;
+public class DOMWSDLFactory extends BaseWSDLFactory {
public DOMWSDLFactory() throws WSDLException {
- fWsdlContext = new WSDLContext(this, new ErrorReporterImpl());
- ExtensionRegistry extReg = newPopulatedExtensionRegistry();
- fWsdlContext.setExtensionRegistry(extReg);
+ super();
}
public WSDLReader newWSDLReader() throws WSDLException {
return new DOMWSDLReader(fWsdlContext);
}
- public DescriptionElement newDescription() {
- return new DescriptionImpl(fWsdlContext);
- }
-
- public ExtensionRegistry newPopulatedExtensionRegistry()
- {
- 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?rev=570770&r1=570769&r2=570770&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLReader.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLReader.java Wed Aug 29 05:01:32 2007
@@ -449,7 +449,7 @@
//TODO reg namespaces at appropriate element scope, not just at desc.
//DOMUtils.registerUniquePrefix(prefix, namespaceURI, desc);
- ExtensionRegistry extReg = fWsdlContext.getExtensionRegistry();
+ ExtensionRegistry extReg = fWsdlContext.extensionRegistry;
XMLAttr xmlAttr = extReg.createExtAttribute(wsdlClass, attrType, extEl, attrValue);
if(xmlAttr != null) //TODO use an 'UnknownAttr' class in place of null
{
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorReporterImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorReporterImpl.java?rev=570770&r1=570769&r2=570770&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorReporterImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorReporterImpl.java Wed Aug 29 05:01:32 2007
@@ -17,14 +17,14 @@
package org.apache.woden.internal;
import java.util.Locale;
+
import org.apache.woden.ErrorHandler;
import org.apache.woden.ErrorInfo;
import org.apache.woden.ErrorLocator;
import org.apache.woden.ErrorReporter;
import org.apache.woden.WSDLException;
-import org.apache.woden.internal.ErrorInfoImpl;
-import org.apache.woden.internal.MessageFormatter;
import org.apache.woden.internal.util.PropertyUtils;
+import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
/**
@@ -52,7 +52,7 @@
* via <code>setLocale</code> and a custom error handler implementation
* may be configured as a system property.
*
- * @author jkaputin@apache.org
+ * @author John Kaputin (jkaputin@apache.org)
*/
public class ErrorReporterImpl implements ErrorReporter {
@@ -81,7 +81,10 @@
private ErrorHandler fDefaultErrorHandler;
//Custom error handler to use instead of the default error handler
- private ErrorHandler fErrorHandler;
+ private ErrorHandler fErrorHandler;
+
+ //ExtensionRegistry contains names of user-registered error message ResourceBundles
+ private ExtensionRegistry fExtensionRegistry;
/*
* The default constructor sets the instance variables. It uses default
@@ -285,5 +288,10 @@
{
String message = fMessageFormatter.formatMessage(fLocale, key, arguments);
return message;
+ }
+
+ //Package private as this is only
+ void setExtensionRegistry(ExtensionRegistry extensionRegistry) {
+ fExtensionRegistry = extensionRegistry;
}
}
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?rev=570770&r1=570769&r2=570770&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLFactory.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLFactory.java Wed Aug 29 05:01:32 2007
@@ -17,34 +17,17 @@
package org.apache.woden.internal;
import org.apache.woden.WSDLException;
-import org.apache.woden.WSDLFactory;
import org.apache.woden.WSDLReader;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.internal.wsdl20.extensions.PopulatedExtensionRegistry;
-import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
-import org.apache.woden.wsdl20.xml.DescriptionElement;
-public class OMWSDLFactory extends WSDLFactory {
+public class OMWSDLFactory extends BaseWSDLFactory {
- private WSDLContext fWsdlContext;
-
public OMWSDLFactory() throws WSDLException {
- fWsdlContext = new WSDLContext(this, new ErrorReporterImpl());
- ExtensionRegistry extReg = newPopulatedExtensionRegistry();
- fWsdlContext.setExtensionRegistry(extReg);
+ super();
}
//Returns an OMWSDLReader
public WSDLReader newWSDLReader() throws WSDLException {
return new OMWSDLReader(fWsdlContext);
- }
-
- public DescriptionElement newDescription() {
- return new DescriptionImpl(fWsdlContext);
- }
-
- public ExtensionRegistry newPopulatedExtensionRegistry() {
- return new PopulatedExtensionRegistry(fWsdlContext);
}
}
Modified: 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?rev=570770&r1=570769&r2=570770&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/WSDLContext.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/WSDLContext.java Wed Aug 29 05:01:32 2007
@@ -33,21 +33,14 @@
public class WSDLContext {
final public WSDLFactory wsdlFactory;
final public ErrorReporter errorReporter;
- private ExtensionRegistry extensionRegistry;
+ final public ExtensionRegistry extensionRegistry;
- //package private ctor - should only be created by WSDLFactory impl class
+ //package private ctor
WSDLContext(WSDLFactory wsdlFactory,
- ErrorReporter errorReporter) {
+ ErrorReporter errorReporter,
+ ExtensionRegistry extensionRegistry) {
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;
}
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java?rev=570770&r1=570769&r2=570770&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/ComponentModelBuilder.java Wed Aug 29 05:01:32 2007
@@ -367,7 +367,7 @@
* Create a ComponentExtensions object for each registered extension
* namespace used within this operation by extension elements or attributes.
*/
- ExtensionRegistry er = fDesc.getWsdlContext().getExtensionRegistry();
+ ExtensionRegistry er = fDesc.getWsdlContext().extensionRegistry;
URI[] extNamespaces = er
.queryComponentExtensionNamespaces(InterfaceOperation.class);
@@ -591,7 +591,7 @@
*/
private ComponentExtensions createComponentExtensions(Class parentClass,
WSDLElement parentElem, URI extNS) {
- ExtensionRegistry er = fDesc.getWsdlContext().getExtensionRegistry();
+ ExtensionRegistry er = fDesc.getWsdlContext().extensionRegistry;
ComponentExtensions compExt = null;
try {
compExt = er.createComponentExtension(parentClass, extNS);
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?rev=570770&r1=570769&r2=570770&view=diff
==============================================================================
--- 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 Wed Aug 29 05:01:32 2007
@@ -80,9 +80,9 @@
*/
public class PopulatedExtensionRegistry extends ExtensionRegistry {
- public PopulatedExtensionRegistry(WSDLContext wsdlContext) {
+ public PopulatedExtensionRegistry(ErrorReporter errorReporter) {
- super(wsdlContext.errorReporter);
+ super(errorReporter);
// ------------ Default type for unregistered extension attributes
// ------------
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org