Package org.apache.ws.jaxme.generator

Examples of org.apache.ws.jaxme.generator.SchemaReader


  }

  public void init(SGFactory pFactory) {
    super.init(pFactory);
    sgFactory = pFactory;
    SchemaReader schemaReader = pFactory.getGenerator().getSchemaReader();
    if (schemaReader instanceof JaxMeSchemaReader) {
      JaxMeSchemaReader jaxmeSchemaReader = (JaxMeSchemaReader) schemaReader;
      jaxmeSchemaReader.addXsObjectCreator(new XsObjectCreator(){
        public XsObject newBean(XsObject pParent, Locator pLocator, XsQName pQName) throws SAXException {
          if (JAXME_JDBC_SCHEMA_URI.equals(pQName.getNamespaceURI())) {
            if ("table".equals(pQName.getLocalName())) {
              return new TableDetails(JaxMeJdbcSG.this, pParent);
            } else if ("connection".equals(pQName.getLocalName())) {
              return new ConnectionDetails(JaxMeJdbcSG.this, pParent);
            } else {
              throw new LocSAXException("Invalid element name: " + pQName, pLocator);
            }
          } else {
            return null;
          }
        }
      });
    } else {
      throw new IllegalStateException("The schema reader " + schemaReader.getClass().getName() +
                                       " is not an instance of " + JaxMeSchemaReader.class.getName());
    }

    String s = schemaReader.getGenerator().getProperty("jdbc.sqlFactory");
    if (s == null) {
      sqlFactory = new SQLFactoryImpl();
    } else {
      Class c;
      try {
View Full Code Here


  public File getTargetDirectory() {
    return targetDirectory;
  }

  public SchemaSG generate(InputSource pSource) throws Exception {
    SchemaReader sr = getSchemaReader();
    sr.setGenerator(this);

    SchemaSG s = sr.parse(pSource);
    s.generate();
    File targetDir = getTargetDirectory();
    s.getJavaSourceFactory().write(targetDir);

    return s;
View Full Code Here

    }
   
    public void init(SGFactory pFactory) {
        super.init(pFactory);
        sgFactory = pFactory;
        SchemaReader schemaReader = pFactory.getGenerator().getSchemaReader();
        if (schemaReader instanceof JaxMeSchemaReader) {
            JaxMeSchemaReader jaxmeSchemaReader = (JaxMeSchemaReader) schemaReader;
            jaxmeSchemaReader.addXsObjectCreator(new XsObjectCreator(){
                public XsObject newBean(XsObject pParent, Locator pLocator, XsQName pQName) throws SAXException {
                    if (pParent instanceof JAXBGlobalBindings) {
                        if (TAMINOAPI4J_SCHEMA_URI.equals(pQName.getNamespaceURI())) {
                            if ("raDetails".equals(pQName.getLocalName())) {
                                if (getRaDetails() != null) {
                                    throw new LocSAXException("An element named " + pQName + " has already been specified.",
                                                      pLocator);
                                }
                                RaDetails details = new RaDetails(pParent);
                                setRaDetails(details);
                                return details;
                            } else {
                                throw new LocSAXException("Invalid element name: " + pQName, pLocator);
                            }
                        }
                    }
                    return null;
                }
            });
        } else {
            throw new IllegalStateException("The schema reader " + schemaReader.getClass().getName() +
                    " is not an instance of " + JaxMeSchemaReader.class.getName());
        }
    }
View Full Code Here

  }

  public void init(SGFactory pFactory) {
    super.init(pFactory);
    sgFactory = pFactory;
    SchemaReader schemaReader = pFactory.getGenerator().getSchemaReader();
    if (schemaReader instanceof JaxMeSchemaReader) {
      JaxMeSchemaReader jaxmeSchemaReader = (JaxMeSchemaReader) schemaReader;
      jaxmeSchemaReader.addXsObjectCreator(new XsObjectCreator(){
        public XsObject newBean(XsObject pParent, Locator pLocator, XsQName pQName) throws SAXException {
            if (pParent instanceof XsEAppinfo) {
            if (JAXME_JDBC_SCHEMA_URI.equals(pQName.getNamespaceURI())) {
              if ("table".equals(pQName.getLocalName())) {
                return new TableDetails(JaxMeJdbcSG.this, pParent);
              } else if ("connection".equals(pQName.getLocalName())) {
                return new ConnectionDetails(JaxMeJdbcSG.this, pParent);
              } else {
                throw new LocSAXException("Invalid element name: " + pQName, pLocator);
              }
            }
            }
            return null;
          }
      });
    } else {
      throw new IllegalStateException("The schema reader " + schemaReader.getClass().getName() +
                                       " is not an instance of " + JaxMeSchemaReader.class.getName());
    }

    String s = schemaReader.getGenerator().getProperty("jdbc.sqlFactory");
    if (s == null) {
      sqlFactory = new SQLFactoryImpl();
    } else {
      Class c;
      try {
View Full Code Here

  }

  public void init(SGFactory pFactory) {
    super.init(pFactory);
    sgFactory = pFactory;
    SchemaReader schemaReader = pFactory.getGenerator().getSchemaReader();
    if (schemaReader instanceof JaxMeSchemaReader) {
      JaxMeSchemaReader jaxmeSchemaReader = (JaxMeSchemaReader) schemaReader;
      jaxmeSchemaReader.addXsObjectCreator(new XsObjectCreator(){
        public XsObject newBean(XsObject pParent, Locator pLocator, XsQName pQName) throws SAXException {
            if (pParent instanceof XsEAppinfo) {
            if (JAXME_JDBC_SCHEMA_URI.equals(pQName.getNamespaceURI())) {
              if ("table".equals(pQName.getLocalName())) {
                return new TableDetails(JaxMeJdbcSG.this, pParent);
              } else if ("connection".equals(pQName.getLocalName())) {
                return new ConnectionDetails(JaxMeJdbcSG.this, pParent);
              } else {
                throw new LocSAXException("Invalid element name: " + pQName, pLocator);
              }
            }
            }
            return null;
          }
      });
    } else {
      throw new IllegalStateException("The schema reader " + schemaReader.getClass().getName() +
                                       " is not an instance of " + JaxMeSchemaReader.class.getName());
    }

    String s = schemaReader.getGenerator().getProperty("jdbc.sqlFactory");
    if (s == null) {
      sqlFactory = new SQLFactoryImpl();
    } else {
      Class c;
      try {
View Full Code Here

*/
public class SerializableSG {
    private static final JavaQName SERIALIZABLE_TYPE = JavaQNameImpl.getInstance(Serializable.class);

    public static void makeSerializable(SchemaSG pSchema, JavaSource pSource) {
        SchemaReader sr = pSchema.getFactory().getGenerator().getSchemaReader();
        if (sr instanceof JaxMeSchemaReader) {
            JaxMeSchemaReader jsr = (JaxMeSchemaReader) sr;
            XjcSerializable xjcSerializable = jsr.getXjcSerializable();
            if (xjcSerializable != null) {
                if (!pSource.isImplementing(SERIALIZABLE_TYPE)) {
View Full Code Here

      if (xsAttributes[i] instanceof XSAttribute) {
        XSAttribute attr = (XSAttribute) xsAttributes[i];
        attrChain = (AttributeSGChain) pController.newAttributeSG(attr);
      } else if (xsAttributes[i] instanceof XSWildcard) {
        boolean isSupportingExtensions = false;
        SchemaReader schemaReader = pController.getTypeSG().getFactory().getGenerator().getSchemaReader();
        if (schemaReader instanceof JAXBSchemaReader) {
          isSupportingExtensions = ((JAXBSchemaReader) schemaReader).isSupportingExtensions();
        }
        if (isSupportingExtensions) {
          XSWildcard wildcard = (XSWildcard) xsAttributes[i];
View Full Code Here

      + "      </xs:all>\n"
      + "    </xs:complexType>\n"
      + "  </xs:element>\n"
      + "</xs:schema>\n";
    Generator g = new GeneratorImpl();
    SchemaReader sr = new JAXBSchemaReader();
    g.setSchemaReader(sr);
    sr.setGenerator(g);
    SchemaSG schema = g.getSchemaReader().parse(new InputSource(new StringReader(xsSchema)));
    assertEquals("Element1", JavaNamer.convert("element1", schema));
    assertEquals("Element_1", JavaNamer.convert("element_1", schema));
  }
View Full Code Here

    }

    public void init(SGFactory pFactory) {
        super.init(pFactory);
        sgFactory = pFactory;
        SchemaReader schemaReader = pFactory.getGenerator().getSchemaReader();
        if (schemaReader instanceof JaxMeSchemaReader) {
            JaxMeSchemaReader jaxmeSchemaReader = (JaxMeSchemaReader) schemaReader;
            jaxmeSchemaReader.addXsObjectCreator(new XsObjectCreator(){
                public XsObject newBean(XsObject pParent, Locator pLocator, XsQName pQName) throws SAXException {
                  if (pParent instanceof JAXBGlobalBindings) {
                        if (TAMINOAPI4J_SCHEMA_URI.equals(pQName.getNamespaceURI())) {
                            if ("raDetails".equals(pQName.getLocalName())) {
                                if (getRaDetails() != null) {
                                    throw new LocSAXException("An element named " + pQName + " has already been specified.",
                                                      pLocator);
                                }
                                if (getDbDetails() != null) {
                                    throw new LocSAXException("The elements dbDetails and raDetails are mutually exclusive.",
                                                      pLocator);
                                }
                                RaDetails details = new RaDetails(pParent);
                                setRaDetails(details);
                                return details;
                            } else if ("dbDetails".equals(pQName.getLocalName())) {
                              if (getDbDetails() != null) {
                                throw new LocSAXException("An element named " + pQName + " has already been specified.",
                                    pLocator);
                              }
                              if (getRaDetails() != null) {
                                    throw new LocSAXException("The elements dbDetails and raDetails are mutually exclusive.",
                                                      pLocator);
                                }
                              DbDetails details = new DbDetails(pParent);
                              setDbDetails(details);
                              return details;
                            } else {
                                throw new LocSAXException("Invalid element name: " + pQName, pLocator);
                            }
                        }
                    }
                    return null;
                }
            });
        } else {
            throw new IllegalStateException("The schema reader " + schemaReader.getClass().getName() +
                    " is not an instance of " + JaxMeSchemaReader.class.getName());
        }
    }
View Full Code Here

  public File getResourceTargetDirectory() {
    return resourceTargetDirectory;
  }

  public SchemaSG generate(InputSource pSource) throws Exception {
    SchemaReader sr = getSchemaReader();
    sr.setGenerator(this);
   
    SchemaSG s = sr.parse(pSource);
    s.generate();
    File targetDir = getTargetDirectory();
    File resourceTargetDir = getResourceTargetDirectory();
    if (resourceTargetDir == null) {
      resourceTargetDir = targetDir;
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.generator.SchemaReader

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.