ws-woden-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sag...@apache.org
Subject svn commit: r809831 [2/10] - in /webservices/woden/trunk/java/woden-commons: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/woden/ src/main/java/org/apache/woden/internal/ src/main/java/org/apache...
Date Tue, 01 Sep 2009 05:49:07 GMT
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/BaseWSDLSource.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/BaseWSDLSource.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/BaseWSDLSource.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/BaseWSDLSource.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,68 @@
+/**
+ * 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 java.net.URI;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLSource;
+
+/**
+ * This abstract class implements methods of the WSDLSource interface that are
+ * common across all concrete implementations. The only method on this interface
+ * that is specific to each concrete implementation is the <code>setSource</code>
+ * method and this method is declared abstract on this class.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public abstract class BaseWSDLSource implements WSDLSource {
+    
+    private URI fBaseURI = null;
+    protected Object fSource = null;
+    protected ErrorReporter fErrorReporter = null;
+    
+    protected BaseWSDLSource(ErrorReporter errorReporter) {
+        fErrorReporter = errorReporter;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.WSDLSource#setSource(java.lang.Object)
+     */
+    abstract public void setSource(Object wsdlSource);
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.WSDLSource#getSource()
+     */
+    public Object getSource() {
+        return fSource;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.WSDLSource#setBaseURI(java.net.URI)
+     */
+    public void setBaseURI(URI baseURI) {
+        fBaseURI = baseURI;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.WSDLSource#getBaseURI()
+     */
+    public URI getBaseURI() {
+        return fBaseURI;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/BaseXMLElement.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/BaseXMLElement.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/BaseXMLElement.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/BaseXMLElement.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,178 @@
+/**
+ * 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 java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+
+/**
+ * This abstract class implements methods of the XMLElement interface that are
+ * common across all concrete implementations.
+ * 
+ */
+public abstract class BaseXMLElement implements XMLElement {
+
+    protected Object fSource = null;
+    protected ErrorReporter fErrorReporter = null;
+
+    protected BaseXMLElement(ErrorReporter errorReporter) {
+        fErrorReporter = errorReporter;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#setSource(java.lang.Object)
+     */
+    abstract public void setSource(Object elem);
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getSource()
+     */
+    public final Object getSource() {
+        return fSource;
+    }
+    
+    //TODO refactor getAttributes() here
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getAttribute(java.lang.String)
+     */
+    public final String getAttributeValue(String attrName) {
+    	
+    	if(fSource != null) {
+    		return doGetAttributeValue(attrName);
+    	} else { 
+    		return null;
+    	}
+    	
+    }
+    
+    protected abstract String doGetAttributeValue(String attrName);
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getNamespaceURI()
+     */
+    public final URI getNamespaceURI() throws WSDLException {
+    	
+    	if(fSource != null) {
+    		return doGetNamespaceURI();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract URI doGetNamespaceURI() throws WSDLException;
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getLocalName()
+     */
+    public final String getLocalName() {
+    	
+    	if(fSource != null) {
+    		return doGetLocalName();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract String doGetLocalName();
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getQName()
+     */
+    public final QName getQName() {
+    	
+    	if(fSource != null) {
+    		return doGetQName();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract QName doGetQName();
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getQName(java.lang.String)
+     */
+    public final QName getQName(String prefixedValue) throws WSDLException {
+    	
+    	if(fSource != null) {
+    		return doGetQName(prefixedValue);
+    	} else {
+    		return null;
+    	}
+    }
+
+    protected abstract QName doGetQName(String prefixedValue) throws WSDLException;
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getFirstChildElement()
+     */
+    public final XMLElement getFirstChildElement() {
+    	
+    	if(fSource != null) {
+    		return doGetFirstChildElement();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract XMLElement doGetFirstChildElement();
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getNextSiblingElement()
+     */
+    public final XMLElement getNextSiblingElement() {
+    	
+    	if(fSource != null) {
+    		return doGetNextSiblingElement();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract XMLElement doGetNextSiblingElement();
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getChildElements()
+     */
+    public final XMLElement[] getChildElements() {
+        
+        if(fSource != null) {
+            return doGetChildElements();
+        } else {
+            return null;
+        }
+    }
+    
+    protected abstract XMLElement[] doGetChildElements();
+    
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorHandlerImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorHandlerImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorHandlerImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorHandlerImpl.java Tue Sep  1 05:49:02 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.internal;
+
+import org.apache.woden.ErrorHandler;
+import org.apache.woden.ErrorInfo;
+
+/**
+ * This class implements the default error handling behaviour, which is simply
+ * to report warnings, errors and fatal errors by printing the error info to 
+ * the system output stream.
+ * 
+ * Implementations may replace this behaviour by providing their own implementation
+ * of the ErrorHandler interface.
+ *   
+ * @author jkaputin@apache.org
+ */
+public class ErrorHandlerImpl implements ErrorHandler {
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorHandler#warning(org.apache.woden.ErrorInfo)
+     */
+    public void warning(ErrorInfo errorInfo) {
+        
+        System.out.println("Woden[Warning]," + errorInfo.toString());
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorHandler#error(org.apache.woden.ErrorInfo)
+     */
+    public void error(ErrorInfo errorInfo) {
+
+        System.out.println("Woden[Error]," + errorInfo.toString());
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorHandler#fatalError(org.apache.woden.ErrorInfo)
+     */
+    public void fatalError(ErrorInfo errorInfo) {
+
+        System.out.println("Woden[Fatal Error]," + errorInfo.toString());
+
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorInfoImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorInfoImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorInfoImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorInfoImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,91 @@
+/**
+ * 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.ErrorInfo;
+import org.apache.woden.ErrorLocator;
+
+/**
+ * This class is a data object containing the information needed
+ * for reporting warnings, errors and fatal errors. It overrides
+ * the toString() method to concatenate this information into
+ * a single string for reporting purposes.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class ErrorInfoImpl implements ErrorInfo {
+    
+    //TODO decide if a data container object like this is suitable,
+    //rather than an exception like XMLParserException used in Xerces.
+    
+    //TODO decide if properties captured here are sufficient for reporting needs.
+    
+    private ErrorLocator fErrLoc;
+    private String fKey;
+    private String fMessage;
+    private Exception fException;
+
+    public ErrorInfoImpl(ErrorLocator errorLocator,
+                         String key, 
+                         String message,
+                         Exception exception) 
+    {
+        fErrLoc = errorLocator;
+        fKey = key;
+        fMessage = message;
+        fException = exception;
+    }
+    
+    public ErrorLocator getErrorLocator() {
+        return fErrLoc;
+    }
+
+    public String getKey() {
+        return fKey;
+    }
+
+    public String getMessage() {
+        return fMessage;
+    }
+    
+    public Exception getException() {
+        return fException;
+    }
+    
+    public String toString() {
+        
+        StringBuffer sb = new StringBuffer();
+        
+        if(fErrLoc != null)
+        {
+            sb.append(fErrLoc.getLineNumber() + ":" + 
+                      fErrLoc.getColumnNumber() + ",");
+        }
+        
+        sb.append(fKey + ",");
+        sb.append(fMessage);
+        
+        if(fException != null) {
+            sb.append("," + fException.getClass().getName() + ":" +
+                      fException.getMessage());
+        }
+        
+        return sb.toString();
+        
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorLocatorImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorLocatorImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorLocatorImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorLocatorImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,97 @@
+/**
+ * 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.ErrorLocator;
+
+/**
+ * Represents the location of parsing error within a XML document.
+ *
+ * @author kaputin
+ */
+public class ErrorLocatorImpl implements ErrorLocator {
+    
+    private int fLineNumber;
+    private int fColumnNumber;
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorLocator#getDocumentBaseURI()
+     */
+    public String getDocumentBaseURI() {
+        // TODO required?
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorLocator#getLocationURI()
+     */
+    public String getLocationURI() {
+        // TODO required?
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorLocator#getLineNumber()
+     */
+    public int getLineNumber() {
+        return fLineNumber;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorLocator#getColumnNumber()
+     */
+    public int getColumnNumber() {
+        return fColumnNumber;
+    }
+
+    /**
+     * Set the base URI of this locator.
+     * 
+     * @param uri The URI of the base location to set.
+     */
+    public void setDocumentBaseURI(String uri) {
+        // TODO required?
+    }
+
+    /**
+     * Set the location URI of this locator.
+     * 
+     * @param uri The URI of the location to set.
+     */
+    public void setLocationURI(String uri) {
+        // TODO required?
+    }
+
+    /**
+     * Set the line number of this locator.
+     * 
+     * @param line The line number to set.
+     */
+    public void setLineNumber(int line) {
+        fLineNumber = line;
+    }
+
+    /**
+     * Set the column number of this locator.
+     * 
+     * @param col The column number to set.
+     */
+    public void setColumnNumber(int col) {
+        fColumnNumber = col;
+    }
+    
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorReporterImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorReporterImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorReporterImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ErrorReporterImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,315 @@
+/**
+ * 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 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.util.PropertyUtils;
+import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+
+
+/**
+ * This class reports errors that occur while parsing, validating or
+ * manipulating WSDL descriptions, such as XML parser errors or violations
+ * of the rules defined in the WSDL specification. That is, errors that
+ * relate specifically to the WSDL. It does not report system runtime 
+ * or configuration errors, which are instead treated as exceptions.
+ * <p>
+ * There are four ways to report an error:
+ * <p>
+ * An error id and an array of message arguments are used to produce 
+ * a formatted error message from some parameterized message text.
+ * The error may be reported with an target exception or without one.
+ * <p>
+ * An error id is specified with some ready-formatted message text.
+ * The error may be reported with an target exception or without one.
+ * <p>
+ * The error is handled according to the severity level 
+ * (warning, error or fatal error) reported with the error.
+ * <p/>
+ * The error reporter supports the 'en' (English) locale by default 
+ * and has a default error handler (i.e. a default implementation of 
+ * ErrorHandler). However, a different locale may be configured 
+ * via <code>setLocale</code> and a custom error handler implementation 
+ * may be configured as a system property.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public class ErrorReporterImpl implements ErrorReporter {
+    
+    //TODO: add further behaviour as requirements emerge - e.g.
+    //using a xml locator object to report line/col numbers.
+
+    //the ISO-639 language code for the required locale
+    protected static final String LOCALE_LANGUAGE = 
+        "org.apache.woden.locale-language";
+
+    //the class name of a custom error handler
+    protected static final String ERROR_HANDLER_NAME = 
+        "org.apache.woden.error-handler-name";
+
+    //"true" or "false" to continue parsing after a fatal error
+    protected static final String CONTINUE_AFTER_FATAL_ERROR = 
+        "org.apache.woden.continue-after-fatal-error";
+
+    /*
+     * This property specifies the resource bundle containing the core Woden error messages.
+     * 
+     * TODO extract these errors to a new public (non-internal) bundle.
+     * TODO define a public constants file with this type of info.
+     */
+      static final private String CORE_RESOURCE_BUNDLE = "org.apache.woden.internal.Messages";
+      
+    //Used for localization of error messages.
+    private Locale fLocale;
+    
+    //Combines parameterized message text with message parameters 
+    private MessageFormatter fMessageFormatter;
+    
+    //Used only if no custom error handler has been specified
+    private ErrorHandler fDefaultErrorHandler;
+    
+    //Custom error handler to use instead of the default error handler
+    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
+     * implementations for <code>fMessageFormatter</code> and 
+     * <code>fDefaultErrorHandler</code>. It checks for optional properties that
+     * specify the settings for the remaining variables.
+     * For <code>fLocale</code>, property org.apache.woden.locale can be used to
+     * specify the ISO-639 language code for the required locale. If it is omitted 
+     * it will default to "en" for English. There is also a setter method which will
+     * override any value set by this constructor.
+     * For <code>fErrorHandler</code>, property org.apache.woden.error-handler-name
+     * can be used to specify the class name of the custom error handler or if
+     * omitted, it is set to null.  There is also a setter method which will
+     * override any value set by this constructor.
+     * <p/> 
+     * Their are several alternatives for specifying these properties, so the property lookup 
+     * mechanism is encapsulated in a separate <code>PropertyUtils</code> class.
+     * <p/>
+     * TODO fContinueAfterFatalError and related code has been commented out for 
+     * the time being. If we cannot identify a use case for it, it will be removed.
+     * <p/>
+     * For <code>fContinueAfterFatalError</code>, 
+     * org.apache.woden.continue-after-fatal-error can be used to specify 
+     * "true" or "false". If this property is omitted or contains any other value,
+     * default to "true".
+
+     * @throws WSDLException wraps exceptions that may occur while creating 
+     * objects from Class names specified as properties (e.g. 
+     * ClassNotFoundException, InstantiationException and IllegalAccessException).
+     * 
+     */
+    public ErrorReporterImpl() throws WSDLException
+    {
+        fMessageFormatter = new MessageFormatter();
+        fDefaultErrorHandler = new ErrorHandlerImpl();
+        
+        //Set the locale using the language code property if specified.
+        String localeLanguage = PropertyUtils.findProperty(LOCALE_LANGUAGE);
+
+        if (localeLanguage != null) {
+            fLocale = new Locale(localeLanguage);;
+        }
+        
+        //TODO handle an unsupported locale lang code 
+        //(e.g. use system locale and log a warning message)
+        
+        //Set the custom error handler from the error handler property if specified.
+        String errorHandlerName = PropertyUtils.findProperty(ERROR_HANDLER_NAME);
+        
+        if (errorHandlerName != null)
+        {
+            try
+            {
+                Class cl = Class.forName(errorHandlerName);
+                fErrorHandler = (ErrorHandler)cl.newInstance();
+            }
+            catch (Exception e)
+            {
+                /*
+                 ClassNotFoundException
+                 InstantiationException
+                 IllegalAccessException
+                 */
+                throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                        "Problem instantiating the customer error handler.",
+                        e);
+            }
+        } 
+        else 
+        {
+            fErrorHandler = null;
+        }
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.Object[], short)
+     */
+    public void reportError(ErrorLocator errLoc, 
+                            String errorId, 
+                            Object[] arguments, 
+                            short severity)
+    throws WSDLException
+    {
+        reportError(errLoc, errorId, arguments, severity, null);
+    }
+        
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.Object[], short, java.lang.Exception)
+     */
+    public void reportError(ErrorLocator errLoc, 
+                            String errorId, 
+                            Object[] arguments, 
+                            short severity,
+                            Exception exception)
+    throws WSDLException
+    {
+        String[] names = getResourceBundleNames();
+        String message = fMessageFormatter.formatMessage(fLocale, errorId, arguments, names);
+        reportError(errLoc, errorId, message, severity, exception);
+    }
+    
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.String, short)
+     */
+    public void reportError(ErrorLocator errLoc, 
+                            String errorId, 
+                            String message, 
+                            short severity)
+    throws WSDLException
+    {
+        reportError(errLoc, errorId, message, severity, null);
+    }
+    
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.String, short, java.lang.Exception)
+     */
+    public void reportError(ErrorLocator errLoc, 
+                            String errorId, 
+                            String message, 
+                            short severity,
+                            Exception exception)
+    throws WSDLException
+    {
+        ErrorInfo errorInfo = 
+            new ErrorInfoImpl(errLoc, errorId, message, exception);
+
+        ErrorHandler eh = 
+            (fErrorHandler != null) ? fErrorHandler : fDefaultErrorHandler;
+        
+        if(severity == SEVERITY_WARNING) {
+            eh.warning(errorInfo);
+        }
+        else if(severity == SEVERITY_ERROR) {
+            eh.error(errorInfo);
+        }
+        else if(severity == SEVERITY_FATAL_ERROR) {
+            eh.fatalError(errorInfo);
+            
+            // Fatal error strategy is to terminate with a WSDLException.
+            
+            if(exception == null) {
+                throw new WSDLException(WSDLException.INVALID_WSDL,
+                        "Fatal WSDL error:\n" + errorInfo.toString());
+            }
+            else if(exception instanceof WSDLException) {
+                throw (WSDLException)exception;
+            }
+            else {
+                throw new WSDLException(WSDLException.OTHER_ERROR,
+                                        "Fatal error.",
+                                        exception);
+            }
+        }
+        else 
+        {
+            //TODO externalize these messages for localization
+            throw new IllegalArgumentException("Invalid severity: " + severity);
+        }
+    }
+    
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#setErrorHandler(org.apache.woden.ErrorHandler)
+     */
+    public void setErrorHandler(ErrorHandler errorHandler) {
+        fErrorHandler = errorHandler;
+    }
+    
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#getErrorHandler()
+     */
+    public ErrorHandler getErrorHandler() {
+        return (fErrorHandler != null) ? fErrorHandler : fDefaultErrorHandler;
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#setLocale(java.util.Locale)
+     */
+    public void setLocale(Locale locale) {
+        fLocale = locale;
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#getLocale()
+     */
+    public Locale getLocale() {
+        return fLocale;
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#getFormattedMessage(java.lang.String, java.lang.Object[])
+     */
+    public String getFormattedMessage(String key, Object[] arguments)
+    {
+        String[] names = getResourceBundleNames();
+        String message = fMessageFormatter.formatMessage(fLocale, key, arguments, names);
+        return message;
+    }
+    
+    //Package private as this is only 
+    void setExtensionRegistry(ExtensionRegistry extensionRegistry) {
+        fExtensionRegistry = extensionRegistry;
+    }
+    
+    private String[] getResourceBundleNames() {
+        if(fExtensionRegistry != null) {
+            return fExtensionRegistry.queryResourceBundleNames();
+        } else {
+            return new String[] {CORE_RESOURCE_BUNDLE};
+        }
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/MessageFormatter.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/MessageFormatter.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/MessageFormatter.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/MessageFormatter.java Tue Sep  1 05:49:02 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.internal;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * This class is used for formatting error messages. Unformatted error messages
+ * are stored in a resource bundle. Formatting involves replacing any parameters
+ * in the unformatted message text with values supplied at invocation. The error
+ * messages may be translated into a localized resource bundle, so a locale may be
+ * specified to determine the localization required.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class MessageFormatter {
+    
+    private static final Object [] emptyMsgArray = new Object[] {};
+
+    /**
+     * The specified key is used to retrieve an unformatted message from a  
+     * resource bundle localized for the specified locale. This text is then
+     * formatted with the specified message args.
+     *
+     * @param locale the required locale
+     * @param key the message key
+     * @param args message parameter values
+     * @return the formatted message text
+     * 
+     * @throws NullPointerException if key is null 
+     * @throws MissingResourceException if a resource bundle or the specified key cannot be found 
+     * @throws ClassCastException if the object found for the specified key is not a string
+     * @throws IllegalArgumentException if the args don't match the message.
+     */
+    public String formatMessage(Locale locale, String key, Object[] args, String[] bundleNames) {
+        
+        ResourceBundle bundle = null;
+        MissingResourceException mre = null;
+        
+        for(int i=0; i<bundleNames.length; i++) {
+            String bundleName = bundleNames[i];
+            try {
+                if (locale == null) {
+                    bundle = ResourceBundle.getBundle(bundleName);
+                } else {
+                    bundle = ResourceBundle.getBundle(bundleName, locale);
+                }
+                String unformattedMsg = bundle.getString(key);
+                String formattedMsg = MessageFormat.format(unformattedMsg, args != null ? args : emptyMsgArray);
+                return formattedMsg;
+            } catch (MissingResourceException e) {
+                if(i == (bundleNames.length -1)) {
+                    mre = e;  //key not found in any bundles
+                } else {
+                    continue; //try the next bundle
+                }
+            }
+        }
+        throw mre;
+        
+        
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ReaderFeatures.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ReaderFeatures.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ReaderFeatures.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/ReaderFeatures.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,84 @@
+/**
+ * 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 java.util.Hashtable;
+
+import org.apache.woden.WSDLReader;
+
+/**
+ * This class contains all supported Woden reader features and stores
+ * their values for individual parser configurations.
+ * 
+ * TODO: determine the required features (e.g. org.apache.woden.verbose) and
+ * create an ID for each value.
+ */
+public class ReaderFeatures 
+{
+	
+	/**
+	 * This hashtable contains the values for the features.
+	 */
+	protected Hashtable values = new Hashtable();
+	
+	private Boolean on = new Boolean(true);
+	private Boolean off = new Boolean(false);
+	
+	public ReaderFeatures()
+	{
+	  values.put(WSDLReader.FEATURE_VALIDATION, off);
+	}
+	
+	/**
+	 * Get the value for the given feature. 
+	 * @param featureId The ID of the feature for which the value is requested.
+	 * @return true if the feature is enabled, false otherwise.
+	 * @throws IllegalArgumentException if the feature is not supported.
+	 */
+	public boolean getValue(String featureId) throws IllegalArgumentException
+	{
+	  Boolean value = (Boolean)values.get(featureId);
+	  if(value == null)
+	  {
+		throw new IllegalArgumentException("The feature " + featureId + " is not supported.");
+	  }
+	  return value.booleanValue();
+	}
+	
+	/**
+	 * Set the value of the given feature
+	 * @param featureId The ID of the feature to set.
+	 * @param value The value to set for the feature.
+	 * @throws IllegalArgumentException if the feature is not supported.
+	 */
+	public void setValue(String featureId, boolean value) throws IllegalArgumentException
+	{
+		// Check if the feature is supported.
+		if(!values.containsKey(featureId))
+		{
+			throw new IllegalArgumentException("The feature " + featureId + " is not supported.");
+		}
+		if(value)
+		{
+			values.put(featureId, on);
+		}
+		else
+		{
+			values.put(featureId, off);
+		}
+	}
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/WSDLContext.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/WSDLContext.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/WSDLContext.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/WSDLContext.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,60 @@
+/**
+ * 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.resolver.URIResolver;
+import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+
+/**
+ * A container of objects shared internally across the Woden implementation.
+ * Intially, within the context of a WSDLFactory, the properties of this object are
+ * passed by the WSDLFactory implementation to the constructor, with a null value
+ * for the <code>uriResolver</code> property (as this is set by the WSDLReader, not the
+ * factory).
+ * <p>
+ * Within the finer grained context of a WSDLReader, the <code>uriResolver</code> property
+ * will reference the resolver used by the reader and if the reader's extension registry 
+ * reference changes, the <code>extensionRegistry</code> property will reflect that new reference.
+ * <p>
+ * TODO if this needs to be made public on the API, either keep it as an immutable data object as-is,
+ * or create an API interface called WSDLContext with getters instead of public variables and create
+ * an implementation class called WSDLContextImpl.<br>
+ * TODO check for use cases that break the WSDLFactory context concept (ie WSDLReader.setFactoryImplName).<br>
+ * 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;
+    final public ExtensionRegistry extensionRegistry;
+    final public URIResolver uriResolver;
+    
+    //package private ctor
+    WSDLContext(WSDLFactory wsdlFactory,
+            ErrorReporter errorReporter,
+            ExtensionRegistry extensionRegistry,
+            URIResolver uriResolver) {
+        this.wsdlFactory = wsdlFactory;
+        this.errorReporter = errorReporter;
+        this.extensionRegistry = extensionRegistry;
+        this.uriResolver = uriResolver;
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/DOMSchemaResolverAdapter.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/DOMSchemaResolverAdapter.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/DOMSchemaResolverAdapter.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/DOMSchemaResolverAdapter.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,93 @@
+/**
+ * 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.resolver;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.schema.SchemaConstants;
+import org.apache.woden.internal.wsdl20.Constants;
+import org.apache.woden.resolver.URIResolver;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Class that adds DOM specific behaviour to the SchemaResolverAdapter class.
+ * 
+ * TODO consider some approach other than inheritance as part of a broader consideration
+ * of resolving imports and fragids.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ *
+ */
+
+public class DOMSchemaResolverAdapter extends SchemaResolverAdapter {
+
+    public DOMSchemaResolverAdapter(URIResolver actualResolver, XMLElement schemaElement) {
+        super(actualResolver, schemaElement);
+    }
+    
+    protected InputStream resolveFragId(String fragId) {
+        Element contextEl = (Element)fContextElement.getSource();
+        Document doc = contextEl.getOwnerDocument();
+        String id = fragId.substring(1);
+        Element schemaEl = doc.getElementById(id);
+        
+        if(schemaEl == null) {
+            //the fragid does not identify any element
+            //TODO suitable error message
+            return null;
+        }
+        
+        String localName = schemaEl.getLocalName();
+        if(!localName.equals(SchemaConstants.ELEM_SCHEMA)) {
+            //the fragid does not point to a schema element
+            //TODO suitable error message
+            return null;
+        }
+        
+        String prefix = schemaEl.getPrefix();
+        if(prefix != null) {
+            //check if we need to add a schema NS declaration
+            String nsUri = schemaEl.getNamespaceURI();
+            String schemaNSDecl = "xmlns:" + prefix;
+            boolean isSchemaNSDeclared = schemaEl.hasAttribute(schemaNSDecl);
+            if(!isSchemaNSDeclared) {
+                schemaEl.setAttribute(schemaNSDecl, nsUri);
+            }
+        }
+        
+        //TODO need to check for other prefixes requiring NS decls to be added to the schema element
+        
+        OutputFormat format = new OutputFormat(doc);
+        ByteArrayOutputStream oStream = new ByteArrayOutputStream();
+        XMLSerializer serializer = new XMLSerializer(oStream, format);
+        try {
+            serializer.serialize(schemaEl);
+        } catch (IOException e) {
+            // TODO this conforms to parent, but needs an error message via ErrorReporter and maybe it should be handled differently?
+            throw new RuntimeException(e);
+        }
+        ByteArrayInputStream iStream = new ByteArrayInputStream(oStream.toByteArray());
+        return iStream;
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/EntityResolverAdapter.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/EntityResolverAdapter.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/EntityResolverAdapter.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/EntityResolverAdapter.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,72 @@
+/**
+ * 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.
+ * 
+ * @author Graham Turrell
+ */
+
+package org.apache.woden.internal.resolver;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class EntityResolverAdapter implements EntityResolver {
+
+	private org.apache.woden.resolver.URIResolver fActualResolver;
+	
+	public EntityResolverAdapter(org.apache.woden.resolver.URIResolver actualResolver) {
+		fActualResolver = actualResolver;
+	}
+	
+	public InputSource resolveEntity(String publicId, String systemId)
+			throws SAXException, IOException {
+		
+		/* build the URI from args
+		 * 
+		 */
+		URI uri = null;
+		try 
+		{
+			// dumb placeholder:
+			uri = new URI(systemId);
+		} 
+		catch (URISyntaxException e) 
+		{
+			throw new RuntimeException(e);
+		}		
+		
+		/* resolve with target resolver
+		 * 
+		 */		
+		URI resolved = null;
+		try 
+		{
+			resolved = fActualResolver.resolveURI(uri);
+		} 
+		catch (Exception e) 
+		{
+			throw new RuntimeException(e);
+		}
+		
+		// dumb placeholder:
+		return (resolved == null)? null : new InputSource(resolved.toString());
+	}
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/OMSchemaResolverAdapter.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/OMSchemaResolverAdapter.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/OMSchemaResolverAdapter.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/OMSchemaResolverAdapter.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,82 @@
+/**
+ * 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.resolver;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.schema.SchemaConstants;
+import org.apache.woden.resolver.URIResolver;
+
+/**
+ * Class that adds OM specific behaviour to the SchemaResolverAdapter class.
+ * 
+ * TODO consider some approach other than inheritance as part of a broader consideration
+ * of resolving imports and fragids.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ *
+ */
+
+public class OMSchemaResolverAdapter extends SchemaResolverAdapter {
+
+    public OMSchemaResolverAdapter(URIResolver actualResolver, XMLElement schemaElement) {
+        super(actualResolver, schemaElement);
+    }
+    
+    protected InputStream resolveFragId(String fragId) {
+        
+        String id = fragId.substring(1);
+        
+        OMElement contextEl = (OMElement)fContextElement.getSource();
+        OMElement typesEl = (OMElement)contextEl.getParent();
+        Iterator inlineSchemas = typesEl.
+            getChildrenWithName(SchemaConstants.Q_ELEM_SCHEMA);
+        OMElement identifiedSchema = null;
+        String schemaId;
+        while(inlineSchemas.hasNext()) {
+            OMElement schema = (OMElement)inlineSchemas.next();
+            schemaId = schema.getAttributeValue(SchemaConstants.Q_ATTR_ID);
+            if(schemaId != null && schemaId.equals(id)) {
+                identifiedSchema = schema;
+                break;
+            }
+        }
+        
+        if(identifiedSchema == null) {
+            //the fragid does not identify any element
+            //TODO suitable error message
+            return null;
+        }
+        
+        String schemaString = null;
+        try {
+            schemaString = identifiedSchema.toStringWithConsume();
+        } catch (XMLStreamException e) {
+            // TODO this conforms to parent, but needs an error message via ErrorReporter and maybe it should be handled differently?
+            throw new RuntimeException(e);
+        }
+        byte[] schemaBytes = schemaString.getBytes();
+        InputStream iStream = new ByteArrayInputStream(schemaBytes);
+        return iStream;
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/SchemaResolverAdapter.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/SchemaResolverAdapter.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/SchemaResolverAdapter.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/SchemaResolverAdapter.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,152 @@
+/**
+ * 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.resolver;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.util.StringUtils;
+import org.xml.sax.InputSource;
+
+/**
+ * Adapter from woden to ws.commons resolver, for use with XMLSchemaCollection
+ * (Effectively chains ws.commons DefaultURIResolver...)
+ * 
+ * @author Graham Turrell
+ *
+ */
+public abstract class SchemaResolverAdapter implements org.apache.ws.commons.schema.resolver.URIResolver {
+	
+	private org.apache.woden.resolver.URIResolver fActualResolver;
+    protected XMLElement fContextElement;
+	
+	public SchemaResolverAdapter(org.apache.woden.resolver.URIResolver actualResolver, 
+            XMLElement contextElement) {
+        
+		fActualResolver = actualResolver;
+        fContextElement = contextElement;
+	}
+	
+	/**
+	 * returns resolved URI if one can be found, otherwise the URI constructed from
+	 * the arguments. Conforms to the interface spec.
+	 */
+	public InputSource resolveEntity(String targetNamespace,
+               String schemaLocation,
+               String baseUri
+               ) {
+		
+		/* build the URI from args
+		 * 
+		 */
+		URI uri = null;
+		try 
+		{
+    	    /* 
+    	    * Its necessary to provide an absolute URI from the 
+    	    * given schemaLocation. If SchemaLocation is relative
+    	    * we first try to resolve the base uri (ie that of the enclosing
+    	    * document), so that all schemaLocation references will be relative
+    	    * to the resolved base uri. This behaviour is consistent 
+    	    * with the EntityResolverAdapter callback used with wsdl2 parsing.
+    	    * This removes the need to list relative URIs in the catalog.
+    	    */
+	    	   
+    	   /*
+    	    * TODO may want to have this behaviour switchable?
+    	    * currently a convenience for Simple URI resolvers, where 
+    	    * root URI's cannot be specified for groups of URLs.
+    	    * It removes the need to specify relative URL from source documents
+    	    * in the catalog. This is at the cost of flexibility, as relative
+    	    * URLs in the source documents must now have the same relative location
+    	    * to the resolved source document.
+    	    *
+    	    * OASIS XML Catalog resolvers do allow a flexible use of root URI's 
+    	    * and here it may be better to *not* resolve the base URI here.
+    	    * If so, EntityResolverAdapter should be changed to similar behaviour.
+    	    */
+    	   
+			
+			URI resolvedBaseUri = fActualResolver.resolveURI(new URI(baseUri));
+			uri = buildUri(targetNamespace, schemaLocation, resolvedBaseUri == null ? baseUri : resolvedBaseUri.toString()); 
+		} 
+		catch (Exception e) 
+		{
+			/* IOException
+			 * WSDLException
+			 * URISyntaxException
+			 * MalformedURLException
+			 */
+			throw new RuntimeException(e);
+		}
+
+		/* resolve with target resolver
+		 * 
+		 */		
+		URI resolved = null;
+		try 
+		{
+			resolved = fActualResolver.resolveURI(uri);
+		} 
+		catch (Exception e) 
+		{
+			throw new RuntimeException(e);
+		}
+        
+        InputSource iSource = new InputSource(resolved != null ? resolved.toString() : uri.toString());
+        
+        //Check if the uri ends in a fragid, if so include the schema element it 
+        //identifies in the input source.
+        String systemId = iSource.getSystemId();
+        String fragId = null;
+        int i = systemId.indexOf("#");
+        if(i > -1) {
+            fragId = systemId.substring(i);
+            iSource.setByteStream(resolveFragId(fragId));
+        }
+		
+		return iSource;
+	}
+
+    /*
+     * Helper method to resolve fragid to a schema element, represented as a byte stream.
+     * This will be XML parser-specific, so implementations should override this method.
+     */
+    protected abstract InputStream resolveFragId(String fradId);
+    
+	/* based on ws commons DefaultURIResolver.resolveEntity(...)
+	 * 
+	 */
+	private URI buildUri(String targetNamespace,
+               String schemaLocation,
+               String baseUri) throws URISyntaxException, MalformedURLException {
+		
+       if (baseUri != null) 
+        {
+           URL ctxUrl = new URL(baseUri);
+           URL schemaUrl = StringUtils.getURL(ctxUrl,schemaLocation);
+           URI uri = new URI(schemaUrl.toString());
+           return uri;
+        }
+        return new URI(schemaLocation);
+		
+	}
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/SimpleURIResolver.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/SimpleURIResolver.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/SimpleURIResolver.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/resolver/SimpleURIResolver.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,329 @@
+/**
+ * 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.
+ * 
+ * @author Graham Turrell
+ */
+package org.apache.woden.internal.resolver;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.internal.util.PropertyUtils;
+import org.apache.woden.resolver.URIResolver;
+
+/*
+ * A Simple URI Resolver.
+ * 
+ * Locating the catalog file:
+ * These alternatives, listed in search order, will be:
+ * 1. JVM system properties (e.g. java -D arguments)
+ * 		use -Dorg.apache.woden.resolver.simpleresolver.catalog="<filespec>" on the command line
+ * 		where <filespec> is the location of the simple resolver catalog on the local file system.
+ * 2. application properties defined in /META-INF/services (e.g. in a jar file)
+ *      (when implemented in PropertyUtils.findProperty(String p)...)
+ * 3. properties defined in a wsdl properties file located in JAVAHOME/lib directory
+ * 		For (2) and (3) use regular property assignment notation:
+ *      org.apache.woden.resolver.simpleresolver.catalog="<filespec>"
+ *      
+ *  Catalog file format:
+ *  This is as for Java Properties file format, with one entry for each resolution mapping:
+ *  <listed document URI>=<physical location URI>.
+ *  
+ *  Example catalog file contents (fictitious):
+ *  
+ *  	# {referenced URI}={actual location}
+ *  	#
+ *  	http\://www.apache.org/schema/remoteSchema.xsd=file:///c:/schema/localSchema.xsd
+ *  	http\://www.apache.org/schema/myDoc=file:///c:/schema/XMLSchema.xsd
+ *  	http\://www.w3.org/ns/wsdl-extensions.xsd=file:///c:/schema/wsdl-extensions.xsd
+ *  	# end
+ *  
+ *  Note the use of backslash on the first colon of each line. This is necessary as catalog files are 
+ *  read as Java Properties files.
+ *  
+ *  Currently, any relative URI references to other documents (such as with the WSDL 2.0 "location" 
+ *  attribute of the <wsdl:import> and <wsdl:include> elements) will be automatically resolved 
+ *  by virtue of the parent document.
+ *  That is, if document a.wsdl references b.wsdl with a relative path and a.wsdl has an entry in the catalog 
+ *  file, then the reference to b.wsdl will be deemed relative to the resolved location of a.wsdl (not the
+ *  original location). This is under review and it is expected that future milestone releases will offer the
+ *  choice of either option.
+ *   
+ */
+
+public class SimpleURIResolver implements URIResolver {
+		
+	private static final String RESOLVER_PROPERTIES_PROPERTY = "org.apache.woden.resolver.simpleresolver.catalog";
+	private static final String RESOLVER_BASE_PROPERTY = "org.apache.woden.resolver.simpleresolver.baseURIs";
+
+	private final String userCatalogFile = PropertyUtils.findProperty(RESOLVER_PROPERTIES_PROPERTY);
+	private final String rootURLsList = PropertyUtils.findProperty(RESOLVER_BASE_PROPERTY);
+
+	private final String schemaCatalogFile = "schema.catalog";
+	private final String schemaCatalogLocation = "META-INF/"; // eg. under woden.jar root
+	private Hashtable uriTable = null;
+	
+	// logging
+	private static final String RESOLVER_LOGGING_PROPERTY = "org.apache.woden.resolver.logging";
+	private static final String LOGGING_ON = "on";
+	private final String loggingRequest = PropertyUtils.findProperty(RESOLVER_LOGGING_PROPERTY);	
+	private boolean logging;
+	
+	public SimpleURIResolver() throws WSDLException {
+		
+		Properties schemaCatalog = null;
+		/* Unlike the user catalog case, the schema catalog does not refer to RESOLVER_PROPERTIES_PROPERTY
+		 * for its catalog location (it's hard coded) or to RESOLVER_BASE_PROPERTY (it uses only the unmodified
+		 * system classloader to yield absolute URLs from any relative "resolve-to" URLs in the catalog).
+		 * The principle is that the schema catalog behaviour should be unaffected by the use of the public user catalog.
+		 */
+		
+		Properties userCatalog = null;		
+		
+		// check if resolver logging required
+		logging = (LOGGING_ON.equalsIgnoreCase(loggingRequest));
+		
+		// find location of schema catalog on the classpath. 
+		// This catalog has a hardcoded name and relative location.
+		ClassLoader systemLoader = this.getClass().getClassLoader();
+		URL schemaCatalogURL = systemLoader.getResource(schemaCatalogLocation + schemaCatalogFile);	
+		
+		if (schemaCatalogURL == null) {
+			// schema catalog is not in expected location on classpath, so look for an immediate
+			// entry under the classpath.
+			schemaCatalogURL = systemLoader.getResource(schemaCatalogFile);
+		}
+
+		// read & retain the system resolver references 
+		schemaCatalog = loadCatalog(schemaCatalogURL);			
+	
+		if (userCatalogFile != null) { // user catalog file specified, so use it...
+			// read & retain the user resolver references from user catalog properties file
+			try 
+			{
+				userCatalog = loadCatalog(new URL(userCatalogFile));
+			} 
+			catch (MalformedURLException e) 
+			{
+				throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+	                    "Problem locating the URI resolver user catalog: " + userCatalogFile,
+	                    e);
+			}
+		}
+			    
+	    // build a URL[] from a (possibly empty) list of search URL directories/jars
+	    URL[] rootURLs = urlPathList(rootURLsList);
+		URLClassLoader userLoader = new URLClassLoader(rootURLs, systemLoader);
+		
+	    // convert provided keys and values to URIs
+	    try 
+	    {	    	
+	    	// process the schema catalog contents
+	    	Hashtable interrimUriTable = toURI(schemaCatalog, systemLoader);
+	    	// append the processed user catalog to the schema catalog
+	    	uriTable = toURI(userCatalog, userLoader, interrimUriTable);
+	    } 
+	    catch (URISyntaxException e) 
+	    {
+			throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                    "Problem instantiating the URI resolution table.",
+                    e);
+		}
+	}
+
+	/**
+	 * Load properties from specified catalog location
+	 * 
+	 * @param catalogLocation - location of catalog file to load
+	 * @return resulting catalog
+	 */
+	private Properties loadCatalog(URL catalogLocation) {
+		return loadCatalog(catalogLocation, new Properties());
+	}
+	
+	/**
+	 * Load properties from specified catalog location and append to exising catalog.
+	 * 
+	 * @param catalogLocation - location of catalog file to load
+	 * @param catalog - exisiting catalog data to which to append
+	 * @return appended catalog
+	 */
+	private Properties loadCatalog(URL catalogLocation, Properties catalog) {
+	    if (catalogLocation != null) {
+	        try {
+		        catalog.load(catalogLocation.openStream());
+		    } 
+		    catch (IllegalArgumentException e) {
+		    	e.printStackTrace();
+		    	// treat missing properties file as empty file, ie no resolves specified.
+		    	// TODO log this
+		    }
+		    catch (MalformedURLException e) {
+		    	e.printStackTrace();
+		    	// load() failed, continue with no resolves
+		    	// TODO log this
+		    }
+		    catch (IOException e) {
+		    	e.printStackTrace();
+		    	// load() failed, continue with no resolves
+		    	// TODO log this
+		    }
+	    }
+		return catalog;
+	}	
+	/**
+	 * Construct a list of URLs from a semi-colon seperated String list of URLs
+	 * 
+	 * @param rootURLs
+	 * @return List of URLs or empty list
+	 */
+	private URL[] urlPathList(String rootURLs) throws WSDLException {
+		if (rootURLs == null || rootURLs.length() == 0) {
+			return new URL[0]; 
+		}		
+		String[] urlStrings = rootURLs.split(";");
+		ArrayList urls = new ArrayList();
+		
+		for (int i=0; i<urlStrings.length; i++) {
+			try {
+				URL url = new URL(urlStrings[i]);
+				urls.add(url);
+			} catch (MalformedURLException e) {
+				// Bad URLs are discarded noisily
+				// TODO should log a woden warning, ignore entry, and continue thru list instead of following?
+				throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+						"Invalid URL '" + urlStrings[i] + "' in base URL list '" + rootURLs + "'",
+	                    e);
+				// TODO or logging like :
+				//System.out.println("Invalid URL "+urlStrings[i]+": "+e.getMessage());
+			}
+		}		
+		// convert to array of URLs, for later consumption
+		return (URL[])urls.toArray(new URL[0]);
+	}
+
+	public URI resolveURI(URI uri) throws WSDLException {
+		URI resolvedURI = null;
+		if (uriTable.containsKey(uri)) 
+		{ // TODO is this sufficient?
+			resolvedURI = (URI)uriTable.get(uri); 
+			logResolve(uri, resolvedURI);
+		}
+		else
+		{
+			logNoResolve(uri);
+		}
+		return resolvedURI;
+	}
+	
+	private void logNoResolve(URI uri) {
+		if (logging) {
+			System.out.println("resolver:NO:  URI " + uri + " did not resolve");
+		}	
+	}
+
+	private void logResolve(URI uri, URI resolvedURI) {
+		if (logging) {
+			System.out.println("resolver:YES: URI " + uri + " successfully resolved to URI " + resolvedURI);
+		}	
+	}
+
+	/**
+	 * Convert resolver Properties (Hashtable of Strings) to Hashtable of URIs
+	 * 
+	 * @param p - set of properties representing initial catalog
+	 * @param loader - Classloader describing search locations for resolved-to, relative catalog entries
+	 * @return
+	 * @throws URISyntaxException
+	 */
+	private Hashtable toURI(Properties p, ClassLoader loader) throws URISyntaxException {
+		// TODO change to throw a WSDLException
+
+		return toURI(p, loader, new Hashtable());
+	}
+	
+	/**
+	 * Takes a set of properties representing {resolved-from, resolved-to} URI pairs
+	 * and converts to a Hashtable. 
+	 * Any relative resolved-to URIs are "converted ("resolved"!) to absolute location
+	 * using the supplied classloader. Any entries for which such a convesion fails are ignored noisily.
+	 * 
+	 * @param p
+	 * @param loader - class
+	 * @param h
+	 * @return HashTable mapping resolved-from URIs to absolute resolved-to URIs 
+	 * @throws URISyntaxException
+	 */
+	private Hashtable toURI(Properties p, ClassLoader loader, Hashtable h) throws URISyntaxException {
+		// TODO change to throw a WSDLException
+
+		if (p != null)
+		{
+			Enumeration keys = p.keys();
+			while (keys.hasMoreElements()) {
+				String key = (String)keys.nextElement();
+				String value = p.getProperty(key);
+				try 
+				{
+					// if value represents an absolute URL (ie has a scheme) keep as-is
+					// otherwise treat as relative to the URLClassloader search locations.
+					// If the relative resource cannot be located via the class loader, 
+					// ignore the entry noisily.
+					URI valueURI = new URI(value);
+					if (!valueURI.isAbsolute()) 
+					{
+						// Relative URI so use class loader lookup...
+						URL valueURL = loader.getResource(value); 
+						if (valueURL != null) 
+						{
+							// lookup successful
+							valueURI = new URI(valueURL.toString());
+							h.put(new URI(key), valueURI); //TODO - can we replace with java.net.URL's?
+						}
+						else
+						{
+							// Report failed lookup on relative URL on RHS of catalog entry
+							// TODO ignore noisily
+							System.out.println("Lookup failed for URL "+value);
+						}
+					}
+					else
+					{
+						// Absolute URI - preserve as-is
+						h.put(new URI(key), valueURI);
+					}						
+				}
+				catch (URISyntaxException e) {
+					// TODO ignore noisily
+					System.out.println("Invalid URL "+value+": "+e.getMessage());
+				}		
+			}
+		}
+		return h;
+	}
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/ImportedSchemaImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/ImportedSchemaImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/ImportedSchemaImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/ImportedSchemaImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.internal.schema;
+
+import java.net.URI;
+
+import org.apache.woden.schema.ImportedSchema;
+
+/**
+ * This interface represents a schema import, &lt;xs:import&gt;. It extends the abstract
+ * class SchemaImpl, adding support for the <code>schemaLocation</code> attribute.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class ImportedSchemaImpl extends SchemaImpl implements ImportedSchema 
+{
+    private URI fSchemaLocation = null;
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.schema.ImportedSchema#setSchemaLocation(java.net.URI)
+     */
+    public void setSchemaLocation(URI location) {
+        fSchemaLocation = location;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.schema.ImportedSchema#getSchemaLocation()
+     */
+    public URI getSchemaLocation() {
+        return fSchemaLocation;
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/InlinedSchemaImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/InlinedSchemaImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/InlinedSchemaImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/InlinedSchemaImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.internal.schema;
+
+import org.apache.woden.schema.InlinedSchema;
+
+/**
+ * This class represents an inlined schema, &lt;xs:schema&gt;. 
+ * It extends the abstract class SchemaImpl, adding support for the 
+ * <code>id</code> attribute.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class InlinedSchemaImpl extends SchemaImpl implements InlinedSchema 
+{
+    private String fId = null;
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.schema.InlinedSchema#setId(java.lang.String)
+     */
+    public void setId(String id) {
+        fId = id;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.schema.InlinedSchema#getId()
+     */
+    public String getId() {
+        return fId;
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/SchemaConstants.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/SchemaConstants.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/SchemaConstants.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/SchemaConstants.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,103 @@
+/**
+ * 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.schema;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+/**
+ * Constants for XML Schema elements, attributes and URIs.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class SchemaConstants {
+
+    //Schema attribute names
+    public static final String ATTR_ID = "id";
+    public static final String ATTR_TARGET_NAMESPACE = "targetNamespace";
+    public static final String ATTR_NAMESPACE = "namespace";
+    public static final String ATTR_SCHEMA_LOCATION = "schemaLocation";
+    
+    //Schema element names
+    public static final String ELEM_SCHEMA = "schema";
+    public static final String ELEM_IMPORT = "import";
+
+    //Schema namespace string
+    public static final String NS_STRING_SCHEMA =
+        "http://www.w3.org/2001/XMLSchema";
+    
+    //Schema namespace uri
+    public static final URI NS_URI_SCHEMA = URI.create(NS_STRING_SCHEMA);
+    
+    //Schema attribute qnames
+    public static final QName Q_ATTR_ID = new QName(ATTR_ID);
+    
+    //Schema element qnames
+    public static final QName Q_ELEM_SCHEMA =
+        new QName(NS_STRING_SCHEMA, ELEM_SCHEMA);
+    public static final QName Q_ELEM_SCHEMA_IMPORT = 
+        new QName(NS_STRING_SCHEMA, ELEM_IMPORT);
+
+    //Built-in XML Schema types. 19 primitive and 25 derived.
+    public static final List LIST_Q_BUILT_IN_TYPES = Arrays.asList(new QName[]
+        { new QName(NS_STRING_SCHEMA, "string"),
+          new QName(NS_STRING_SCHEMA, "boolean"),
+          new QName(NS_STRING_SCHEMA, "decimal"),
+          new QName(NS_STRING_SCHEMA, "float"),
+          new QName(NS_STRING_SCHEMA, "double"),
+          new QName(NS_STRING_SCHEMA, "duration"),
+          new QName(NS_STRING_SCHEMA, "dateTime"),
+          new QName(NS_STRING_SCHEMA, "time"),
+          new QName(NS_STRING_SCHEMA, "date"),
+          new QName(NS_STRING_SCHEMA, "gYearMonth"),
+          new QName(NS_STRING_SCHEMA, "gYear"),
+          new QName(NS_STRING_SCHEMA, "gMonthDay"),
+          new QName(NS_STRING_SCHEMA, "gDay"),
+          new QName(NS_STRING_SCHEMA, "gMonth"),
+          new QName(NS_STRING_SCHEMA, "hexBinary"),
+          new QName(NS_STRING_SCHEMA, "base64Binary"),
+          new QName(NS_STRING_SCHEMA, "anyURI"),
+          new QName(NS_STRING_SCHEMA, "QName"),
+          new QName(NS_STRING_SCHEMA, "NOTATION"),
+          new QName(NS_STRING_SCHEMA, "normalizedString"),
+          new QName(NS_STRING_SCHEMA, "token"),
+          new QName(NS_STRING_SCHEMA, "language"),
+          new QName(NS_STRING_SCHEMA, "NMTOKEN"),
+          new QName(NS_STRING_SCHEMA, "NMTOKENS"),
+          new QName(NS_STRING_SCHEMA, "Name"),
+          new QName(NS_STRING_SCHEMA, "NCName"),
+          new QName(NS_STRING_SCHEMA, "ID"),
+          new QName(NS_STRING_SCHEMA, "IDREF"),
+          new QName(NS_STRING_SCHEMA, "IDREFS"),
+          new QName(NS_STRING_SCHEMA, "ENTITY"),
+          new QName(NS_STRING_SCHEMA, "ENTITIES"),
+          new QName(NS_STRING_SCHEMA, "integer"),
+          new QName(NS_STRING_SCHEMA, "nonPositiveInteger"),
+          new QName(NS_STRING_SCHEMA, "negativeInteger"),
+          new QName(NS_STRING_SCHEMA, "long"),
+          new QName(NS_STRING_SCHEMA, "int"),
+          new QName(NS_STRING_SCHEMA, "short"),
+          new QName(NS_STRING_SCHEMA, "byte"),
+          new QName(NS_STRING_SCHEMA, "nonNegativeInteger"),
+          new QName(NS_STRING_SCHEMA, "unsignedLong"),
+          new QName(NS_STRING_SCHEMA, "unsignedInt"),
+          new QName(NS_STRING_SCHEMA, "unsignedShort"),
+          new QName(NS_STRING_SCHEMA, "unsignedByte"),
+          new QName(NS_STRING_SCHEMA, "positiveInteger") });
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/SchemaImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/SchemaImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/SchemaImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/schema/SchemaImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,110 @@
+/**
+ * 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.schema;
+
+import java.net.URI;
+
+import org.apache.woden.XMLElement;
+import org.apache.woden.schema.Schema;
+import org.apache.ws.commons.schema.XmlSchema;
+
+/**
+ * Abstract implementation of an XML Schema.
+ * 
+ * @author jkaputin@apache.org
+ */
+public abstract class SchemaImpl implements Schema 
+{
+    private URI fNamespace = null;
+    private XmlSchema fSchemaDefinition = null;
+    private boolean fIsReferenceable = true;
+    private XMLElement fXMLElement;
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.schema.Schema#setNamespace(java.net.URI)
+     */
+    public void setNamespace(URI namespace) 
+    {
+        fNamespace = namespace;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.schema.Schema#getNamespace()
+     */
+    public URI getNamespace() 
+    {
+        return fNamespace;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.schema.Schema#setSchemaDefinition(org.apache.ws.commons.schema.XmlSchema)
+     */
+    public void setSchemaDefinition(XmlSchema schemaDef) {
+        fSchemaDefinition = schemaDef;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.schema.Schema#getSchemaDefinition()
+     */
+    public XmlSchema getSchemaDefinition() {
+        return fSchemaDefinition;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.schema.Schema#getXMLElement()
+     */
+    public XMLElement getXMLElement() {
+        return fXMLElement;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.schema.Schema#setXMLElement(org.apache.woden.XMLElement)
+     */
+    public void setXMLElement(XMLElement xsdElement) {
+        fXMLElement = xsdElement;
+    }
+
+    /* ************************************************************
+     *  Non-API implementation methods
+     * ************************************************************/
+    
+    /* 
+     * Indicates whether the schema is referenceable by the containing WSDL, as
+     * defined by the WSDL 2.0 spec. In brief, a schema is referenceable if it is 
+     * inlined directly under &lt;types&gt; and has a target namespace or if it is
+     * resolved from a schema import directly under &lt;types&gt; and the import 
+     * namespace matches the schema's target namespace.
+     * So for example, when the API is used to retrieve the schema element 
+     * declaration identified by a QName attribute, the implementation checks this
+     * referenceable property to determine which schemas can be used to resolve the 
+     * qname. 
+     * Referenceability is determined during validation. If the validation feature
+     * is disabled, any inlined or imported schema will be considered referenceable.
+     */
+    public void setReferenceable(boolean referenceable) {
+        fIsReferenceable = referenceable;
+    }
+
+    public boolean isReferenceable() {
+        return fIsReferenceable;
+    }
+    
+    public String getNamespaceAsString()
+    {
+        return fNamespace != null ? fNamespace.toString() : null;
+    }
+}



---------------------------------------------------------------------
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