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

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


      JavaQName xmlHandlerName = pController.getClassContext().getXMLHandlerName();
      JavaSourceFactory jsf = getSchema().getJavaSourceFactory();
      JavaSource js = jsf.newJavaSource(xmlHandlerName, JavaSource.PUBLIC);
      js.addImplements(JMHandler.class);
      if (myTypeSG.isGlobalClass()) {
        Context typeContext = myTypeSG.getComplexTypeSG().getClassContext();
        js.addExtends(typeContext.getXMLHandlerName());
        JavaQName xmlElementInterface = pController.getClassContext().getXMLInterfaceName();
        JavaQName resultInterface = typeContext.getXMLInterfaceName();
        JavaMethod jm = js.newJavaMethod("newResult", resultInterface, JavaSource.PROTECTED);
        jm.addThrows(SAXException.class);
        jm.addTry();
        jm.addLine("return (", resultInterface, ") getData().getFactory().getElement(",
                   xmlElementInterface, ".class);");
View Full Code Here


        pFactory = jm.addParam(JAXBContextImpl.class, "pFactory");
        jm.addLine("super.init(", pFactory, ");");
        jm.addThrows(JAXBException.class);
      }
      String serializerName = getXMLSerializersFieldName(particle.getPropertySG());
      Context myClassContext = child.getTypeSG().getComplexTypeSG().getClassContext();
      JavaQName serializerClass = myClassContext.getXMLSerializerName();
      JavaField jf = pSource.newJavaField(serializerName, serializerClass, JavaSource.PRIVATE);
      JavaQName elementInterface = myClassContext.getXMLInterfaceName();
      if (child.getTypeSG().isGlobalClass()) {
        jm.addLine(jf, " = (", serializerClass, ") ", pFactory, ".getJMXmlSerializer(", elementInterface, ".class);");
      } else {
        jm.addLine(jf, " = new ", serializerClass, "();");
      }
View Full Code Here

      isClassGlobal = !type.isSimple()  &&  (type.isGlobal()  ||  element.isGlobal());
    } else {
      throw new IllegalStateException("Unknown object type: " + pObject.getClass().getName());
    }

    Context myClassContext;
    final boolean useTypesContext = pClassContext != null;
    if (useTypesContext) {
      myClassContext = pClassContext;
    } else {
      myClassContext = new GlobalContext(name, pObject, null, null, pSchema);
    }

    if (isClassGlobal) {
      if (type.isGlobal()) {
        typeSG = pFactory.getTypeSG(type);
      } else {
        typeSG = pFactory.getTypeSG(type, name);
      }
    } else {
      typeSG = pFactory.getTypeSG(type, myClassContext, name);
    }

    if (useTypesContext) {
      if (typeSG.isComplex()) {
        classContext = typeSG.getComplexTypeSG().getClassContext();
      } else {
        classContext = pClassContext;
      }
    } else if (typeSG.isComplex()) {
      classContext = myClassContext;
      Context tctx = typeSG.getComplexTypeSG().getClassContext();
      AbstractContext ctx = (AbstractContext) classContext;
      ctx.setPMName(tctx.getPMName());
      ctx.setXMLSerializerName(tctx.getXMLSerializerName());
      ctx.setXMLValidatorName(tctx.getXMLValidatorName());
    } else {
      classContext = null;
    }
    log.finest(mName, "<-", new Object[]{typeSG, classContext});
  }
