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

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


      "  <xs:simpleType name='c'>\n" +
      "    <xs:union memberTypes='a b'/>\n" +
      "  </xs:simpleType>\n" +
      "</xs:schema>\n";

    SchemaSG schemaSG = parse(schema, "testSimpleTypes.xsd");

    TypeSG[] st = schemaSG.getTypes();
    assertEquals(3, st.length);

    TypeSG st1 = st[0];
    assertTrue(!st1.isComplex());
    SimpleTypeSG sst1 = st1.getSimpleTypeSG();
View Full Code Here


      "    <xs:attribute ref='b'/>\n" +
      "    <xs:attribute name='c' type='xs:int'/>\n" +
      "  </xs:complexType>\n" +
      "</xs:schema>\n";

    SchemaSG jschema = parse(schema, "testAttributes.xsd");

    TypeSG[] types = jschema.getTypes();
    assertEquals(1, types.length);
    assertTrue(types[0].isComplex());

    AttributeSG[] attr = types[0].getComplexTypeSG().getAttributes();
    assertEquals(3, attr.length);
View Full Code Here

      "      <xs:attributeGroup ref='f'/>\n" +
      "    </xs:complexType>\n" +
      "  </xs:element>\n" +
      "</xs:schema>\n";

    SchemaSG jschema = parse(schema, "testAttributeGroups.xsd");

    ObjectSG[] elements = jschema.getElements();
    assertNotNull(elements);
    assertEquals(2, elements.length);

    ObjectSG ea = elements[0];
    assertTrue(ea.getTypeSG().isComplex());
View Full Code Here

      "    </xs:complexType>\n" +
      "  </xs:element>\n" +
      "</xs:schema>\n";

    System.err.println("testElements: ->");
    SchemaSG jschema = parse(schema, "testElements.xsd");

    ObjectSG[] elements = jschema.getElements();
    assertEquals(4, elements.length);

    ObjectSG e1 = elements[0];
    assertEquals(new XsQName((String) null, "a"), e1.getName());
    TypeSG t1 = e1.getTypeSG();
View Full Code Here

      "    </xs:restriction>\n" +
      "  </xs:simpleType>\n" +
      "  <xs:element name='a' type='USState'/>\n" +
      "</xs:schema>\n";
   
    SchemaSG jschema = parse(schema, "testFacets.xsd");

    ObjectSG[] elements = jschema.getElements();
    assertEquals(1, elements.length);
    ObjectSG se1 = elements[0];
    assertEquals(new XsQName((String) null, "a"), se1.getName());
    assertTrue(!se1.getTypeSG().isComplex());
    SimpleTypeSG sst1 = se1.getTypeSG().getSimpleTypeSG();
View Full Code Here

    // settings.
    final String schema =
      "<?xml version='1.0'?>\n" +
      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'/>\n";
   
    SchemaSG jschema = parse(schema, "testGlobalBindingsDefaults.xsd");

    String collectionType = jschema.getCollectionType();
    assertEquals(ArrayList.class.getName(), collectionType);
    JAXBJavaType[] javaTypes = jschema.getJAXBJavaTypes();
    assertNotNull(javaTypes);
    assertEquals(0, javaTypes.length);
    XsQName[] typesafeEnumBase = jschema.getTypesafeEnumBase();
    assertNotNull(typesafeEnumBase);
    assertEquals(1, typesafeEnumBase.length);
    assertEquals(new XsQName(XSParser.XML_SCHEMA_URI, "NCName"), typesafeEnumBase[0]);
    boolean isBindingStyleModelGroup = jschema.isBindingStyleModelGroup();
    assertTrue(!isBindingStyleModelGroup);
    boolean choiceContentProperty = jschema.isChoiceContentProperty();
    assertTrue(!choiceContentProperty);
    boolean enableFailFastCheck = jschema.isFailFastCheckEnabled();
    assertTrue(!enableFailFastCheck);
    boolean isJavaNamingConventionsEnabled = jschema.isJavaNamingConventionsEnabled();
    assertTrue(isJavaNamingConventionsEnabled);
    boolean isFixedAttributeConstantProperty = jschema.isFixedAttributeConstantProperty();
    assertTrue(!isFixedAttributeConstantProperty);
    boolean generatingIsSetMethod = jschema.isGeneratingIsSetMethod();
    assertTrue(!generatingIsSetMethod);
    boolean underscoreWordSeparator = jschema.isUnderscoreWordSeparator();
    assertTrue(underscoreWordSeparator);
  }
View Full Code Here

      "          underscoreBinding='asCharInWord'/>\n" +
      "    </xs:appinfo\n>" +
      "  </xs:annotation>\n" +
      "</xs:schema>";
   
    SchemaSG jschema = parse(schema, "testGlobalBindingsDefaults.xsd");

    String collectionType = jschema.getCollectionType();
    assertEquals("indexed", collectionType);
    XsQName[] typesafeEnumBase = jschema.getTypesafeEnumBase();
    assertNotNull(typesafeEnumBase);
    assertEquals(2, typesafeEnumBase.length);
    assertEquals(new XsQName(XSParser.XML_SCHEMA_URI, "String"), typesafeEnumBase[0]);
    assertEquals(new XsQName(XSParser.XML_SCHEMA_URI, "NCName"), typesafeEnumBase[1]);

    boolean isBindingStyleModelGroup = jschema.isBindingStyleModelGroup();
    assertTrue(isBindingStyleModelGroup);

    boolean isChoiceContentProperty = jschema.isChoiceContentProperty();
    assertTrue(isChoiceContentProperty);

    boolean enableFailFastCheck = jschema.isFailFastCheckEnabled();
    assertTrue(enableFailFastCheck);

    boolean isJavaNamingConventionsEnabled = jschema.isJavaNamingConventionsEnabled();
    assertTrue(!isJavaNamingConventionsEnabled);

    boolean fixedAttributeConstantProperty = jschema.isFixedAttributeConstantProperty();
    assertTrue(fixedAttributeConstantProperty);

    boolean generatingIsSetMethod = jschema.isGeneratingIsSetMethod();
    assertTrue(generatingIsSetMethod);

    boolean isUnderscoreWordSeparator = jschema.isUnderscoreWordSeparator();
    assertTrue(!isUnderscoreWordSeparator);

    JAXBJavaType[] javaTypes = jschema.getJAXBJavaTypes();
    assertNotNull(javaTypes);
    assertEquals(0, javaTypes.length);
  }
View Full Code Here

  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;
    }
    JavaSourceFactory jsf = s.getJavaSourceFactory();
    for (Iterator iter = jsf.getJavaSources();  iter.hasNext()) {
      ((JavaSource) iter.next()).setForcingFullyQualifiedName(true);
    }
    s.getJavaSourceFactory().write(targetDir, resourceTargetDir);
   
    return s;
  }
View Full Code Here

      throw new java.io.FileNotFoundException("Not a file: " + path);
    }
   
    InputSource isource = new InputSource(new FileInputStream(pFile));
    isource.setSystemId(pFile.toURL().toString());
    SchemaSG s = generate(isource);
    log.finer(mName, "<-", s);
    return s;
  }
View Full Code Here

    log.entering(mName, pURL);
    java.net.URLConnection conn = pURL.openConnection();
   
    InputSource isource = new InputSource(conn.getInputStream());
    isource.setSystemId(pURL.toString());
    SchemaSG s = generate(isource);
    log.exiting(mName, s);
    return s;
  }
View Full Code Here

TOP

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

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.