dims 2002/10/29 07:52:17
Modified: java/src/org/apache/axis Constants.java
java/src/org/apache/axis/encoding
DefaultTypeMappingImpl.java
java/test/types PackageTests.java
java/src/org/apache/axis/i18n resource.properties
Added: java/src/org/apache/axis/types Id.java Language.java
java/test/types TestId.java
Log:
Patch for Bug 13922 - WSDL2Java still doesn't understand some schema types
from [EMAIL PROTECTED] (Eddie PICK)
Revision Changes Path
1.94 +3 -1 xml-axis/java/src/org/apache/axis/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- Constants.java 16 Oct 2002 16:36:41 -0000 1.93
+++ Constants.java 29 Oct 2002 15:52:16 -0000 1.94
@@ -496,7 +496,9 @@
public static final QName XSD_NCNAME = new QName(URI_2001_SCHEMA_XSD, "NCName");
public static final QName XSD_NMTOKEN = new QName(URI_2001_SCHEMA_XSD,
"NMTOKEN");
public static final QName XSD_ANYURI = new QName(URI_2001_SCHEMA_XSD, "anyURI");
-
+ public static final QName XSD_LANGUAGE = new QName(URI_2001_SCHEMA_XSD,
"language");
+ public static final QName XSD_ID = new QName(URI_2001_SCHEMA_XSD, "ID");
+
public static final QName SOAP_BASE64 = new QName(URI_DEFAULT_SOAP_ENC,
"base64");
public static final QName SOAP_BASE64BINARY = new QName(URI_DEFAULT_SOAP_ENC,
"base64Binary");
public static final QName SOAP_STRING = new QName(URI_DEFAULT_SOAP_ENC,
"string");
1.61 +16 -0
xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
Index: DefaultTypeMappingImpl.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- DefaultTypeMappingImpl.java 18 Oct 2002 20:54:28 -0000 1.60
+++ DefaultTypeMappingImpl.java 29 Oct 2002 15:52:16 -0000 1.61
@@ -468,6 +468,22 @@
Constants.XSD_NCNAME)
);
+ // a xsd:ID
+ myRegister(Constants.XSD_ID, org.apache.axis.types.Id.class,
+ new SimpleSerializerFactory(org.apache.axis.types.Id.class,
+ Constants.XSD_ID),
+ new SimpleDeserializerFactory(org.apache.axis.types.Id.class,
+ Constants.XSD_ID)
+ );
+
+ // a xsd:language
+ myRegister(Constants.XSD_LANGUAGE, org.apache.axis.types.Language.class,
+ new SimpleSerializerFactory(org.apache.axis.types.Language.class,
+ Constants.XSD_LANGUAGE),
+ new
SimpleDeserializerFactory(org.apache.axis.types.Language.class,
+ Constants.XSD_LANGUAGE)
+ );
+
// a xsd:NmToken
myRegister(Constants.XSD_NMTOKEN, org.apache.axis.types.NMToken.class,
new SimpleSerializerFactory(org.apache.axis.types.NMToken.class,
1.1 xml-axis/java/src/org/apache/axis/types/Id.java
Index: Id.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.types;
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Messages;
/**
* Custom class for supporting XSD data type ID
* The base type of Id is NCName.
*
* @author Eddie Pick <[EMAIL PROTECTED]>
* @see <a href="http://www.w3.org/TR/xmlschema-2/#ID">XML Schema 3.3.8</a>
*/
public class Id extends NCName {
public Id() {
super();
}
/**
* ctor for Id
* @exception IllegalArgumentException will be thrown if validation fails
*/
public Id(String stValue) throws IllegalArgumentException {
try {
setValue(stValue);
}
catch (IllegalArgumentException e) {
// recast normalizedString exception as token exception
throw new IllegalArgumentException(
Messages.getMessage("badIdType00") + "data=[" +
stValue + "]");
}
}
/**
*
* validate the value against the xsd definition
*
* Same validation as NCName for the time being
*/
public boolean isValid(String stValue) {
return super.isValid(stValue);
}
}
1.1 xml-axis/java/src/org/apache/axis/types/Language.java
Index: Language.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.types;
import java.util.ArrayList;
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Messages;
import org.apache.axis.utils.XMLChar;
/**
* Custom class for supporting XSD data type language
* language represents natural language identifiers as defined by [RFC 1766].
* The value space of language is the set of all strings that are valid language
identifiers
* as defined in the language identification section of [XML 1.0 (Second Edition)].
* The lexical space of language is the set of all strings that are valid language
identifiers
* as defined in the language identification section of [XML 1.0 (Second Edition)].
* The base type of language is token.
*
* @author Eddie Pick <[EMAIL PROTECTED]>
* @see <a href="http://www.w3.org/TR/xmlschema-2/#language">XML Schema 3.3.3</a>
*/
public class Language extends Token {
public Language() {
super();
}
/**
* ctor for Language
* @exception IllegalArgumentException will be thrown if validation fails
*/
public Language(String stValue) throws IllegalArgumentException {
try {
setValue(stValue);
}
catch (IllegalArgumentException e) {
// recast normalizedString exception as token exception
throw new IllegalArgumentException(
Messages.getMessage("badLanguage00") + "data=[" +
stValue + "]");
}
}
/**
*
* validate the value against the xsd definition
* TODO
* @see <a href="http://www.ietf.org/rfc/rfc1766.txt">RFC1766</a>
* Language-Tag = Primary-tag *( "-" Subtag )
* Primary-tag = 1*8ALPHA
* Subtag = 1*8ALPHA
*/
public boolean isValid(String stValue) {
return true;
}
}
1.4 +1 -0 xml-axis/java/test/types/PackageTests.java
Index: PackageTests.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/types/PackageTests.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PackageTests.java 15 Sep 2002 19:16:17 -0000 1.3
+++ PackageTests.java 29 Oct 2002 15:52:17 -0000 1.4
@@ -89,6 +89,7 @@
suite.addTestSuite(TestMonthDay.class);
suite.addTestSuite(TestDay.class);
suite.addTestSuite(TestName.class);
+ suite.addTestSuite(TestId.class);
suite.addTestSuite(TestNCName.class);
suite.addTestSuite(TestNMToken.class);
suite.addTestSuite(TestDuration.class);
1.1 xml-axis/java/test/types/TestId.java
Index: TestId.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package test.types;
import junit.framework.TestCase;
import org.apache.axis.types.Id;
/**
* Test validation of types.Id
*/
public class TestId extends TestCase {
// This needs to be extended to test ID specific things
public TestId(String name) {
super(name);
}
/**
* Run a failure test. value should be invalid.
*/
private void runFailTest(String value) throws Exception {
Id oToken = null;
try {
oToken = new Id(value);
}
catch (Exception e) { // catch the validation exception
}
assertNull(
"Id validation restriction failed. did not restrict bad value [" +
value + "] did not restrict bad value", oToken);
}
/**
* Run a successful test. value should be valid.
*/
private void runPassTest(String value) throws Exception {
Id oToken = null;
try {
oToken = new Id(value);
}
catch (Exception e) { // catch the validation exception
}
assertEquals("Id strings not equal. orig value:" + value, oToken.toString(),
value);
}
/**
* Test a simple string.
*/
public void testSimpleString() throws Exception {
runPassTest("Atlanta");
}
/**
* Test a simple string with allowed punctuation.
*/
public void testPunctuationString() throws Exception {
runPassTest("Atlanta_Braves.Home-Team10");
}
/**
* Test a start character '_'
*/
public void testStartUnderscore() throws Exception {
runPassTest("_Braves");
}
/**
* Test a simple string with allowed punctuation.
*/
public void testMidColon() throws Exception {
runFailTest("Atlanta:_Braves.Home-Team10");
}
/**
* Test a start Digit
*/
public void testStartDigit() throws Exception {
runFailTest("1_Braves");
}
/**
* Test a start character ':'
*/
public void testStartColon() throws Exception {
runFailTest(":_Braves.Home-Team:1");
}
/**
* this is to differentiate from normalized string which cannot accept a \n
*/
public void testLineFeed() throws Exception {
runFailTest("line one\n line two");
}
/**
* this is to differentiate from normalized string which cannot accept a \t
*/
public void testStringWithTabs() throws Exception {
runFailTest("this has \t a tab");
}
/**
* this is to differentiate from normalized string which cannot accept leading
spaces.
*/
public void testStringWithLeadingSpaces() throws Exception {
runFailTest(" a failure case");
}
/**
* this is to differentiate from normalized string which cannot accept trailing
spaces.
*/
public void testStringWithTrailingSpaces() throws Exception {
runFailTest("this is a ");
}
/**
* this is to differentiate from normalized string which cannot accept
* leading and trailing spaces.
*/
public void testStringWithLeadingAndTrailingSpaces() throws Exception {
runFailTest(" centered ");
}
/**
* this is to differentiate from normalized string which cannot accept double
spaces.
*/
public void testDoubleSpace() throws Exception {
runFailTest("a B"); // note: \r fails
}
}
1.23 +4 -1 xml-axis/java/src/org/apache/axis/i18n/resource.properties
Index: resource.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/i18n/resource.properties,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- resource.properties 28 Oct 2002 13:50:40 -0000 1.22
+++ resource.properties 29 Oct 2002 15:52:17 -0000 1.23
@@ -1060,4 +1060,7 @@
unsupportedOperationException01=UnsupportedOperationException01: {0}
uuidGenFactoryCNFE00=The implementation of UUIDGen interface specified cannot be
found in the classpath: {0} not found
-uuidGenFactoryException02= Exception encountered while attempting to instantiate
the specified implementation of UUIDFactory: {0} message={1}
\ No newline at end of file
+uuidGenFactoryException02= Exception encountered while attempting to instantiate
the specified implementation of UUIDFactory: {0} message={1}
+
+badIdType00=Invalid Id
+badLanguage00=Invalid language
\ No newline at end of file