You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by jo...@apache.org on 2005/07/28 21:49:25 UTC
cvs commit: ws-jaxme .classpath
jochen 2005/07/28 12:49:25
Modified: src/js/org/apache/ws/jaxme/js Tag: JAXME-28 JavaSource.java
JavaSourceObject.java JavaQNameImpl.java
AbstractJavaMethod.java
src/jaxme/org/apache/ws/jaxme/generator/sg/impl Tag:
JAXME-28 JAXBTypeSG.java LocalContext.java
GlobalContext.java ParsePrintSG.java
src/js/org/apache/ws/jaxme/js/util Tag: JAXME-28
JavaParser.java
src/jaxme/org/apache/ws/jaxme/junit Tag: JAXME-28
MarshallerTest.java
src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg Tag:
JAXME-28 BeanGeneratingVisitor.java
SequenceHandlerSG.java GroupHandlerSG.java
ParticleVisitorImpl.java
src/js/org/apache/ws/jaxme/js/pattern Tag: JAXME-28
CompiledClassReflector.java Ant.java
ChainGenerator.java
src/js/org/apache/ws/jaxme/js/apps Tag: JAXME-28
XmlRpcClientGenerator.java
src/test/jaxb Tag: JAXME-28 types.xsd
src/jaxme/org/apache/ws/jaxme/generator/types Tag: JAXME-28
ListTypeSGImpl.java
. Tag: JAXME-28 .classpath
Log:
Got rid of JavaQNameImpl.getInstance(String, boolean).
Submitted by: Frederic Ahring, fahring at de.ibm.com
Revision Changes Path
No revision
No revision
1.10.2.3 +6 -6 ws-jaxme/src/js/org/apache/ws/jaxme/js/JavaSource.java
Index: JavaSource.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/JavaSource.java,v
retrieving revision 1.10.2.2
retrieving revision 1.10.2.3
diff -u -r1.10.2.2 -r1.10.2.3
--- JavaSource.java 27 Jul 2005 19:46:11 -0000 1.10.2.2
+++ JavaSource.java 28 Jul 2005 19:49:23 -0000 1.10.2.3
@@ -1010,21 +1010,21 @@
* type and default protection.
*/
public JavaMethod newJavaMethod(String pName, String pType) {
- return newJavaMethod(pName, JavaQNameImpl.getInstance(pType, true), (Protection) null);
+ return newJavaMethod(pName, JavaQNameImpl.getInstance(pType), (Protection) null);
}
/** Creates a new JavaMethod with the given name, return
* type and protection.
*/
public JavaMethod newJavaMethod(String pName, String pType, Protection pProtection) {
- return newJavaMethod(pName, JavaQNameImpl.getInstance(pType, true), pProtection);
+ return newJavaMethod(pName, JavaQNameImpl.getInstance(pType), pProtection);
}
/** Creates a new JavaMethod with the given name, return
* type and protection.
*/
public JavaMethod newJavaMethod(String pName, String pType, String pProtection) {
- return newJavaMethod(pName, JavaQNameImpl.getInstance(pType, true),
+ return newJavaMethod(pName, JavaQNameImpl.getInstance(pType),
Protection.valueOf(pProtection));
}
@@ -1160,14 +1160,14 @@
* protection.
*/
public JavaField newJavaField(String pName, String pType, Protection pProtection) {
- return newJavaField(pName, JavaQNameImpl.getInstance(pType, true), pProtection);
+ return newJavaField(pName, JavaQNameImpl.getInstance(pType), pProtection);
}
/** Creates a new JavaField with the given name, type and
* protection.
*/
public JavaField newJavaField(String pName, String pType, String pProtection) {
- return newJavaField(pName, JavaQNameImpl.getInstance(pType, true),
+ return newJavaField(pName, JavaQNameImpl.getInstance(pType),
Protection.valueOf(pProtection));
}
@@ -1175,7 +1175,7 @@
* default protection.
*/
public JavaField newJavaField(String pName, String pType) {
- return newJavaField(pName, JavaQNameImpl.getInstance(pType, true), (Protection) null);
+ return newJavaField(pName, JavaQNameImpl.getInstance(pType), (Protection) null);
}
/** Creates a new JavaField with the given name, type and
1.4.2.1 +1 -1 ws-jaxme/src/js/org/apache/ws/jaxme/js/JavaSourceObject.java
Index: JavaSourceObject.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/JavaSourceObject.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- JavaSourceObject.java 18 May 2005 22:09:10 -0000 1.4
+++ JavaSourceObject.java 28 Jul 2005 19:49:23 -0000 1.4.2.1
@@ -34,7 +34,7 @@
if (pType == null) {
throw new NullPointerException("Type must not be null");
}
- setType(JavaQNameImpl.getInstance(pType, true));
+ setType(JavaQNameImpl.getInstance(pType));
setProtection(pProtection);
}
1.4.2.1 +12 -23 ws-jaxme/src/js/org/apache/ws/jaxme/js/JavaQNameImpl.java
Index: JavaQNameImpl.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/JavaQNameImpl.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- JavaQNameImpl.java 11 May 2005 10:41:49 -0000 1.4
+++ JavaQNameImpl.java 28 Jul 2005 19:49:23 -0000 1.4.2.1
@@ -259,32 +259,21 @@
return result;
}
- /** <p>Equivalent to <code>getInstance(pClassName, false)</code>.</p>
- */
- public static JavaQName getInstance(String pClassName) {
- return getInstance(null, pClassName);
- }
-
/** <p>Returns an instance with the given class name.</p>
* @param pClassName The class name
- * @param pAssumePackage True, if the class name is assumed to contain a
- * package prefix, in which case the prefix up to the last dot will be
- * the package name and the suffix following the last dot will be the
- * class name. Otherwise the root package is assumed.
*/
- public static JavaQName getInstance(String pClassName, boolean pAssumePackage) {
- if (!pAssumePackage) {
- return getInstance(pClassName);
- } else {
- int offset = pClassName.lastIndexOf('.');
- if (offset == -1) {
- return getInstance(pClassName);
- } else {
- return getInstance(pClassName.substring(0, offset), pClassName.substring(offset+1));
- }
- }
+ public static JavaQName getInstance(String pClassName) {
+ int offset = pClassName.lastIndexOf('.');
+ if (offset == -1) {
+ return getInstance(null, pClassName);
+ } else {
+ return getInstance(pClassName.substring(0, offset), pClassName.substring(offset+1));
+ }
}
+ /** Returns an instance of {@link JavaQName}, which represents
+ * an array. The array elements are instances of <code>pQName</code>.
+ */
public static JavaQName getArray(JavaQName pQName) {
String name = pQName.toString() + "[]";
JavaQName result;
1.4.2.2 +2 -2 ws-jaxme/src/js/org/apache/ws/jaxme/js/AbstractJavaMethod.java
Index: AbstractJavaMethod.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/AbstractJavaMethod.java,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- AbstractJavaMethod.java 19 Jul 2005 19:55:32 -0000 1.4.2.1
+++ AbstractJavaMethod.java 28 Jul 2005 19:49:23 -0000 1.4.2.2
@@ -97,7 +97,7 @@
* @deprecated Use {@link #addThrows(JavaQName)}
*/
public void addThrows(String e) {
- exceptions.add(JavaQNameImpl.getInstance(e, true));
+ exceptions.add(JavaQNameImpl.getInstance(e));
if (e == null) {
throw new NullPointerException("The exception argument must not be null.");
}
@@ -138,7 +138,7 @@
throw new NullPointerException("param argument must not be null");
}
p = p.trim();
- addParam(JavaQNameImpl.getInstance(p, true), v);
+ addParam(JavaQNameImpl.getInstance(p), v);
}
/** <p>Adds a parameter that this method takes.</p>
No revision
No revision
1.16.2.1 +1 -1 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java
Index: JAXBTypeSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -r1.16 -r1.16.2.1
--- JAXBTypeSG.java 7 May 2005 19:42:26 -0000 1.16
+++ JAXBTypeSG.java 28 Jul 2005 19:49:23 -0000 1.16.2.1
@@ -393,7 +393,7 @@
SchemaSG pSchema,
XSType pType)
throws SAXException {
- JavaQName qName = JavaQNameImpl.getInstance(pJavaType.getName(), true);
+ JavaQName qName = JavaQNameImpl.getInstance(pJavaType.getName());
if (BooleanSG.BOOLEAN_TYPE.equals(qName)) {
return new BooleanSG(pFactory, pSchema, pType);
} else if (BooleanSG.BOOLEAN_OBJECT_TYPE.equals(qName)) {
1.4.4.1 +1 -1 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/LocalContext.java
Index: LocalContext.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/LocalContext.java,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -u -r1.4 -r1.4.4.1
--- LocalContext.java 10 Mar 2005 10:14:08 -0000 1.4
+++ LocalContext.java 28 Jul 2005 19:49:23 -0000 1.4.4.1
@@ -65,7 +65,7 @@
setXMLImplementationName(JavaQNameImpl.getInnerInstance(pContext.getXMLImplementationName(),
className + "Impl"));
} else {
- setXMLImplementationName(JavaQNameImpl.getInstance(implementationName, true));
+ setXMLImplementationName(JavaQNameImpl.getInstance(implementationName));
}
setXMLHandlerName(JavaQNameImpl.getInnerInstance(pContext.getXMLHandlerName(), className + "Handler"));
setXMLSerializerName(JavaQNameImpl.getInnerInstance(pContext.getXMLSerializerName(), className + "Driver"));
1.6.4.1 +1 -1 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/GlobalContext.java
Index: GlobalContext.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/GlobalContext.java,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -r1.6 -r1.6.4.1
--- GlobalContext.java 10 Mar 2005 10:14:07 -0000 1.6
+++ GlobalContext.java 28 Jul 2005 19:49:23 -0000 1.6.4.1
@@ -92,7 +92,7 @@
setXMLImplementationName(JavaQNameImpl.getInstance(xmlInterfaceName.getPackageName() + ".impl",
xmlInterfaceName.getClassName() + "Impl"));
} else {
- setXMLImplementationName(JavaQNameImpl.getInstance(implementationName, true));
+ setXMLImplementationName(JavaQNameImpl.getInstance(implementationName));
}
setXMLHandlerName(JavaQNameImpl.getInstance(xmlInterfaceName.getPackageName() + ".impl",
xmlInterfaceName.getClassName() + "Handler"));
1.8.2.1 +3 -3 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ParsePrintSG.java
Index: ParsePrintSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ParsePrintSG.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- ParsePrintSG.java 18 May 2005 22:09:10 -0000 1.8
+++ ParsePrintSG.java 28 Jul 2005 19:49:23 -0000 1.8.2.1
@@ -38,7 +38,7 @@
if (javaType.getName() == null) {
return pController.getRuntimeType();
} else {
- return JavaQNameImpl.getInstance(javaType.getName(), true);
+ return JavaQNameImpl.getInstance(javaType.getName());
}
}
@@ -51,7 +51,7 @@
qName = getType(pController);
method = pMethod;
} else {
- qName = JavaQNameImpl.getInstance(pMethod.substring(0, offset), true);
+ qName = JavaQNameImpl.getInstance(pMethod.substring(0, offset));
method = pMethod.substring(offset+1);
}
pList.add(qName);
@@ -91,7 +91,7 @@
if (parseMethod.startsWith("new")
&& parseMethod.length() > 3
&& Character.isWhitespace(parseMethod.charAt(3))) {
- JavaQName qName = JavaQNameImpl.getInstance(parseMethod.substring(3).trim(), true);
+ JavaQName qName = JavaQNameImpl.getInstance(parseMethod.substring(3).trim());
list.add("new ");
list.add(qName);
} else {
No revision
No revision
1.8.2.1 +3 -8 ws-jaxme/src/js/org/apache/ws/jaxme/js/util/JavaParser.java
Index: JavaParser.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/util/JavaParser.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- JavaParser.java 8 Jul 2005 14:45:07 -0000 1.8
+++ JavaParser.java 28 Jul 2005 19:49:24 -0000 1.8.2.1
@@ -119,7 +119,7 @@
}
private void parseImportStatement(AST pAST) {
- addImportStatement(JavaQNameImpl.getInstance(parseIdentifier(pAST), true));
+ addImportStatement(JavaQNameImpl.getInstance(parseIdentifier(pAST)));
}
private String parseIdentifier(AST pAST) {
@@ -195,12 +195,7 @@
String className = classNameAST.getText();
if (pOuterClass == null) {
String packageName = getPackageName();
- JavaQName qName;
- if (packageName == null) {
- qName = JavaQNameImpl.getInstance(className);
- } else {
- qName = JavaQNameImpl.getInstance(packageName, className);
- }
+ JavaQName qName = JavaQNameImpl.getInstance(packageName, className);
JavaSource js = factory.newJavaSource(qName, JavaSource.DEFAULT_PROTECTION);
generatedClasses.add(js);
return js;
@@ -298,7 +293,7 @@
return qName;
}
}
- return JavaQNameImpl.getInstance(pName, true);
+ return JavaQNameImpl.getInstance(pName);
}
private void parseImplementsOrExtends(JavaSource pSource, AST pAST, int pType) {
No revision
No revision
1.23.2.1 +24 -4 ws-jaxme/src/jaxme/org/apache/ws/jaxme/junit/MarshallerTest.java
Index: MarshallerTest.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/junit/MarshallerTest.java,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -u -r1.23 -r1.23.2.1
--- MarshallerTest.java 30 Jun 2005 08:16:14 -0000 1.23
+++ MarshallerTest.java 28 Jul 2005 19:49:24 -0000 1.23.2.1
@@ -33,7 +33,6 @@
import javax.xml.bind.Marshaller;
import javax.xml.bind.UnmarshalException;
import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.ValidationException;
import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
@@ -51,6 +50,7 @@
import org.apache.ws.jaxme.test.misc.types.AllSimpleTypes;
import org.apache.ws.jaxme.test.misc.types.AllTypesElement;
import org.apache.ws.jaxme.test.misc.types.Author;
+import org.apache.ws.jaxme.test.misc.types.Html;
import org.apache.ws.jaxme.test.misc.types.ObjectFactory;
import org.apache.ws.jaxme.test.misc.types.impl.AllElementImpl;
import org.apache.ws.jaxme.test.misc.types.impl.AllSimpleTypesImpl;
@@ -64,8 +64,6 @@
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
-import sun.security.validator.ValidatorException;
-
/**
* @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
@@ -619,4 +617,26 @@
fail("Unexpected throwable " + t);
}
}
+
+ /** Tests marshalling and unmarshalling of a mixed content element.
+ */
+ public void testMixedContent() throws Exception {
+ final String html =
+ "<ex:html xmlns:ex=\"http://ws.apache.org/jaxme/test/misc/types\">\n" +
+ " xyz<ex:dummy>012</ex:dummy>\n" +
+ " <ex:head><ex:title>foo bar</ex:title></ex:head>\n" +
+ " <ex:body><ex:p/></ex:body>\n" +
+ "</ex:html>";
+ InputSource isource = new InputSource(new StringReader(html));
+ isource.setSystemId("mixedContent.xml");
+ JAXBContext ctx = getJAXBContext(Html.class);
+ Html htmlElem = (Html) ctx.createUnmarshaller().unmarshal(isource);
+ StringWriter sw = new StringWriter();
+ Marshaller m = ctx.createMarshaller();
+ m.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
+ m.marshal(htmlElem, sw);
+ String got = sw.toString();
+ assertEquals(html, got);
+ }
}
No revision
No revision
1.4.2.2 +130 -54 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/BeanGeneratingVisitor.java
Index: BeanGeneratingVisitor.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/BeanGeneratingVisitor.java,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- BeanGeneratingVisitor.java 15 Jul 2005 21:01:17 -0000 1.4.2.1
+++ BeanGeneratingVisitor.java 28 Jul 2005 19:49:24 -0000 1.4.2.2
@@ -18,7 +18,6 @@
import org.apache.ws.jaxme.js.JavaQName;
import org.apache.ws.jaxme.js.JavaSource;
import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
/** Implementation of a
@@ -29,6 +28,10 @@
private final JavaSource js;
private JavaMethod mixedContentMethod;
private boolean isMixed;
+ private ParticleSG generalContentGroupParticle;
+ private int generalContentGroupParticleLevel;
+ private boolean isInInheritedContentGroup;
+ private int inheritedContentGroupLevel;
private ComplexTypeSG ct;
/** Creates a new instance generating methods into the
@@ -105,72 +108,63 @@
}
}
- private boolean isInheritedParticle(ParticleSG pParticle) throws SAXException {
- String propertyName = pParticle.getPropertySG().getPropertyName();
- if (ct.getTypeSG().isExtension()) {
- TypeSG extType = ct.getTypeSG().getExtendedType();
- if (extType.isComplex() && !extType.getComplexTypeSG().hasSimpleContent()) {
- ParticleSG[] inheritedParticles = extType.getComplexTypeSG().getComplexContentSG().getElementParticles();
- for (int i = 0; i < inheritedParticles.length; i++) {
- if (inheritedParticles[i].getPropertySG().getPropertyName().equals(propertyName)) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
private void elementParticle(ParticleSG pParticle) throws SAXException {
- if (isInheritedParticle(pParticle)) {
+ if (isInInheritedContentGroup) {
return;
}
- final JavaSource pJs = this.js;
final PropertySG elementSG = pParticle.getPropertySG();
if (isMixed) {
- GroupSG group = getCurrentGroupParticle().getGroupSG();
- JavaQName qName = GroupUtil.getContentClass(group, pParticle, pJs.getQName());
- JavaSource js;
- if (qName.isInnerClass()) {
- js = pJs.newJavaInnerClass(qName.getInnerClassName(), JavaSource.PUBLIC);
- if (!pJs.isInterface()) {
- js.setStatic(true);
- }
- } else {
- js = pJs.getFactory().newJavaSource(qName, JavaSource.PUBLIC);
- }
- if (pJs.isInterface()) {
- js.setType(JavaSource.INTERFACE);
- } else {
- js.addImplements(GroupUtil.getContentClass(group, pParticle, ct.getClassContext().getXMLInterfaceName()));
- }
- PropertySGChain chain = ((PropertySGImpl) elementSG).getHeadOfChain();
- PropertySGChain head = new PropertySGChainImpl(chain){
- public String getXMLFieldName(PropertySG pController) throws SAXException {
- return "_value";
- }
- public String getPropertyName(PropertySG pController) throws SAXException {
- return "value";
- }
- };
- PropertySGImpl pSG = new PropertySGImpl(head);
- pSG.generate(js);
+ addGeneralContentParticle(pParticle, js, elementSG, getCurrentGroupParticle().getGroupSG());
+ } else if (isInGeneralContentGroupParticle()) {
+ addGeneralContentParticle(pParticle, js, elementSG, generalContentGroupParticle.getGroupSG());
} else {
- elementSG.generate(pJs);
+ elementSG.generate(js);
}
ObjectSG oSG = pParticle.getObjectSG();
TypeSG typeSG = oSG.getTypeSG();
- if (!typeSG.isGlobalType() && !typeSG.isGlobalClass() && typeSG.isComplex()) {
+ if (typeSG.isComplex() && !typeSG.isGlobalType() && !typeSG.isGlobalClass()) {
ComplexTypeSG complexTypeSG = typeSG.getComplexTypeSG();
- if (pJs.isInterface()) {
- complexTypeSG.getXMLInterface(pJs);
+ if (js.isInterface()) {
+ complexTypeSG.getXMLInterface(js);
} else {
- complexTypeSG.getXMLImplementation(pJs);
+ complexTypeSG.getXMLImplementation(js);
}
}
}
+ private void addGeneralContentParticle(ParticleSG pParticle, final JavaSource pJs, final PropertySG elementSG, GroupSG pGroup) throws SAXException {
+ if (!pParticle.getObjectSG().getTypeSG().isComplex()) {
+ return;
+ }
+ JavaQName qName = GroupUtil.getContentClass(pGroup, pParticle, pJs.getQName());
+ JavaSource js;
+ if (qName.isInnerClass()) {
+ js = pJs.newJavaInnerClass(qName.getInnerClassName(), JavaSource.PUBLIC);
+ if (!pJs.isInterface()) {
+ js.setStatic(true);
+ }
+ } else {
+ js = pJs.getFactory().newJavaSource(qName, JavaSource.PUBLIC);
+ }
+ if (pJs.isInterface()) {
+ js.setType(JavaSource.INTERFACE);
+ } else {
+ js.addImplements(GroupUtil.getContentClass(pGroup, pParticle, ct.getClassContext().getXMLInterfaceName()));
+ }
+ PropertySGChain chain = ((PropertySGImpl) elementSG).getHeadOfChain();
+ PropertySGChain head = new PropertySGChainImpl(chain){
+ public String getXMLFieldName(PropertySG pController) throws SAXException {
+ return "_value";
+ }
+ public String getPropertyName(PropertySG pController) throws SAXException {
+ return "value";
+ }
+ };
+ PropertySGImpl pSG = new PropertySGImpl(head);
+ pSG.generate(js);
+ }
+
public void simpleElementParticle(ParticleSG pParticle) throws SAXException {
elementParticle(pParticle);
}
@@ -183,11 +177,93 @@
throw new IllegalStateException("TODO: Add support for wildcards");
}
+ private class ContentGroupCounter extends ParticleVisitorImpl {
+ private int num;
+ public void startGroupParticle(ParticleSG pParticle) throws SAXException {
+ super.startGroupParticle(pParticle);
+ ++num;
+ }
+ int getNumGroups() { return num; }
+ }
+
+ private int countContentGroups(ComplexTypeSG pType) throws SAXException {
+ ContentGroupCounter counter = new ContentGroupCounter();
+ new ParticleWalker(counter).walk(pType);
+ return counter.getNumGroups();
+ }
+
+ /** Checks, whether the particle is an extended types content group.
+ * This check is quite difficult, because we must deduce, whether we
+ * actually are
+ * @param pParticle
+ * @throws SAXException
+ */
+ private boolean checkInheritedContentGroup(ParticleSG pParticle) throws SAXException {
+ if (isInInheritedContentGroup) {
+ // There's only one inherited content group, so it cannot start here.
+ return false;
+ }
+ TypeSG tSG = ct.getTypeSG();
+ if (!tSG.isExtension()) {
+ return false;
+ }
+ TypeSG extTSG = tSG.getExtendedType();
+ if (extTSG.getComplexTypeSG().getComplexContentSG().isEmpty()) {
+ return false;
+ }
+ switch (groupParticles.size()) {
+ case 0:
+ /* It might be, that the inheriting types content group is empty.
+ * If so, the inherited content group is the outermost content
+ * group.
+ */
+ return countContentGroups(tSG.getComplexTypeSG()) == countContentGroups(extTSG.getComplexTypeSG());
+ case 1:
+ /** If we arrive here, then we know that both content groups
+ * are non-empty. If so, the content group at level zero is
+ * the sequence of both content groups.
+ */
+ ParticleSG rootParticle = (ParticleSG) groupParticles.get(0);
+ GroupSG rootGroup = rootParticle.getGroupSG();
+ if (!rootGroup.isSequence()) {
+ return false;
+ }
+ ParticleSG[] particles = rootGroup.getParticles();
+ return particles.length == 2 || particles[0] != pParticle;
+ default:
+ return false;
+ }
+ }
+
+ protected boolean isInGeneralContentGroupParticle() throws SAXException {
+ return generalContentGroupParticle != null;
+ }
+
public void startGroupParticle(ParticleSG pParticle) throws SAXException {
- if (pParticle.isMultiple()) {
- throw new SAXParseException("Model groups with maxOccurs > 1 are not yet supported.",
- pParticle.getLocator());
+ // This might be a content group inherited via xs:extension.
+ if (checkInheritedContentGroup(pParticle)) {
+ isInInheritedContentGroup = true;
+ inheritedContentGroupLevel = groupParticles.size();
+ }
+ if (!isInInheritedContentGroup) {
+ if (!isMixed && !isInGeneralContentGroupParticle() && pParticle.isMultiple()) {
+ generalContentGroupParticle = pParticle;
+ generalContentGroupParticleLevel = groupParticles.size();
+ }
}
super.startGroupParticle(pParticle);
}
+
+ public void endGroupParticle (ParticleSG pParticle) throws SAXException {
+ super.endGroupParticle(pParticle);
+ if (isInInheritedContentGroup) {
+ if (inheritedContentGroupLevel == groupParticles.size()) {
+ isInInheritedContentGroup = false;
+ }
+ } else {
+ if (isInGeneralContentGroupParticle() && generalContentGroupParticleLevel == groupParticles.size()) {
+ generalContentGroupParticle = null;
+ }
+ }
+ }
}
1.4.2.1 +1 -1 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SequenceHandlerSG.java
Index: SequenceHandlerSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SequenceHandlerSG.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- SequenceHandlerSG.java 24 Apr 2005 20:16:48 -0000 1.4
+++ SequenceHandlerSG.java 28 Jul 2005 19:49:24 -0000 1.4.2.1
@@ -143,7 +143,7 @@
* returns the index of the last valid particle. Returns
* -1, if there is no valid particle.
*/
- private int getLastValidParticle(int pState) {
+ private int getLastValidParticle(int pState) throws SAXException {
int lastParticle;
if (pState == 0) {
lastParticle = 0;
1.7.2.1 +26 -2 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupHandlerSG.java
Index: GroupHandlerSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupHandlerSG.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- GroupHandlerSG.java 8 Jul 2005 20:43:57 -0000 1.7
+++ GroupHandlerSG.java 28 Jul 2005 19:49:24 -0000 1.7.2.1
@@ -164,8 +164,32 @@
}
}
- protected boolean isRequiredParticle(ParticleSG particleSG) {
- return particleSG.getMinOccurs() > 0;
+ protected boolean isRequiredParticle(ParticleSG particleSG) throws SAXException {
+ if (particleSG.getMinOccurs() == 0) {
+ return false;
+ } else {
+ if (particleSG.isGroup()) {
+ GroupSG group = particleSG.getGroupSG();
+ ParticleSG[] particles = group.getParticles();
+ if (group.isChoice()) {
+ for (int i = 0; i < particles.length; i++) {
+ if (!isRequiredParticle(particles[i])) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ for (int i = 0; i < particles.length; i++) {
+ if (isRequiredParticle(particles[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+ } else {
+ return true;
+ }
+ }
}
protected void handleStartOfChildElement(Object pUnmarshallerHandler,
1.1.2.2 +1 -1 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitorImpl.java
Index: ParticleVisitorImpl.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitorImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ParticleVisitorImpl.java 15 Jul 2005 21:01:17 -0000 1.1.2.1
+++ ParticleVisitorImpl.java 28 Jul 2005 19:49:24 -0000 1.1.2.2
@@ -14,7 +14,7 @@
* with methods doing nothing.
*/
public class ParticleVisitorImpl implements ParticleVisitor {
- private final List groupParticles = new ArrayList();
+ protected final List groupParticles = new ArrayList();
protected ParticleSG getCurrentGroupParticle() {
return (ParticleSG) groupParticles.get(groupParticles.size()-1);
No revision
No revision
1.2.2.1 +1 -1 ws-jaxme/src/js/org/apache/ws/jaxme/js/pattern/CompiledClassReflector.java
Index: CompiledClassReflector.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/pattern/CompiledClassReflector.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- CompiledClassReflector.java 18 May 2005 22:09:09 -0000 1.2
+++ CompiledClassReflector.java 28 Jul 2005 19:49:24 -0000 1.2.2.1
@@ -59,7 +59,7 @@
*/
public JavaSource getJavaSource(JavaSourceFactory pFactory) {
Class c = getCompiledClass();
- JavaSource js = new JavaSourceFactory().newJavaSource(JavaQNameImpl.getInstance(c.getName(), true));
+ JavaSource js = new JavaSourceFactory().newJavaSource(JavaQNameImpl.getInstance(c.getName()));
Method[] methods = c.getMethods();
for (int i = 0; i < methods.length; i++) {
Method m = methods[i];
1.10.2.1 +3 -3 ws-jaxme/src/js/org/apache/ws/jaxme/js/pattern/Ant.java
Index: Ant.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/pattern/Ant.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- Ant.java 18 May 2005 22:09:09 -0000 1.10
+++ Ant.java 28 Jul 2005 19:49:24 -0000 1.10.2.1
@@ -209,7 +209,7 @@
}
protected static JavaQName getJavaQName(String pName) {
- return JavaQNameImpl.getInstance(pName, true);
+ return JavaQNameImpl.getInstance(pName);
}
/** The <code>AntProxyGenerator</code> is an Ant task
@@ -659,7 +659,7 @@
Dispatcher disp = getDispatcher();
if (disp != null) {
gen.setDispatcherImplementsXmlRpcHandler(disp.isImplementingXmlRpcHandler());
- gen.getDispatcher(JavaQNameImpl.getInstance(disp.getName(), true));
+ gen.getDispatcher(JavaQNameImpl.getInstance(disp.getName()));
}
jsf.write(getDestDir());
}
1.8.2.1 +4 -4 ws-jaxme/src/js/org/apache/ws/jaxme/js/pattern/ChainGenerator.java
Index: ChainGenerator.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/pattern/ChainGenerator.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- ChainGenerator.java 18 May 2005 22:09:09 -0000 1.8
+++ ChainGenerator.java 28 Jul 2005 19:49:24 -0000 1.8.2.1
@@ -105,7 +105,7 @@
JavaSourceFactory jsf = new JavaSourceFactory();
List sources = new ArrayList();
Set names = new HashSet();
- loadSources(pClassLoader, JavaQNameImpl.getInstance(pName, true),
+ loadSources(pClassLoader, JavaQNameImpl.getInstance(pName),
jsf, sources, names);
if (sources.isEmpty()) {
return null;
@@ -146,7 +146,7 @@
/** <p>Sets the interface name being generated for the chain objects.</p>
*/
public void setChainInterfaceName(String pInterfaceName) {
- JavaQName qName = JavaQNameImpl.getInstance(pInterfaceName, true);
+ JavaQName qName = JavaQNameImpl.getInstance(pInterfaceName);
setChainInterface(qName);
}
@@ -165,7 +165,7 @@
/** <p>Sets the class name being generated for the chain objects.</p>
*/
public void setProxyClassName(String pClassName) {
- JavaQName qName = JavaQNameImpl.getInstance(pClassName, true);
+ JavaQName qName = JavaQNameImpl.getInstance(pClassName);
setProxyClass(qName);
}
@@ -195,7 +195,7 @@
/** <p>Sets the name of the chain implementation class.</p>
*/
public void setImplementationClassName(String pClassName) {
- setImplementationClass(JavaQNameImpl.getInstance(pClassName, true));
+ setImplementationClass(JavaQNameImpl.getInstance(pClassName));
}
/** <p>Sets the chain implementation class.</p>
No revision
No revision
1.7.4.1 +1 -1 ws-jaxme/src/js/org/apache/ws/jaxme/js/apps/XmlRpcClientGenerator.java
Index: XmlRpcClientGenerator.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/apps/XmlRpcClientGenerator.java,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -u -r1.7 -r1.7.4.1
--- XmlRpcClientGenerator.java 7 Oct 2004 22:12:13 -0000 1.7
+++ XmlRpcClientGenerator.java 28 Jul 2005 19:49:24 -0000 1.7.4.1
@@ -413,7 +413,7 @@
public JavaSource getDispatcher(JavaQName pQName) {
JavaSource js = getFactory().newJavaSource(pQName, JavaSource.PUBLIC);
if (isDispatcherImplementsXmlRpcHandler()) {
- js.addImport(JavaQNameImpl.getInstance("org.apache.xmlrpc.XmlRpcHandler", true));
+ js.addImport(JavaQNameImpl.getInstance("org.apache.xmlrpc.XmlRpcHandler"));
}
JavaComment comment = js.newComment();
comment.addLine("The dispatcher is being used by the XmlRpcServer.");
No revision
No revision
1.12.2.1 +24 -0 ws-jaxme/src/test/jaxb/types.xsd
Index: types.xsd
===================================================================
RCS file: /home/cvs/ws-jaxme/src/test/jaxb/types.xsd,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -u -r1.12 -r1.12.2.1
--- types.xsd 6 Jul 2005 21:34:14 -0000 1.12
+++ types.xsd 28 Jul 2005 19:49:25 -0000 1.12.2.1
@@ -275,4 +275,28 @@
</xs:sequence>
</xs:complexType>
</xs:element>
+
+ <xs:element name="html">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element name="dummy" type="xs:string"/>
+ <xs:element name="head">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="title" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="body">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="p" maxOccurs="unbounded">
+ <xs:complexType/>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
</xs:schema>
No revision
No revision
1.4.2.1 +4 -4 ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/ListTypeSGImpl.java
Index: ListTypeSGImpl.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/ListTypeSGImpl.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- ListTypeSGImpl.java 28 Apr 2005 23:57:53 -0000 1.4
+++ ListTypeSGImpl.java 28 Jul 2005 19:49:25 -0000 1.4.2.1
@@ -116,7 +116,7 @@
if ("indexed".equals(collectionType)) {
return new TypedValueImpl(result, itemType.getSimpleTypeSG().getRuntimeType());
} else {
- JavaQName myListType = JavaQNameImpl.getInstance(collectionType, true);
+ JavaQName myListType = JavaQNameImpl.getInstance(collectionType);
return new TypedValueImpl(new Object[]{"(new ", myListType, "(", Arrays.class, ".asList(", result, ")))"}, myListType);
}
}
@@ -126,7 +126,7 @@
LocalJavaField list = pMethod.newJavaField(LIST_TYPE);
String collectionType = pController.getCollectionType();
list.addLine("new ", ("indexed".equals(collectionType) ?
- ARRAYLIST_TYPE : JavaQNameImpl.getInstance(collectionType, true)), "()");
+ ARRAYLIST_TYPE : JavaQNameImpl.getInstance(collectionType)), "()");
DirectAccessible st = pMethod.addForEnumeration(StringTokenizer.class, new Object[]{"new ", StringTokenizer.class, "(", pValue, ")"});
pMethod.addLine(list, ".add(", itemType.getSimpleTypeSG().getCastFromString(pMethod, new Object[]{st, ".nextToken()"}, pData),
");");
@@ -137,7 +137,7 @@
return new TypedValueImpl(new Object[]{"((", iType, ") ", list, ".toArray(new ", iType, "[", list, ".size()]))"},
itemType.getSimpleTypeSG().getRuntimeType());
} else {
- JavaQName myListType = JavaQNameImpl.getInstance(collectionType, true);
+ JavaQName myListType = JavaQNameImpl.getInstance(collectionType);
return new TypedValueImpl(list, myListType);
}
}
@@ -191,7 +191,7 @@
public Object getInitialValue(SimpleTypeSG pController, JavaSource p0) throws SAXException {
String s = pController.getCollectionType();
- JavaQName listClass = "indexed".equals(s) ? ARRAYLIST_TYPE : JavaQNameImpl.getInstance(s, true);
+ JavaQName listClass = "indexed".equals(s) ? ARRAYLIST_TYPE : JavaQNameImpl.getInstance(s);
return new Object[]{"new ", listClass, "()"};
}
No revision
No revision
1.11.4.1 +2 -0 ws-jaxme/.classpath
Index: .classpath
===================================================================
RCS file: /home/cvs/ws-jaxme/.classpath,v
retrieving revision 1.11
retrieving revision 1.11.4.1
diff -u -r1.11 -r1.11.4.1
--- .classpath 4 Mar 2005 10:41:53 -0000 1.11
+++ .classpath 28 Jul 2005 19:49:25 -0000 1.11.4.1
@@ -19,5 +19,7 @@
<classpathentry kind="src" path="src/webapp/java"/>
<classpathentry exported="true" kind="lib" path="prerequisites/servlet.jar"/>
<classpathentry exported="true" kind="lib" path="prerequisites/antlr.jar"/>
+ <classpathentry kind="src" path="test/project36/src"/>
+ <classpathentry kind="src" path="test/project36/build/src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org