jochen      2005/03/07 12:00:28

  Modified:    src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg
                        AllHandlerSG.java GroupHandlerSG.java
                        HandlerSG.java ChoiceHandlerSG.java package.html
                        EmptyElementSG.java SimpleContentHandlerSG.java
                        HandlerSGImpl.java SequenceHandlerSG.java
               src/jaxme/org/apache/ws/jaxme/impl JMSAXGroupParser.java
                        JMUnmarshallerHandlerImpl.java
                        JMSAXElementParser.java
               src/jaxme/org/apache/ws/jaxme/junit NestedGroupTest.java
               src/jaxme/org/apache/ws/jaxme/generator/sg/impl
                        ParsePrintSG.java
  Log:
  Completed work on unmarshalling of nested groups.
  
  Revision  Changes    Path
  1.2       +22 -3     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/AllHandlerSG.java
  
  Index: AllHandlerSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/AllHandlerSG.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AllHandlerSG.java 6 Mar 2005 02:32:27 -0000       1.1
  +++ AllHandlerSG.java 7 Mar 2005 20:00:27 -0000       1.2
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2005  The Apache Software Foundation
  + * 
  + * Licensed 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.ws.jaxme.generator.sg.impl.ccsg;
   
   import java.util.ArrayList;
  @@ -9,11 +24,13 @@
   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.impl.JMUnmarshallerHandlerImpl;
   import org.apache.ws.jaxme.js.DirectAccessible;
   import org.apache.ws.jaxme.js.JavaComment;
   import org.apache.ws.jaxme.js.JavaField;
   import org.apache.ws.jaxme.js.JavaMethod;
   import org.apache.ws.jaxme.js.JavaSource;
  +import org.apache.ws.jaxme.js.LocalJavaField;
   import org.xml.sax.SAXException;
   
   
  @@ -58,12 +75,12 @@
                pJm.addIf(getStateField(), "[" + pNum, "]");
                ParticleSG particle = particles[pNum];
                if (particle.isElement()) {
  -                     pJm.addLine("handler.validationEvent(", 
ValidationEvent.class, ".WARNING, ",
  +                     pJm.addLine("getHandler().validationEvent(", 
ValidationEvent.class, ".WARNING, ",
                                                JavaSource.getQuoted("The 
element " + particle.getObjectSG().getName() +
                                                                                
     " has already been defined."),
                                            ", ", ValidationEvents.class, 
".EVENT_ALL_GROUP_REUSE, null);");
                } else if (particle.isGroup()) {
  -                     pJm.addLine("handler.validationEvent(", 
ValidationEvent.class, ".WARNING, ",
  +                     pJm.addLine("getHandler().validationEvent(", 
ValidationEvent.class, ".WARNING, ",
                                                JavaSource.getQuoted("The group 
" + getGroupName(particle.getGroupSG()) +
                                                                                
         " has already been defined."),
                                            ", ", ValidationEvents.class, 
".EVENT_ALL_GROUP_REUSE, null);");
  @@ -79,7 +96,9 @@
   
        public JavaMethod newStartElementMethod() throws SAXException {
                JavaMethod result = super.newStartElementMethod();
  -             handleStartElementStates(result, 0, particles.length-1);
  +             LocalJavaField unmarshallerHandler = 
result.newJavaField(JMUnmarshallerHandlerImpl.class);
  +             unmarshallerHandler.addLine("getHandler()");
  +             handleStartElementStates(unmarshallerHandler, result, 0, 
particles.length-1);
                result.addLine("return false;");
                return result;
        }
  
  
  
  1.2       +42 -18    
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GroupHandlerSG.java       6 Mar 2005 02:32:27 -0000       1.1
  +++ GroupHandlerSG.java       7 Mar 2005 20:00:28 -0000       1.2
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2005  The Apache Software Foundation
  + * 
  + * Licensed 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.ws.jaxme.generator.sg.impl.ccsg;
   
   import java.util.HashMap;
  @@ -15,6 +30,7 @@
   import org.apache.ws.jaxme.generator.util.JavaNamer;
   import org.apache.ws.jaxme.impl.JMSAXElementParser;
   import org.apache.ws.jaxme.impl.JMSAXGroupParser;
  +import org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl;
   import org.apache.ws.jaxme.js.DirectAccessible;
   import org.apache.ws.jaxme.js.JavaField;
   import org.apache.ws.jaxme.js.JavaInnerClass;
  @@ -140,6 +156,7 @@
                        n += "Handler";
                        if (js.getInnerClass(n) == null) {
                                GroupHandlerSG result = 
newGroupHandlerSG(pGroup, n);
  +                             result.newGetHandlerMethod(js);
                                return result;
                        }
                }
  @@ -170,7 +187,8 @@
                return particleSG.getMinOccurs() > 0;
        }
   
  -     protected void handleStartOfChildElement(JavaMethod pJm, ParticleSG 
pParticle) {
  +     protected void handleStartOfChildElement(Object pUnmarshallerHandler,
  +                                                                             
         JavaMethod pJm, ParticleSG pParticle) {
                ObjectSG oSG = pParticle.getObjectSG();
                TypeSG tSG = oSG.getTypeSG();
                if (tSG.isComplex()) {
  @@ -178,7 +196,7 @@
                        Object[] o, h;
                        if (oSG.getClassContext().isGlobal()) {
                                LocalJavaField manager = 
pJm.newJavaField(JMManager.class);
  -                             
manager.addLine("handler.getJMUnmarshaller().getJAXBContextImpl().getManagerS(",
  +                             
manager.addLine("getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(",
                                                elementInterfaceClass, 
".class)");
                                o = new Object[]{manager, ".getElementS();"};
                                h = new Object[]{manager, ".getHandler();"};
  @@ -192,20 +210,21 @@
                        LocalJavaField hField = 
pJm.newJavaField(JMSAXElementParser.class);
                        hField.addLine(h);
                        XsQName name = oSG.getName();
  -                     pJm.addLine(hField, ".init(handler, ", oField, ", ",
  +                     pJm.addLine(hField, ".init(", pUnmarshallerHandler, ", 
", oField, ", ",
                                        
JavaSource.getQuoted(name.getNamespaceURI()), ", ",
                                        
JavaSource.getQuoted(name.getLocalName()),
  -                     ", handler.getLevel());");
  +                     ", ", pUnmarshallerHandler, ".getLevel());");
                        pJm.addLine(hField, ".setAttributes(", getParamAttrs(), 
");");
  -                     pJm.addLine("handler.addElementParser(", hField, ");");
  +                     pJm.addLine(pUnmarshallerHandler, ".addElementParser(", 
hField, ");");
                } else {
  -                     pJm.addLine("handler.addSimpleAtomicState();");
  +                     pJm.addLine(pUnmarshallerHandler, 
".addSimpleAtomicState();");
                }
        }
   
        protected abstract void acceptParticle(JavaMethod pJm, int pNum) throws 
SAXException;
   
  -     protected void handleStartElementStates(JavaMethod pJm, int pFrom,
  +     protected void handleStartElementStates(Object pUnmarshallerHandler,
  +                                                                             
        JavaMethod pJm, int pFrom,
                                                                                
        int pTo) throws SAXException {
                if (pFrom < 0  ||  pFrom >= particles.length  ||
                    pTo < 0  ||  pTo >= particles.length  ||  pTo < pFrom) {
  @@ -226,21 +245,20 @@
                                        uriCondition = new 
Object[]{JavaSource.getQuoted(name.getNamespaceURI()),
                                                        ".equals(", 
getParamNamespaceURI(), ")"};
                                }
  -                             pJm.addIf(pFrom == i, uriCondition, "  &&  ",
  -                                             
JavaSource.getQuoted(name.getLocalName()),
  -                                             ".equals(", 
getParamLocalName(), ")");
  +                             pJm.addIf(i == pFrom, uriCondition, "  &&  ",
  +                                               
JavaSource.getQuoted(name.getLocalName()),
  +                                               ".equals(", 
getParamLocalName(), ")");
                                acceptParticle(pJm, i);
  -                             handleStartOfChildElement(pJm, particle);
  +                             handleStartOfChildElement(pUnmarshallerHandler, 
pJm, particle);
                                pJm.addLine("return true;");
                        } else if (particle.isGroup()) {
                                GroupSG gSG = particle.getGroupSG();
                                GroupHandlerSG handlerSG = 
getGroupHandlerSG(gSG);
  -                             LocalJavaField handler = 
pJm.newJavaField(JMSAXGroupParser.class);
  -                             handler.addLine("new ", 
handlerSG.getJavaSource().getQName(), "()");
  -                             pJm.addIf(pFrom == i,
  -                                             handler, ".startElement(", 
getParamNamespaceURI(),
  -                                             ", ", getParamLocalName(), ", 
", getParamQName(),
  -                                             ", ", getParamAttrs(), ")");
  +                             pJm.addIf(i == pFrom,
  +                                               pUnmarshallerHandler, 
".testGroupParser(new ",
  +                                               
handlerSG.getJavaSource().getQName(), "(), ",
  +                                               getParamNamespaceURI(), ", ", 
getParamLocalName(),
  +                                               ", ", getParamQName(), ", ", 
getParamAttrs(), ")");
                                acceptParticle(pJm, i);
                                pJm.addLine("return true;");
                        } else if (particle.isWildcard()) {
  @@ -300,7 +318,7 @@
                                type = 
childType.getComplexTypeSG().getClassContext().getXMLInterfaceName();
                        } else {
                                v = new Object[]{"(", String.class, ") ", v};
  -                             v = 
childType.getSimpleTypeSG().getCastFromString(pJm, v, "handler");
  +                             v = 
childType.getSimpleTypeSG().getCastFromString(pJm, v, "getHandler()");
                                type = null;
                        }
                        pParticle.getPropertySG().addValue(pJm, pElement, v, 
type);
  @@ -325,6 +343,12 @@
                return null;
        }
   
  +     private JavaMethod newGetHandlerMethod(JavaSource pOuter) throws 
SAXException {
  +             JavaMethod result = getJavaSource().newJavaMethod("getHandler", 
JMUnmarshallerHandlerImpl.class, JavaSource.PUBLIC);
  +             result.addLine("return ", pOuter.getQName(), 
".this.getHandler();");
  +             return result;
  +     }
  +
        public void generate() throws SAXException {
                super.generate();
                for (Iterator iter = groups.values().iterator();  
iter.hasNext();  ) {
  
  
  
  1.2       +15 -0     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSG.java
  
  Index: HandlerSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSG.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HandlerSG.java    6 Mar 2005 02:32:27 -0000       1.1
  +++ HandlerSG.java    7 Mar 2005 20:00:28 -0000       1.2
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2005  The Apache Software Foundation
  + * 
  + * Licensed 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.ws.jaxme.generator.sg.impl.ccsg;
   
   import org.apache.ws.jaxme.js.JavaMethod;
  
  
  
  1.2       +23 -4     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ChoiceHandlerSG.java
  
  Index: ChoiceHandlerSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ChoiceHandlerSG.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChoiceHandlerSG.java      6 Mar 2005 02:32:27 -0000       1.1
  +++ ChoiceHandlerSG.java      7 Mar 2005 20:00:28 -0000       1.2
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2005  The Apache Software Foundation
  + * 
  + * Licensed 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.ws.jaxme.generator.sg.impl.ccsg;
   
   import javax.xml.bind.ValidationEvent;
  @@ -6,11 +21,13 @@
   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.impl.JMUnmarshallerHandlerImpl;
   import org.apache.ws.jaxme.js.DirectAccessible;
   import org.apache.ws.jaxme.js.JavaComment;
   import org.apache.ws.jaxme.js.JavaField;
   import org.apache.ws.jaxme.js.JavaMethod;
   import org.apache.ws.jaxme.js.JavaSource;
  +import org.apache.ws.jaxme.js.LocalJavaField;
   import org.xml.sax.SAXException;
   
   
  @@ -42,18 +59,18 @@
                pJm.addIf(getStateField());
                ParticleSG particle = particles[pNum];
                pJm.addIf(getChildNumField(), " != " + pNum);
  -             pJm.addLine("handler.validationEvent(", ValidationEvent.class, 
".WARNING, ",
  +             pJm.addLine("getHandler().validationEvent(", 
ValidationEvent.class, ".WARNING, ",
                                        JavaSource.getQuoted("Multiple 
different particles present in a choive group."),
                                        ", ", ValidationEvents.class, 
".EVENT_CHOICE_GROUP_REUSE, null);");
                if (!particles[pNum].isMultiple()) {
                        pJm.addElse();
                        if (particle.isElement()) {
  -                             pJm.addLine("handler.validationEvent(", 
ValidationEvent.class, ".WARNING, ",
  +                             pJm.addLine("getHandler().validationEvent(", 
ValidationEvent.class, ".WARNING, ",
                                                        
JavaSource.getQuoted("The element " + particle.getObjectSG().getName() +
                                                                                
             " has already been defined."),
                                                        ", ", 
ValidationEvents.class, ".EVENT_CHOICE_GROUP_REUSE, null);");
                        } else if (particle.isGroup()) {
  -                             pJm.addLine("handler.validationEvent(", 
ValidationEvent.class, ".WARNING, ",
  +                             pJm.addLine("getHandler().validationEvent(", 
ValidationEvent.class, ".WARNING, ",
                                                        
JavaSource.getQuoted("The group " + getGroupName(particle.getGroupSG()) +
                                                                                
                 " has already been defined."),
                                                    ", ", 
ValidationEvents.class, ".EVENT_CHOICE_GROUP_REUSE, null);");
  @@ -71,7 +88,9 @@
   
        public JavaMethod newStartElementMethod() throws SAXException {
                JavaMethod result = super.newStartElementMethod();
  -             handleStartElementStates(result, 0, particles.length-1);
  +             LocalJavaField unmarshallerHandler = 
result.newJavaField(JMUnmarshallerHandlerImpl.class);
  +             unmarshallerHandler.addLine("getHandler()");
  +             handleStartElementStates(unmarshallerHandler, result, 0, 
particles.length-1);
                result.addLine("return false;");
                return result;
        }
  
  
  
  1.2       +1 -3      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/package.html
  
  Index: package.html
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/package.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- package.html      6 Mar 2005 02:32:27 -0000       1.1
  +++ package.html      7 Mar 2005 20:00:28 -0000       1.2
  @@ -1,6 +1,5 @@
   <!--
  -
  - Copyright 2004 The Apache Software Foundation.
  + Copyright 2005 The Apache Software Foundation.
    
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
  @@ -13,7 +12,6 @@
    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.
  -
   -->
   <html>
       <head>
  
  
  
  1.2       +15 -0     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/EmptyElementSG.java
  
  Index: EmptyElementSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/EmptyElementSG.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EmptyElementSG.java       6 Mar 2005 02:32:27 -0000       1.1
  +++ EmptyElementSG.java       7 Mar 2005 20:00:28 -0000       1.2
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2005  The Apache Software Foundation
  + * 
  + * Licensed 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.ws.jaxme.generator.sg.impl.ccsg;
   
   import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
  
  
  
  1.2       +16 -1     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SimpleContentHandlerSG.java
  
  Index: SimpleContentHandlerSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SimpleContentHandlerSG.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleContentHandlerSG.java       6 Mar 2005 02:32:27 -0000       1.1
  +++ SimpleContentHandlerSG.java       7 Mar 2005 20:00:28 -0000       1.2
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2005  The Apache Software Foundation
  + * 
  + * Licensed 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.ws.jaxme.generator.sg.impl.ccsg;
   
   import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
  @@ -29,7 +44,7 @@
                SimpleContentSG scSG = ctSG.getSimpleContentSG();
                Object v = getParamResult();
                v = new Object[]{"(", String.class, ") ", v};
  -             v = 
scSG.getContentTypeSG().getSimpleTypeSG().getCastFromString(result, v, 
"handler");
  +             v = 
scSG.getContentTypeSG().getSimpleTypeSG().getCastFromString(result, v, 
"getHandler()");
                scSG.getPropertySG().addValue(result, element, v, null);
                return result;
        }
  
  
  
  1.2       +17 -2     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSGImpl.java
  
  Index: HandlerSGImpl.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSGImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HandlerSGImpl.java        6 Mar 2005 02:32:27 -0000       1.1
  +++ HandlerSGImpl.java        7 Mar 2005 20:00:28 -0000       1.2
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2005  The Apache Software Foundation
  + * 
  + * Licensed 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.ws.jaxme.generator.sg.impl.ccsg;
   
   import java.util.HashSet;
  @@ -118,7 +133,7 @@
                                
                                jm.addIf(firstInNamespace, 
JavaSource.getQuoted(attr.getName().getLocalName()), ".equals(", pLocalName, 
")");
                                firstInNamespace = false;
  -                             Object v = 
myAttributes[i].getTypeSG().getSimpleTypeSG().getCastFromString(jm, pValue, 
"handler");
  +                             Object v = 
myAttributes[i].getTypeSG().getSimpleTypeSG().getCastFromString(jm, pValue, 
"getHandler()");
                                attr.getPropertySG().setValue(jm, result, v, 
null);
                                jm.addLine("return;");
                        }
  @@ -144,7 +159,7 @@
                        jm.addLine(result, ".", 
wildcard.getPropertySG().getXMLSetMethodName(), "(new ",
                                        QName.class, "(", pURI, ", ", 
pLocalName, "), ", pValue, ");");
                        jm.addCatch(IllegalArgumentException.class);
  -                     jm.addLine("handler.validationEvent(", 
ValidationEvent.class, ".ERROR, ",
  +                     jm.addLine("getHandler().validationEvent(", 
ValidationEvent.class, ".ERROR, ",
                                        JavaSource.getQuoted("Invalid namespace 
for anyAttribute: '"),
                                        " + ", pURI, " + ", 
JavaSource.getQuoted("', attribute name is '"),
                                        " + ", pLocalName, " + ", 
JavaSource.getQuoted("'"),
  
  
  
  1.2       +23 -3     
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SequenceHandlerSG.java    6 Mar 2005 02:32:27 -0000       1.1
  +++ SequenceHandlerSG.java    7 Mar 2005 20:00:28 -0000       1.2
  @@ -1,13 +1,30 @@
  +/*
  + * Copyright 2005  The Apache Software Foundation
  + * 
  + * Licensed 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.ws.jaxme.generator.sg.impl.ccsg;
   
   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.impl.JMUnmarshallerHandlerImpl;
   import org.apache.ws.jaxme.js.DirectAccessible;
   import org.apache.ws.jaxme.js.JavaComment;
   import org.apache.ws.jaxme.js.JavaField;
   import org.apache.ws.jaxme.js.JavaMethod;
   import org.apache.ws.jaxme.js.JavaSource;
  +import org.apache.ws.jaxme.js.LocalJavaField;
   import org.xml.sax.SAXException;
   
   
  @@ -75,17 +92,20 @@
        }
   
        public JavaMethod newStartElementMethod() throws SAXException {
  -             System.err.println("newStartElementMethod: -> " + 
getJavaSource().getQName());
                JavaMethod result = super.newStartElementMethod();
  +             LocalJavaField unmarshallerHandler = 
result.newJavaField(JMUnmarshallerHandlerImpl.class);
  +             unmarshallerHandler.addLine("getHandler()");
                result.addSwitch(getStateField());
                result.addCase(new Integer(0));
  -             handleStartElementStates(result, getFirstValidParticle(0),
  +             handleStartElementStates(unmarshallerHandler,
  +                                                              result, 
getFirstValidParticle(0),
                                                                 
getLastValidParticle(0));
                result.addBreak();
                for (int i = 0;  i < particles.length;  i++) {
                        int state = getState(i);
                        result.addCase(new Integer(state));
  -                     handleStartElementStates(result, 
getFirstValidParticle(state),
  +                     handleStartElementStates(unmarshallerHandler,
  +                                                                      
result, getFirstValidParticle(state),
                                                                         
getLastValidParticle(state));
                        result.addBreak();
                }
  
  
  
  1.2       +1 -7      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/impl/JMSAXGroupParser.java
  
  Index: JMSAXGroupParser.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/impl/JMSAXGroupParser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JMSAXGroupParser.java     4 Mar 2005 10:41:53 -0000       1.1
  +++ JMSAXGroupParser.java     7 Mar 2005 20:00:28 -0000       1.2
  @@ -10,13 +10,7 @@
    * Note, that complex types with complex content are 
    */
   public abstract class JMSAXGroupParser {
  -     protected JMUnmarshallerHandlerImpl handler;
  -
  -     /** Initializes the parser by setting the required data.
  -      */
  -     public void init(JMUnmarshallerHandlerImpl pHandler) {
  -             handler = pHandler;
  -    }
  +     protected abstract JMUnmarshallerHandlerImpl getHandler();
   
       /** Equivalent to
        * [EMAIL PROTECTED] 
org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, 
java.lang.String, org.xml.sax.Attributes)}.
  
  
  
  1.6       +18 -0     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerHandlerImpl.java
  
  Index: JMUnmarshallerHandlerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerHandlerImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JMUnmarshallerHandlerImpl.java    4 Mar 2005 10:41:53 -0000       1.5
  +++ JMUnmarshallerHandlerImpl.java    7 Mar 2005 20:00:28 -0000       1.6
  @@ -141,6 +141,24 @@
           nss.undeclarePrefix(pPrefix);
       }
   
  +     /** Tests, whether the group parser accepts the element.
  +      * If so, adds the group parser to the stack.
  +      */
  +     public boolean testGroupParser(JMSAXGroupParser pParser,
  +                                                                String 
pNamespaceURI, String pLocalName,
  +                                                                String 
pQName, Attributes pAttrs)
  +                     throws SAXException {
  +             groupParsers.add(pParser);
  +             activeParser = pParser;
  +             state = STATE_GROUP;
  +             if (pParser.startElement(pNamespaceURI, pLocalName, pQName, 
pAttrs)) {
  +                     return true;
  +             } else {
  +                     removeActiveParser();
  +                     return false;
  +             }
  +     }
  +
        /** Adds a parser for an nested element to the stack of parsers.
         */
        public void addElementParser(JMSAXElementParser pParser) {
  
  
  
  1.3       +6 -1      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/impl/JMSAXElementParser.java
  
  Index: JMSAXElementParser.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/impl/JMSAXElementParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JMSAXElementParser.java   6 Mar 2005 02:32:27 -0000       1.2
  +++ JMSAXElementParser.java   7 Mar 2005 20:00:28 -0000       1.3
  @@ -13,10 +13,15 @@
    * for parsing complex elements.
    */
   public abstract class JMSAXElementParser extends JMSAXGroupParser {
  +     private JMUnmarshallerHandlerImpl handler;
        protected Object result;
        private String namespaceURI, localName;
       private int level;
   
  +     public JMUnmarshallerHandlerImpl getHandler() {
  +             return handler;
  +     }
  +
        /** Returns, whether the element has atomic content.
         */
        public boolean isAtomic() { return false; }
  @@ -40,7 +45,7 @@
         */
        public void init(JMUnmarshallerHandlerImpl pHandler, Object pObject,
                                         String pNamespaceURI, String 
pLocalName, int pLevel) {
  -             init(pHandler);
  +             handler = pHandler;
                result = pObject;
                namespaceURI = pNamespaceURI;
           localName = pLocalName;
  
  
  
  1.4       +9 -12     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/junit/NestedGroupTest.java
  
  Index: NestedGroupTest.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/junit/NestedGroupTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NestedGroupTest.java      4 Mar 2005 10:41:52 -0000       1.3
  +++ NestedGroupTest.java      7 Mar 2005 20:00:28 -0000       1.4
  @@ -12,25 +12,19 @@
    * 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.ws.jaxme.junit;
   
  -import java.io.StringReader;
  -import java.util.Iterator;
  -import java.util.List;
  -
  -import javax.xml.bind.JAXBContext;
  +import org.apache.ws.jaxme.test.misc.group.Persons;
   
  -//import org.apache.ws.jaxme.test.misc.group.Persons;
  -//import org.apache.ws.jaxme.test.misc.group.PersonsType.PersonType;
  -import org.xml.sax.InputSource;
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]">Ias</a>
    */
   public class NestedGroupTest extends BaseTestCase {
  -    public NestedGroupTest(String pName) {
  +     /** Creates a new instance with the given name.
  +      */
  +     public NestedGroupTest(String pName) {
           super(pName);
       }
   
  @@ -45,7 +39,10 @@
           + "</Persons>";
       }
       
  -    public void testNestedGroup() throws Exception {
  -       // unmarshalMarshalUnmarshal(Persons.class, getPersons());
  +     /** Tests unmarshalling and marshalling of the
  +      * document returned by [EMAIL PROTECTED] #getPersons()}.
  +      */
  +     public void testNestedGroup() throws Exception {
  +             //unmarshalMarshalUnmarshal(Persons.class, getPersons());
       }
   }
  
  
  
  1.4       +1 -1      
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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ParsePrintSG.java 4 Mar 2005 10:41:52 -0000       1.3
  +++ ParsePrintSG.java 7 Mar 2005 20:00:28 -0000       1.4
  @@ -100,7 +100,7 @@
           pMethod.addTry();
           pMethod.addLine(f, " = ", list, ";");
           DirectAccessible e = pMethod.addCatch(Exception.class);
  -        pMethod.addLine("handler.parseConversionEvent(",
  +        pMethod.addLine("getHandler().parseConversionEvent(",
                           JavaSource.getQuoted("Failed to parse value "),
                           " + ", value, " + ", JavaSource.getQuoted(": "),
                           " + ", e, ".getClass().getName(), ", e, ");");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to