Package org.apache.ws.jaxme.generator.sg

Examples of org.apache.ws.jaxme.generator.sg.ObjectSG


            String name = p.getPropertySG().getXMLFieldName();
            for (int j = i+1;  j < elementParticles.size();  j++) {
                Particle qParticle = elementParticleArray[j];
                ParticleSG q = qParticle.getParticleSG();
                if (name.equals(q.getPropertySG().getXMLFieldName())) {
                    ObjectSG pObject = p.getObjectSG();
                    ObjectSG qObject = q.getObjectSG();
                    if (!pObject.isGlobal()  ||  !qObject.isGlobal()  ||
                        pObject != qObject) {
                        throw new SAXParseException("Multiple element particles named " + name
                                                    + ", which aren't references to "
                                                    + " a common global element, are present in a common"
                                                    + " complex type. (JAXB 1.0, 5.9.7.4.a) Use jaxb:property/@name"
View Full Code Here


    return particleSG.getMinOccurs() > 0;
  }

  protected void handleStartOfChildElement(Object pUnmarshallerHandler,
                       JavaMethod pJm, ParticleSG pParticle) {
    ObjectSG oSG = pParticle.getObjectSG();
    TypeSG tSG = oSG.getTypeSG();
    if (tSG.isComplex()) {
      JavaQName elementInterfaceClass = pParticle.getObjectSG().getClassContext().getXMLInterfaceName();
      Object[] o, h;
      if (oSG.getClassContext().isGlobal()) {
        LocalJavaField manager = pJm.newJavaField(JMManager.class);
        manager.addLine("getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(",
            elementInterfaceClass, ".class)");
        o = new Object[]{manager, ".getElementS();"};
        h = new Object[]{manager, ".getHandler();"};
      } else {
        Context context = oSG.getClassContext();
        o = new Object[]{" new ", context.getXMLImplementationName(), "()"};
        h = new Object[]{" new ", context.getXMLHandlerName(), "()"};
      }
      LocalJavaField oField = pJm.newJavaField(Object.class);
      oField.addLine(o);
      LocalJavaField hField = pJm.newJavaField(JMSAXElementParser.class);
      hField.addLine(h);
      XsQName name = oSG.getName();
      pJm.addLine(hField, ".init(", pUnmarshallerHandler, ", ", oField, ", ",
          JavaSource.getQuoted(name.getNamespaceURI()), ", ",
          JavaSource.getQuoted(name.getLocalName()),
      ", ", pUnmarshallerHandler, ".getLevel());");
      pJm.addLine(hField, ".setAttributes(", getParamAttrs(), ");");
View Full Code Here

      return;
    }
    for (int i = pFrom;  i <= pTo;  i++) {
      ParticleSG particle = particles[i];
      if (particle.isElement()) {
        ObjectSG oSG = particle.getObjectSG();
        XsQName name = oSG.getName();
        Object uriCondition;
        if ("".equals(name.getNamespaceURI())) {
          uriCondition = new Object[]{"(", getParamNamespaceURI(),
              " == null  ||  ",
              getParamNamespaceURI(),
View Full Code Here

  }

  private void handleEndElementState(JavaMethod pJm, LocalJavaField pElement,
                     ParticleSG pParticle) throws SAXException {
    if (pParticle.isElement()) {
      ObjectSG oSG = pParticle.getObjectSG();
      TypeSG childType = oSG.getTypeSG();
      XsQName name = oSG.getName();
      Object[] uriCondition;
      if ("".equals(name.getNamespaceURI())) {
        uriCondition = new Object[]{
          getParamNamespaceURI(), " == null  ||  ",
          getParamNamespaceURI(), ".length() == 0"
        };
      } else {
        uriCondition = new Object[]{
          JavaSource.getQuoted(name.getNamespaceURI()), ".equals(",
          getParamNamespaceURI(), ")"
        };
      }
      pJm.addIf(uriCondition, "  &&  ", JavaSource.getQuoted(name.getLocalName()),
          ".equals(", getParamLocalName(), ")");
      JavaQName type;
      TypedValue v = getParamResult();
      if (childType.isComplex()) {
        type = childType.getComplexTypeSG().getClassContext().getXMLInterfaceName();
      } else {
        v = createSimpleTypeConversion(pJm, childType, v, oSG.getName().toString());
        type = null;
      }
      pParticle.getPropertySG().addValue(pJm, pElement, v, type);
      pJm.addLine("return;");
      pJm.addEndIf();
View Full Code Here

        if (groupSG == null) {
          throw new IllegalStateException("GroupSG not created");
        }
        groups.add(groupSG);
      } else if (o instanceof XSElement) {
        ObjectSG objectSG = pController.getElement(((XSElement) o).getName());
        if (objectSG == null) {
          throw new IllegalStateException("ObjectSG not created");
        }
        objects.add(objectSG);
        elements.add(objectSG);
View Full Code Here

  public ObjectSG[] getObjects(SchemaSG pController) throws SAXException {
    return objectsByOrder;
  }

  public ObjectSG getElement(SchemaSG pController, XsQName pName) throws SAXException {
    ObjectSG objectSG = (ObjectSG) elementsByName.get(pName);
    if (objectSG != null) {
      return objectSG;
    }
    XSElement element = getXSSchema().getElement(pName);
    if (element == null) {
View Full Code Here

    for (Iterator iter = pContextList.iterator();  iter.hasNext()) {
      Object o = iter.next();
      Context ctx, typeCtx;
      if (o instanceof ObjectSG) {
      ObjectSG oSG = (ObjectSG) o;
      ctx = oSG.getClassContext();
      typeCtx = oSG.getTypeSG().getComplexTypeSG().getClassContext();
      } else {
      TypeSG tSG = (TypeSG) o;
      ctx = typeCtx = tSG.getComplexTypeSG().getClassContext();
      }
View Full Code Here

    Set contextSet = new HashSet();
    for (Iterator iter = pContextList.iterator();  iter.hasNext()) {
      Object o = iter.next();
      TypeSG typeSG;
      if (o instanceof ObjectSG) {
        ObjectSG objectSG = ((ObjectSG) o);
        typeSG = objectSG.getTypeSG();
        generateCreateMethod(js, null, objectSG.getClassContext());
        //NB: we don't have to check for duplicate element names since that would violate the XSD spec
      } else if (o instanceof TypeSG) {
        typeSG = (TypeSG) o;
      } else {
        continue;
View Full Code Here

      ParticleSG particle = pParticles[i];
      if (particle.isGroup()) {
        GroupSG group = particle.getGroupSG();
        generateCreateMethods(pJs, group.getParticles(), pName, pContextSet);
      } else if (particle.isElement()) {
        ObjectSG oSG = particle.getObjectSG();
        if (oSG.isGlobal()) {
          continue// Will be generated elsewhere
        }
        TypeSG tSG = oSG.getTypeSG();
        if (tSG.isGlobalType()) {
          continue// Will be generated elsewhere
        }
        generateCreateMethod(pJs, pContextSet, tSG, pName);
      } else if (particle.isWildcard()) {
View Full Code Here

        return chain;
    }

    private Set elementNames = new HashSet();
    public ObjectSG getObjectSG(SGFactory pFactory, XSElement pElement) throws SAXException {
        ObjectSG result = super.getObjectSG(pFactory, pElement);
        if (result.getTypeSG().isComplex()) {
          XsQName elementName = pElement.getName();
          if (!elementNames.contains(elementName)) {
              elementNames.add(elementName);
            // Does the element have an ino:id attribute? If not, create it
            XsQName qName = new XsQName(InoResponseHandler.INO_RESPONSE2_URI, "id", "ino");
            XSType stringType = XSString.getInstance();
            addAttribute(result.getTypeSG(), pElement.getType(), qName, stringType, "inoId");
            // Does the element have an ino:docname attribute? If not, create it
            qName = new XsQName(InoResponseHandler.INO_RESPONSE2_URI, "docname", "ino");
            addAttribute(result.getTypeSG(), pElement.getType(), qName, stringType, "inoDocname");
          }
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.generator.sg.ObjectSG

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.