View Full Code Here

      JavaQName xmlHandlerName = pController.getClassContext().getXMLHandlerName();
      JavaSourceFactory jsf = getSchema().getJavaSourceFactory();
      JavaSource js = jsf.newJavaSource(xmlHandlerName, JavaSource.PUBLIC);
      js.addImplements(JMHandler.class);
      if (myTypeSG.isGlobalClass()) {
        Context typeContext = myTypeSG.getComplexTypeSG().getClassContext();
        js.addExtends(typeContext.getXMLHandlerName());
        JavaQName xmlElementInterface = pController.getClassContext().getXMLInterfaceName();
        JavaQName resultInterface = typeContext.getXMLInterfaceName();
        JavaMethod jm = js.newJavaMethod("newResult", resultInterface, JavaSource.PROTECTED);
        jm.addThrows(SAXException.class);
        jm.addTry();
        jm.addLine("return (", resultInterface, ") getData().getFactory().getElement(",
                   xmlElementInterface, ".class);");
View Full Code Here

      isClassGlobal = !type.isSimple()  &&  (type.isGlobal()  ||  global);
    } else {
      throw new IllegalStateException("Unknown object type: " + pObject.getClass().getName());
    }

    Context myClassContext;
    final boolean useTypesContext = pClassContext != null;
    if (useTypesContext) {
      myClassContext = pClassContext;
    } else {
      XSObject contextObject = pObject;
      if (pObject instanceof XSElement) {
        XSElement element = (XSElement) pObject;
        if (element.isReference()) {
          contextObject = pObject.getXSSchema().getElement(name);
        }
      }
      myClassContext = new GlobalContext(name, contextObject, null, null, pSchema);
    }

    final JAXBProperty.BaseType baseType;
    if (pObject instanceof JAXBPropertyOwner) {
      JAXBProperty property = ((JAXBPropertyOwner) pObject).getJAXBProperty();
      baseType = property == null ? null : property.getBaseType();
    } else {
      baseType = null;
    }
   
    if (isClassGlobal) {
      if (type.isGlobal()) {
        typeSG = pFactory.getTypeSG(type, baseType);
      } else {
        typeSG = pFactory.getTypeSG(type, myClassContext.getName(), baseType);
      }
    } else {
      typeSG = pFactory.getTypeSG(type, myClassContext, name, baseType);
    }

    if (useTypesContext) {
      if (typeSG.isComplex()) {
        classContext = typeSG.getComplexTypeSG().getClassContext();
      } else {
        classContext = pClassContext;
      }
    } else if (typeSG.isComplex()) {
      classContext = myClassContext;
      Context tctx = typeSG.getComplexTypeSG().getClassContext();
      AbstractContext ctx = (AbstractContext) classContext;
      ctx.setPMName(tctx.getPMName());
      ctx.setXMLSerializerName(tctx.getXMLSerializerName());
      ctx.setXMLValidatorName(tctx.getXMLValidatorName());
    } else {
      classContext = null;
    }
    log.finest(mName, "<-", new Object[]{typeSG, classContext});
  }
View Full Code Here

        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);
View Full Code Here


    Set packages = new HashSet();
    for (Iterator iter = contextList.iterator();  iter.hasNext()) {
      Object o = iter.next();
      Context ctx;
      if (o instanceof ObjectSG) {
        ctx = ((ObjectSG) o).getClassContext();
      } else {
        ctx = ((TypeSG) o).getComplexTypeSG().getClassContext();
      }
      String packageName = ctx.getXMLInterfaceName().getPackageName();
      if (packages.contains(packageName)) {
        continue;
      }

      TextFile textFile = pController.getJavaSourceFactory().newTextFile(packageName, "jaxb.properties");
View Full Code Here

        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);
View Full Code Here

    root.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns", uri);
    doc.appendChild(root);

    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();
      }

      String packageName = ctx.getXMLInterfaceName().getPackageName();
      if (packageName == null) {
        packageName = "";
      }
      if (!packageName.equals(pPackageName)) {
        continue;
      }

      Element manager = doc.createElementNS(uri, "Manager");
      root.appendChild(manager);
      manager.setAttributeNS(null, "elementInterface", ctx.getXMLInterfaceName().toString());
      manager.setAttributeNS(null, "elementClass", ctx.getXMLImplementationName().toString());
      manager.setAttributeNS(null, "handlerClass", typeCtx.getXMLHandlerName().toString());
      manager.setAttributeNS(null, "driverClass", typeCtx.getXMLSerializerName().toString());
      manager.setAttributeNS(null, "validatorClass", ctx.getXMLValidatorName().toString());
      if (o instanceof ObjectSG) {
      XsQName name = ((ObjectSG) o).getName();
      manager.setAttributeNS(null, "qName", name.toString());
      if (name.getPrefix() != null) {
        manager.setAttributeNS(null, "prefix", name.getPrefix());
View Full Code Here

TOP

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

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.