jochen 2005/07/15 14:01:17
Modified: src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg Tag:
JAXME-28 DriverGeneratingVisitor.java
BeanGeneratingVisitor.java ParticleVisitorImpl.java
ParticleVisitor.java
MarshalChildsMethodGeneratingVisitor.java
ParticleWalker.java
src/jaxme/org/apache/ws/jaxme/generator/sg/impl Tag:
JAXME-28 JAXBComplexContentTypeSG.java
. Tag: JAXME-28 .cvsignore .project
Log:
So far, the particle visitor didn't honour the complex types root particle.
Revision Changes Path
No revision
No revision
1.1.2.1 +3 -4
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/DriverGeneratingVisitor.java
Index: DriverGeneratingVisitor.java
===================================================================
RCS file:
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/DriverGeneratingVisitor.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- DriverGeneratingVisitor.java 24 Apr 2005 20:16:48 -0000 1.1
+++ DriverGeneratingVisitor.java 15 Jul 2005 21:01:17 -0000 1.1.2.1
@@ -11,7 +11,6 @@
import org.apache.ws.jaxme.WildcardAttribute;
import org.apache.ws.jaxme.generator.sg.AttributeSG;
import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
-import org.apache.ws.jaxme.generator.sg.GroupSG;
import org.apache.ws.jaxme.generator.sg.ParticleSG;
import org.apache.ws.jaxme.generator.sg.SGlet;
import org.apache.ws.jaxme.generator.sg.TypeSG;
@@ -67,10 +66,10 @@
public void startComplexContent(ComplexTypeSG pType) {
addAttributes(pType);
}
- public void simpleElementParticle(GroupSG pGroup,
ParticleSG pParticle) throws SAXException {
+ public void simpleElementParticle(ParticleSG pParticle)
throws SAXException {
names.add(pParticle.getObjectSG().getName());
}
- public void complexElementParticle(GroupSG pGroup,
ParticleSG pParticle) throws SAXException {
+ public void complexElementParticle(ParticleSG
pParticle) throws SAXException {
names.add(pParticle.getObjectSG().getName());
}
};
@@ -187,7 +186,7 @@
generate(pType);
}
- public void complexElementParticle(GroupSG pGroup, ParticleSG
pParticle) throws SAXException {
+ public void complexElementParticle(ParticleSG pParticle) throws
SAXException {
TypeSG tSG = pParticle.getObjectSG().getTypeSG();
if (tSG.isComplex() && !tSG.isGlobalClass()) {
tSG.getComplexTypeSG().getXMLSerializer(js);
1.4.2.1 +17 -8
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
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- BeanGeneratingVisitor.java 13 Jul 2005 19:58:16 -0000 1.4
+++ BeanGeneratingVisitor.java 15 Jul 2005 21:01:17 -0000 1.4.2.1
@@ -18,6 +18,7 @@
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
@@ -96,7 +97,6 @@
}
public void startComplexContent(ComplexTypeSG pType) throws
SAXException {
- pType.getComplexContentSG().getElementParticles(); // Triggers
the content verification
ct = pType;
generateAttributes(pType);
if (pType.getComplexContentSG().isMixed()) {
@@ -121,14 +121,15 @@
return false;
}
- private void elementParticle(GroupSG pGroupSG, ParticleSG pParticle)
throws SAXException {
+ private void elementParticle(ParticleSG pParticle) throws SAXException {
if (isInheritedParticle(pParticle)) {
return;
}
final JavaSource pJs = this.js;
final PropertySG elementSG = pParticle.getPropertySG();
if (isMixed) {
- JavaQName qName = GroupUtil.getContentClass(pGroupSG,
pParticle, pJs.getQName());
+ GroupSG group = getCurrentGroupParticle().getGroupSG();
+ JavaQName qName = GroupUtil.getContentClass(group,
pParticle, pJs.getQName());
JavaSource js;
if (qName.isInnerClass()) {
js =
pJs.newJavaInnerClass(qName.getInnerClassName(), JavaSource.PUBLIC);
@@ -141,7 +142,7 @@
if (pJs.isInterface()) {
js.setType(JavaSource.INTERFACE);
} else {
-
js.addImplements(GroupUtil.getContentClass(pGroupSG, pParticle,
ct.getClassContext().getXMLInterfaceName()));
+
js.addImplements(GroupUtil.getContentClass(group, pParticle,
ct.getClassContext().getXMLInterfaceName()));
}
PropertySGChain chain = ((PropertySGImpl)
elementSG).getHeadOfChain();
PropertySGChain head = new PropertySGChainImpl(chain){
@@ -170,15 +171,23 @@
}
}
- public void simpleElementParticle(GroupSG pGroup, ParticleSG pParticle)
throws SAXException {
- elementParticle(pGroup, pParticle);
+ public void simpleElementParticle(ParticleSG pParticle) throws
SAXException {
+ elementParticle(pParticle);
}
- public void complexElementParticle(GroupSG pGroup, ParticleSG
pParticle) throws SAXException {
- elementParticle(pGroup, pParticle);
+ public void complexElementParticle(ParticleSG pParticle) throws
SAXException {
+ elementParticle(pParticle);
}
public void wildcardParticle(ParticleSG particle) {
throw new IllegalStateException("TODO: Add support for
wildcards");
}
+
+ public void startGroupParticle(ParticleSG pParticle) throws
SAXException {
+ if (pParticle.isMultiple()) {
+ throw new SAXParseException("Model groups with maxOccurs > 1
are not yet supported.",
+
pParticle.getLocator());
+ }
+ super.startGroupParticle(pParticle);
+ }
}
1.1.2.1 +21 -2
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
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- ParticleVisitorImpl.java 24 Apr 2005 20:16:48 -0000 1.1
+++ ParticleVisitorImpl.java 15 Jul 2005 21:01:17 -0000 1.1.2.1
@@ -1,5 +1,8 @@
package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
import org.apache.ws.jaxme.generator.sg.GroupSG;
import org.apache.ws.jaxme.generator.sg.ParticleSG;
@@ -11,6 +14,12 @@
* with methods doing nothing.
*/
public class ParticleVisitorImpl implements ParticleVisitor {
+ private final List groupParticles = new ArrayList();
+
+ protected ParticleSG getCurrentGroupParticle() {
+ return (ParticleSG) groupParticles.get(groupParticles.size()-1);
+ }
+
public void emptyType(ComplexTypeSG type) throws SAXException {
}
@@ -41,12 +50,22 @@
public void endComplexContent(ComplexTypeSG type) throws SAXException {
}
- public void simpleElementParticle(GroupSG pGroup, ParticleSG pParticle)
throws SAXException {
+ public void simpleElementParticle(ParticleSG pParticle) throws
SAXException {
}
- public void complexElementParticle(GroupSG pGroup, ParticleSG particle)
throws SAXException {
+ public void complexElementParticle(ParticleSG particle) throws
SAXException {
}
public void wildcardParticle(ParticleSG particle) {
}
+
+ public void startGroupParticle(ParticleSG pParticle) throws
SAXException {
+ groupParticles.add(pParticle);
+ }
+
+ public void endGroupParticle(ParticleSG pParticle) throws SAXException {
+ if (groupParticles.remove(groupParticles.size()-1) !=
pParticle) {
+ throw new IllegalStateException("Expected a different
group particle to end.");
+ }
+ }
}
1.1.2.1 +12 -2
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitor.java
Index: ParticleVisitor.java
===================================================================
RCS file:
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitor.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- ParticleVisitor.java 24 Apr 2005 20:16:48 -0000 1.1
+++ ParticleVisitor.java 15 Jul 2005 21:01:17 -0000 1.1.2.1
@@ -54,13 +54,23 @@
/** Invoked to process an element with simple type.
* @throws SAXException The visitor failed.
*/
- void simpleElementParticle(GroupSG pGroup,ParticleSG particle) throws
SAXException;
+ void simpleElementParticle(ParticleSG particle) throws SAXException;
/** Invoked to process an element with complex type.
* @throws SAXException The visitor failed.
*/
- void complexElementParticle(GroupSG pGroup, ParticleSG particle) throws
SAXException;
+ void complexElementParticle(ParticleSG particle) throws SAXException;
/** Invoked to process a wildcard particle.
* @throws SAXException The visitor failed.
*/
void wildcardParticle(ParticleSG particle) throws SAXException;
+ /** Invoked to indicate the beginning of a group particle.
+ * @param pParticle The particle, which is beginning.
+ * @throws SAXException The visitor failed.
+ */
+ public void startGroupParticle(ParticleSG pParticle) throws
SAXException;
+ /** Invoked to indicate the end of a group particle.
+ * @param pParticle The particle, which is ending.
+ * @throws SAXException The visitor failed.
+ */
+ public void endGroupParticle(ParticleSG pParticle) throws SAXException;
}
1.1.2.1 +4 -3
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/MarshalChildsMethodGeneratingVisitor.java
Index: MarshalChildsMethodGeneratingVisitor.java
===================================================================
RCS file:
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/MarshalChildsMethodGeneratingVisitor.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- MarshalChildsMethodGeneratingVisitor.java 24 Apr 2005 20:16:48 -0000
1.1
+++ MarshalChildsMethodGeneratingVisitor.java 15 Jul 2005 21:01:17 -0000
1.1.2.1
@@ -98,11 +98,12 @@
value, ");");
}
- public void simpleElementParticle(GroupSG pGroup, ParticleSG pParticle)
throws SAXException {
+ public void simpleElementParticle(ParticleSG pParticle) throws
SAXException {
final ObjectSG oSG = pParticle.getObjectSG();
if (isMixed) {
JavaQName interfaceName =
ctSG.getClassContext().getXMLInterfaceName();
- JavaQName qName = GroupUtil.getContentClass(pGroup,
pParticle, interfaceName);
+ GroupSG group = getCurrentGroupParticle().getGroupSG();
+ JavaQName qName = GroupUtil.getContentClass(group,
pParticle, interfaceName);
if (mixedTypesMap.contains(qName)) {
return;
}
@@ -144,7 +145,7 @@
", ", pValue, ");");
}
- public void complexElementParticle(GroupSG pGroup, ParticleSG
pParticle) throws SAXException {
+ public void complexElementParticle(ParticleSG pParticle) throws
SAXException {
final ObjectSG oSG = pParticle.getObjectSG();
if (isMixed) {
JavaQName qName =
oSG.getTypeSG().getComplexTypeSG().getClassContext().getXMLInterfaceName();
1.2.2.1 +19 -13
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleWalker.java
Index: ParticleWalker.java
===================================================================
RCS file:
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleWalker.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- ParticleWalker.java 8 Jul 2005 20:43:57 -0000 1.2
+++ ParticleWalker.java 15 Jul 2005 21:01:17 -0000 1.2.2.1
@@ -34,7 +34,7 @@
visitor.emptyType(pType);
} else {
visitor.startComplexContent(pType);
- walkGroup(ccSG.getRootParticle().getGroupSG());
+ walkParticle(ccSG.getRootParticle());
visitor.endComplexContent(pType);
}
}
@@ -68,20 +68,26 @@
ParticleSG[] particles = pGroup.getParticles();
for (int i = 0; i < particles.length; i++) {
ParticleSG particle = particles[i];
- if (particle.isElement()) {
- TypeSG type =
particle.getObjectSG().getTypeSG();
- if (type.isComplex()) {
- visitor.complexElementParticle(pGroup,
particle);
- } else {
- visitor.simpleElementParticle(pGroup,
particle);
- }
- } else if (particle.isGroup()) {
- walkGroup(particle.getGroupSG());
- } else if (particle.isWildcard()) {
- visitor.wildcardParticle(particle);
+ walkParticle(particle);
+ }
+ }
+
+ private void walkParticle(ParticleSG particle) throws SAXException {
+ if (particle.isElement()) {
+ TypeSG type = particle.getObjectSG().getTypeSG();
+ if (type.isComplex()) {
+ visitor.complexElementParticle(particle);
} else {
- throw new IllegalStateException("Invalid
particle type");
+ visitor.simpleElementParticle(particle);
}
+ } else if (particle.isGroup()) {
+ visitor.startGroupParticle(particle);
+ walkGroup(particle.getGroupSG());
+ visitor.endGroupParticle(particle);
+ } else if (particle.isWildcard()) {
+ visitor.wildcardParticle(particle);
+ } else {
+ throw new IllegalStateException("Invalid particle
type");
}
}
}
No revision
No revision
1.11.2.1 +2 -9
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexContentTypeSG.java
Index: JAXBComplexContentTypeSG.java
===================================================================
RCS file:
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexContentTypeSG.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- JAXBComplexContentTypeSG.java 13 Jul 2005 19:58:16 -0000 1.11
+++ JAXBComplexContentTypeSG.java 15 Jul 2005 21:01:17 -0000 1.11.2.1
@@ -26,9 +26,6 @@
import org.apache.ws.jaxme.generator.sg.ObjectSG;
import org.apache.ws.jaxme.generator.sg.ParticleSG;
import org.apache.ws.jaxme.generator.sg.SGFactory;
-import org.apache.ws.jaxme.logging.Logger;
-import org.apache.ws.jaxme.logging.LoggerAccess;
-import org.apache.ws.jaxme.xs.XSGroup;
import org.apache.ws.jaxme.xs.XSParticle;
import org.apache.ws.jaxme.xs.XSType;
import org.apache.ws.jaxme.xs.types.XSAnyType;
@@ -41,8 +38,6 @@
* [EMAIL PROTECTED] org.apache.ws.jaxme.generator.sg.ComplexContentSG}.
*/
public class JAXBComplexContentTypeSG implements ComplexContentSGChain {
- private static final Logger log =
LoggerAccess.getLogger(JAXBComplexContentTypeSG.class);
-
private static class Particle {
private final GroupSG[] stack;
private final ParticleSG particle;
@@ -191,7 +186,7 @@
* See Section 5.9.4, "Bind mixed content" for more details.
*/
if (pController.isMixed()) {
- // Make sure, that all groups have the "general content
property"
+ // Make sure, that all groups have the "general content
property".
}
/* 5.9.7, 2) If (1) a particle has {max occurs} > 1 and (2) its term
* is a model group, then that particle and its descendants are
mapped
@@ -199,9 +194,7 @@
* 5.9.6, "Bind a repeating occurrence model group" for details.
*/
if (groupParticlesWithMultiplicityGreaterOne.size() > 0) {
- Particle particle = (Particle)
groupParticlesWithMultiplicityGreaterOne.get(0);
- throw new SAXParseException("Model groups with maxOccurs > 1 are
not yet supported.",
-
particle.getParticleSG().getLocator());
+ // Make sure, that these particles have the "general content
property".
}
/* 5.9.7, 3) Process all remaining particles 1) whose {term} are
* wildcard particles and (2) that did not belong to a repeating
No revision
No revision
1.6.2.1 +1 -0 ws-jaxme/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/ws-jaxme/.cvsignore,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- .cvsignore 27 Apr 2005 19:42:55 -0000 1.6
+++ .cvsignore 15 Jul 2005 21:01:17 -0000 1.6.2.1
@@ -5,3 +5,4 @@
*.log
xjc
test
+patches
1.2.4.1 +1 -1 ws-jaxme/.project
Index: .project
===================================================================
RCS file: /home/cvs/ws-jaxme/.project,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- .project 12 Apr 2005 08:31:28 -0000 1.2
+++ .project 15 Jul 2005 21:01:17 -0000 1.2.4.1
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>ws-jaxme-0.4</name>
+ <name>ws-jaxme-JAXME-28</name>
<comment></comment>
<projects>
</projects>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]