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

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


        final TypeSG typeSG = objectSG.getTypeSG();
        if (typeSG.isComplex()) {
          final CustomTableData customTableData = (CustomTableData) typeSG.getProperty(jdbcSG.getKey());
          if (customTableData != null) {
            Element manager = (Element) node;
            final Context ctx = typeSG.getComplexTypeSG().getClassContext();
            manager.setAttributeNS(uri, "pmClass", ctx.getPMName().toString());

            final TableDetails tableDetails = customTableData.getTableDetails();
            final String driver = tableDetails.getDriver();
            if (driver != null) {
              createProperty(manager, "jdbc.driver", driver);
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

    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;
      if (o instanceof ObjectSG) {
        ctx = ((ObjectSG) o).getClassContext();
      } else {
        ctx = ((TypeSG) o).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", ctx.getXMLHandlerName().toString());
      manager.setAttributeNS(null, "marshallerClass", ctx.getXMLSerializerName().toString());
      manager.setAttributeNS(null, "validatorClass", ctx.getXMLValidatorName().toString());
      if (o instanceof ObjectSG) {
        manager.setAttributeNS(null, "qName", ((ObjectSG) o).getName().toString());
      }
    }
    return doc;
View Full Code Here


    Map packages = new HashMap();
    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.containsKey(packageName)) {
        continue;
      }

      TextFile textFile = pController.getJavaSourceFactory().newTextFile(packageName, "jaxb.properties");
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

        final TypeSG typeSG = objectSG.getTypeSG();
        if (typeSG.isComplex()) {
          final CustomTableData customTableData = (CustomTableData) typeSG.getProperty(jdbcSG.getKey());
          if (customTableData != null) {
            Element manager = (Element) node;
            final Context ctx = typeSG.getComplexTypeSG().getClassContext();
            manager.setAttributeNS(uri, "pmClass", ctx.getPMName().toString());

            final TableDetails tableDetails = customTableData.getTableDetails();
            final String driver = tableDetails.getDriver();
            if (driver != null) {
              createProperty(manager, "jdbc.driver", driver);
View Full Code Here

      f.setStatic(true);
      f.setFinal(true);
      f.addLine("new ", QName.class, "(", JavaSource.getQuoted(objectSG.getName().getNamespaceURI()),
                ", ", JavaSource.getQuoted(objectSG.getName().getLocalName()), ");");
      if (objectSG.getTypeSG().isComplex()) {
          Context myClassContext =
              child.getObjectSG().getTypeSG().getComplexTypeSG().getClassContext();
          JavaQName serializerClass = myClassContext.getXMLSerializerName();
          pMethod.addIf(fieldName + " == null");
          pMethod.addTry();
          if (child.getObjectSG().getTypeSG().isGlobalClass()) {
              JavaQName elementInterface;
              if (objectSG.isGlobal()) {
                elementInterface = objectSG.getClassContext().getXMLInterfaceName();
              } else {
                elementInterface = myClassContext.getXMLInterfaceName();
              }
              pMethod.addLine(fieldName + " = ("+ serializerClass+ ") ",
                              "getFactory().getJMXmlSerializer(", elementInterface,
                              ".class);");
        } else {
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

        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();
      pSource.newJavaField(serializerName, serializerClass, JavaSource.PRIVATE);
    }
    return jm;
  }
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.