Author: bimargulies
Date: Sat Nov 7 19:09:00 2009
New Revision: 833735
URL: http://svn.apache.org/viewvc?rev=833735&view=rev
Log:
Facets changed to collection.
Modified:
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/FacetsTest.java
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NotationTest.java
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/WSCommons378Test.java
Modified:
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?rev=833735&r1=833734&r2=833735&view=diff
==============================================================================
---
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
(original)
+++
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
Sat Nov 7 19:09:00 2009
@@ -1836,12 +1836,12 @@
if (restrictionEl.hasAttribute("base")) {
NamespaceContext ctx = NodeNamespaceContext
.getNamespaceContext(restrictionEl);
- restriction.baseTypeName = getRefQName(restrictionEl
- .getAttribute("base"), ctx);
+ restriction.setBaseTypeName(getRefQName(restrictionEl
+ .getAttribute("base"), ctx));
} else if (inlineSimpleType != null) {
- restriction.baseType = handleSimpleType(schema, inlineSimpleType,
- schemaEl, false);
+ restriction.setBaseType(handleSimpleType(schema, inlineSimpleType,
+ schemaEl, false));
}
for (Element el = XDOMUtil.getFirstChildElementNS(restrictionEl,
XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil
@@ -1860,7 +1860,7 @@
}
//process extra attributes and elements
processExtensibilityComponents(facet, el);
- restriction.facets.add(facet);
+ restriction.getFacets().add(facet);
}
}
Modified:
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java?rev=833735&r1=833734&r2=833735&view=diff
==============================================================================
---
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
(original)
+++
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
Sat Nov 7 19:09:00 2009
@@ -2059,11 +2059,11 @@
if (schema.getSchemaNamespacePrefix().length() > 0) {
serializedRestriction.setPrefix(schema.getSchemaNamespacePrefix());
}
- if (restrictionObj.baseTypeName != null) {
- String baseType = resolveQName(restrictionObj.baseTypeName,
schema);
+ if (restrictionObj.getBaseTypeName() != null) {
+ String baseType = resolveQName(restrictionObj.getBaseTypeName(),
schema);
serializedRestriction.setAttribute("base", baseType);
- } else if (restrictionObj.baseType instanceof XmlSchemaSimpleType) {
- Element inlineSimpleType = serializeSimpleType(doc,
restrictionObj.baseType, schema);
+ } else if (restrictionObj.getBaseType() instanceof
XmlSchemaSimpleType) {
+ Element inlineSimpleType = serializeSimpleType(doc,
restrictionObj.getBaseType(), schema);
serializedRestriction.appendChild(inlineSimpleType);
} else {
throw new XmlSchemaSerializerException("restriction must be define
"
@@ -2078,10 +2078,10 @@
Element annotation = serializeAnnotation(doc,
restrictionObj.getAnnotation(), schema);
serializedRestriction.appendChild(annotation);
}
- if (restrictionObj.facets.getCount() > 0) {
- int facetsNum = restrictionObj.facets.getCount();
+ if (restrictionObj.getFacets().size() > 0) {
+ int facetsNum = restrictionObj.getFacets().size();
for (int i = 0; i < facetsNum; i++) {
- Element facetEl = serializeFacet(doc,
(XmlSchemaFacet)restrictionObj.facets.getItem(i),
+ Element facetEl = serializeFacet(doc,
(XmlSchemaFacet)restrictionObj.getFacets().get(i),
schema);
serializedRestriction.appendChild(facetEl);
}
Modified:
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java?rev=833735&r1=833734&r2=833735&view=diff
==============================================================================
---
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java
(original)
+++
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java
Sat Nov 7 19:09:00 2009
@@ -19,6 +19,10 @@
package org.apache.ws.commons.schema;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
import javax.xml.namespace.QName;
/**
@@ -27,15 +31,15 @@
*/
public class XmlSchemaSimpleTypeRestriction extends XmlSchemaSimpleTypeContent
{
- XmlSchemaSimpleType baseType;
- QName baseTypeName;
- XmlSchemaObjectCollection facets;
+ private XmlSchemaSimpleType baseType;
+ private QName baseTypeName;
+ private List<XmlSchemaFacet> facets;
/**
* Creates new XmlSchemaSimpleTypeRestriction
*/
public XmlSchemaSimpleTypeRestriction() {
- facets = new XmlSchemaObjectCollection();
+ facets = Collections.synchronizedList(new ArrayList<XmlSchemaFacet>());
}
@@ -55,7 +59,7 @@
this.baseTypeName = baseTypeName;
}
- public XmlSchemaObjectCollection getFacets() {
+ public List<XmlSchemaFacet> getFacets() {
return this.facets;
}
}
Modified:
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/FacetsTest.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/FacetsTest.java?rev=833735&r1=833734&r2=833735&view=diff
==============================================================================
---
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/FacetsTest.java
(original)
+++
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/FacetsTest.java
Sat Nov 7 19:09:00 2009
@@ -22,6 +22,7 @@
import java.io.InputStream;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import javax.xml.namespace.QName;
@@ -30,6 +31,7 @@
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaEnumerationFacet;
+import org.apache.ws.commons.schema.XmlSchemaFacet;
import org.apache.ws.commons.schema.XmlSchemaFractionDigitsFacet;
import org.apache.ws.commons.schema.XmlSchemaLengthFacet;
import org.apache.ws.commons.schema.XmlSchemaMaxExclusiveFacet;
@@ -38,7 +40,6 @@
import org.apache.ws.commons.schema.XmlSchemaMinExclusiveFacet;
import org.apache.ws.commons.schema.XmlSchemaMinInclusiveFacet;
import org.apache.ws.commons.schema.XmlSchemaMinLengthFacet;
-import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
import org.apache.ws.commons.schema.XmlSchemaPatternFacet;
import org.apache.ws.commons.schema.XmlSchemaSimpleType;
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
@@ -82,13 +83,13 @@
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
- XmlSchemaObjectCollection collection = r.getFacets();
- assertEquals(2, collection.getCount());
+ List<XmlSchemaFacet> collection = r.getFacets();
+ assertEquals(2, collection.size());
Set<String> s = new HashSet<String>();
s.add(XmlSchemaLengthFacet.class.getName());
s.add(XmlSchemaPatternFacet.class.getName());
- for (Iterator i = collection.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();)
{
Object o = i.next();
assertTrue(s.remove(o.getClass().getName()));
if (o instanceof XmlSchemaLengthFacet) {
@@ -138,12 +139,12 @@
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
- XmlSchemaObjectCollection collection = r.getFacets();
- assertEquals(1, collection.getCount());
+ List<XmlSchemaFacet> collection = r.getFacets();
+ assertEquals(1, collection.size());
Set<String> s = new HashSet<String>();
s.add(XmlSchemaPatternFacet.class.getName());
- for (Iterator i = collection.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();)
{
Object o = i.next();
assertTrue(s.remove(o.getClass().getName()));
if (o instanceof XmlSchemaPatternFacet) {
@@ -190,12 +191,12 @@
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
- XmlSchemaObjectCollection collection = r.getFacets();
- assertEquals(1, collection.getCount());
+ List<XmlSchemaFacet> collection = r.getFacets();
+ assertEquals(1, collection.size());
Set<String> s = new HashSet<String>();
s.add(XmlSchemaTotalDigitsFacet.class.getName());
- for (Iterator i = collection.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();)
{
Object o = i.next();
assertTrue(s.remove(o.getClass().getName()));
if (o instanceof XmlSchemaTotalDigitsFacet) {
@@ -243,13 +244,13 @@
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
- XmlSchemaObjectCollection collection = r.getFacets();
- assertEquals(2, collection.getCount());
+ List<XmlSchemaFacet> collection = r.getFacets();
+ assertEquals(2, collection.size());
Set<String> s = new HashSet<String>();
s.add(XmlSchemaMaxInclusiveFacet.class.getName());
s.add(XmlSchemaMinInclusiveFacet.class.getName());
- for (Iterator i = collection.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();)
{
Object o = i.next();
assertTrue(s.remove(o.getClass().getName()));
if (o instanceof XmlSchemaMaxInclusiveFacet) {
@@ -299,13 +300,13 @@
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
- XmlSchemaObjectCollection collection = r.getFacets();
- assertEquals(2, collection.getCount());
+ List<XmlSchemaFacet> collection = r.getFacets();
+ assertEquals(2, collection.size());
Set<String> s = new HashSet<String>();
s.add(XmlSchemaMaxExclusiveFacet.class.getName());
s.add(XmlSchemaMinExclusiveFacet.class.getName());
- for (Iterator i = collection.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();)
{
Object o = i.next();
assertTrue(s.remove(o.getClass().getName()));
if (o instanceof XmlSchemaMaxExclusiveFacet) {
@@ -355,12 +356,12 @@
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
- XmlSchemaObjectCollection collection = r.getFacets();
- assertEquals(1, collection.getCount());
+ List<XmlSchemaFacet> collection = r.getFacets();
+ assertEquals(1, collection.size());
Set<String> s = new HashSet<String>();
s.add(XmlSchemaWhiteSpaceFacet.class.getName());
- for (Iterator i = collection.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();)
{
Object o = i.next();
assertTrue(s.remove(o.getClass().getName()));
if (o instanceof XmlSchemaWhiteSpaceFacet) {
@@ -407,13 +408,13 @@
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
- XmlSchemaObjectCollection collection = r.getFacets();
- assertEquals(2, collection.getCount());
+ List<XmlSchemaFacet> collection = r.getFacets();
+ assertEquals(2, collection.size());
Set<String> s = new HashSet<String>();
s.add(XmlSchemaFractionDigitsFacet.class.getName());
s.add(XmlSchemaTotalDigitsFacet.class.getName());
- for (Iterator i = collection.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();)
{
Object o = i.next();
assertTrue(s.remove(o.getClass().getName()));
if (o instanceof XmlSchemaFractionDigitsFacet) {
@@ -464,13 +465,13 @@
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
- XmlSchemaObjectCollection collection = r.getFacets();
- assertEquals(2, collection.getCount());
+ List<XmlSchemaFacet> collection = r.getFacets();
+ assertEquals(2, collection.size());
Set<String> s = new HashSet<String>();
s.add(XmlSchemaMinLengthFacet.class.getName());
s.add(XmlSchemaMaxLengthFacet.class.getName());
- for (Iterator i = collection.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();)
{
Object o = i.next();
assertTrue(s.remove(o.getClass().getName()));
if (o instanceof XmlSchemaMinLengthFacet) {
@@ -522,13 +523,13 @@
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
- XmlSchemaObjectCollection collection = r.getFacets();
- assertEquals(2, collection.getCount());
+ List<XmlSchemaFacet> collection = r.getFacets();
+ assertEquals(2, collection.size());
Set<String> s = new HashSet<String>();
s.add("Field");
s.add("Separator");
- for (Iterator i = collection.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();)
{
XmlSchemaEnumerationFacet xsef =
(XmlSchemaEnumerationFacet)i.next();
String value = (String)xsef.getValue();
assertTrue("Atempted to remove an enumeration with the value of "
+ "\"" + value
Modified:
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NotationTest.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NotationTest.java?rev=833735&r1=833734&r2=833735&view=diff
==============================================================================
---
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NotationTest.java
(original)
+++
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NotationTest.java
Sat Nov 7 19:09:00 2009
@@ -39,8 +39,8 @@
import org.apache.ws.commons.schema.XmlSchemaDocumentation;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaEnumerationFacet;
+import org.apache.ws.commons.schema.XmlSchemaFacet;
import org.apache.ws.commons.schema.XmlSchemaNotation;
-import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
import org.apache.ws.commons.schema.XmlSchemaSimpleType;
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
@@ -174,13 +174,13 @@
XmlSchemaSimpleTypeRestriction xsstc =
(XmlSchemaSimpleTypeRestriction)type.getContent();
assertEquals(new QName("http://www.w3.org/2001/XMLSchema",
"NOTATION"), xsstc.getBaseTypeName());
- XmlSchemaObjectCollection xsoc = xsstc.getFacets();
- assertEquals(2, xsoc.getCount());
+ List<XmlSchemaFacet> xsoc = xsstc.getFacets();
+ assertEquals(2, xsoc.size());
Set<String> s = new HashSet<String>();
s.add("tns:teamLogo");
s.add("tns:teamMascot");
- for (int i = 0; i < xsoc.getCount(); i++) {
- XmlSchemaEnumerationFacet xsef =
(XmlSchemaEnumerationFacet)xsoc.getItem(i);
+ for (int i = 0; i < xsoc.size(); i++) {
+ XmlSchemaEnumerationFacet xsef =
(XmlSchemaEnumerationFacet)xsoc.get(i);
String value = (String)xsef.getValue();
if (!("tns:teamLogo".equals(value) ||
"tns:teamMascot".equals(value))) {
fail("An unexpected value of \"" + value + "\" was found.");
Modified:
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java?rev=833735&r1=833734&r2=833735&view=diff
==============================================================================
---
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java
(original)
+++
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java
Sat Nov 7 19:09:00 2009
@@ -40,11 +40,11 @@
import org.apache.ws.commons.schema.XmlSchemaContentModel;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaExternal;
+import org.apache.ws.commons.schema.XmlSchemaFacet;
import org.apache.ws.commons.schema.XmlSchemaGroup;
import org.apache.ws.commons.schema.XmlSchemaGroupRef;
import org.apache.ws.commons.schema.XmlSchemaMaxInclusiveFacet;
import org.apache.ws.commons.schema.XmlSchemaMinInclusiveFacet;
-import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
import org.apache.ws.commons.schema.XmlSchemaRedefine;
import org.apache.ws.commons.schema.XmlSchemaSequence;
import org.apache.ws.commons.schema.XmlSchemaSequenceMember;
@@ -190,12 +190,12 @@
XmlSchemaSimpleTypeRestriction xsstr =
(XmlSchemaSimpleTypeRestriction)xsst.getContent();
assertEquals(new QName("http://soapinterop.org/types", "drinksize"),
xsstr.getBaseTypeName());
- XmlSchemaObjectCollection facets = xsstr.getFacets();
+ List<XmlSchemaFacet> facets = xsstr.getFacets();
Set<String> s = new HashSet<String>();
s.add(XmlSchemaMinInclusiveFacet.class.getName());
s.add(XmlSchemaMaxInclusiveFacet.class.getName());
- for (Iterator i = facets.getIterator(); i.hasNext();) {
+ for (Iterator<XmlSchemaFacet> i = facets.iterator(); i.hasNext();) {
Object o = i.next();
assertTrue(s.remove(o.getClass().getName()));
if (o instanceof XmlSchemaMinInclusiveFacet) {
Modified:
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/WSCommons378Test.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/WSCommons378Test.java?rev=833735&r1=833734&r2=833735&view=diff
==============================================================================
---
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/WSCommons378Test.java
(original)
+++
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/WSCommons378Test.java
Sat Nov 7 19:09:00 2009
@@ -21,6 +21,7 @@
import java.io.FileInputStream;
import java.io.InputStream;
+import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
@@ -29,7 +30,7 @@
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaEnumerationFacet;
-import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaFacet;
import org.apache.ws.commons.schema.XmlSchemaSimpleType;
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
import org.apache.ws.commons.schema.constants.Constants;
@@ -59,12 +60,12 @@
XmlSchemaSimpleType type =
(XmlSchemaSimpleType)schemaCol.getTypeByQName(new QName("foo"));
XmlSchemaSimpleTypeRestriction restriction =
(XmlSchemaSimpleTypeRestriction)type.getContent();
- XmlSchemaObjectCollection facets = restriction.getFacets();
+ List<XmlSchemaFacet> facets = restriction.getFacets();
- assertEquals(2, facets.getCount());
+ assertEquals(2, facets.size());
- XmlSchemaEnumerationFacet facet1 =
(XmlSchemaEnumerationFacet)facets.getItem(0);
- XmlSchemaEnumerationFacet facet2 =
(XmlSchemaEnumerationFacet)facets.getItem(1);
+ XmlSchemaEnumerationFacet facet1 =
(XmlSchemaEnumerationFacet)facets.get(0);
+ XmlSchemaEnumerationFacet facet2 =
(XmlSchemaEnumerationFacet)facets.get(1);
final Map externalAttributes1 = (Map)facet1.getMetaInfoMap()
.get(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES);