Package org.jibx.schema.codegen.custom

Examples of org.jibx.schema.codegen.custom.SchemasetCustom


        testGeneration(custom, schemas, OTA_PROFILETYPE_SIMPLIFIED_DATA_B, OTA_PROFILETYPE_SIMPLIFIED_BINDINGS_B);
    }
   
    public void testTypeReplacementGeneration() throws Exception {
        SchemaElement[] schemas = new SchemaElement[] { loadSchema(CodegenData.RESOLVER1) };
        SchemasetCustom custom = loadCustomization(CodegenData.CUSTOMIZATION1_B);
        testGeneration(custom, schemas, TYPE_REPLACEMENT_GENERATION_DATA, TYPE_REPLACEMENT_GENERATION_BINDINGS);
    }
View Full Code Here


        testGeneration(custom, schemas, TYPE_REPLACEMENT_GENERATION_DATA, TYPE_REPLACEMENT_GENERATION_BINDINGS);
    }
   
    public void testCombinedRemovalReplacementGeneration() throws Exception {
        SchemaElement[] schemas = new SchemaElement[] { loadSchema(CodegenData.RESOLVER2) };
        SchemasetCustom custom = loadCustomization(CodegenData.CUSTOMIZATION2_B);
        testGeneration(custom, schemas, COMBINED_REMOVAL_REPLACEMENT_GENERATION_DATA,
            COMBINED_REMOVAL_REPLACEMENT_GENERATION_BINDINGS);
    }
View Full Code Here

     * @param text customizations document text
     * @return loaded customization
     * @throws Exception
     */
    protected SchemasetCustom loadCustomization(String text) throws Exception {
        SchemasetCustom custom = new SchemasetCustom((SchemasetCustom)null);
        IBindingFactory fact = BindingDirectory.getFactory("xsdcodegen_customs_binding",
            "org.jibx.schema.codegen.custom");
        IUnmarshallingContext ictx = fact.createUnmarshallingContext();
        ictx.setDocument(new StringReader(text));
        ictx.setUserContext(m_validationContext);
View Full Code Here

     */
    protected boolean loadCustomizations(String path) throws JiBXException, IOException {
       
        // load customizations and check for errors
        ValidationContext vctx = new ValidationContext();
        m_customRoot = new SchemasetCustom((SchemasetCustom)null);
        if (path != null) {
            IBindingFactory fact = BindingDirectory.getFactory(SchemasetCustom.class);
            IUnmarshallingContext ictx = fact.createUnmarshallingContext();
            FileInputStream is = new FileInputStream(path);
            ictx.setDocument(is, null);
View Full Code Here

     * @param custom schema set customization
     * @return owning schemaset, <code>null</code> if none
     */
    public SchemasetCustom findSchemaset(SchemaElement schema, SchemasetCustom custom) {
        LazyList childs = custom.getChildren();
        SchemasetCustom owner = null;
        String name = schema.getResolver().getName();
        for (int i = 0; i < childs.size(); i++) {
            Object child = childs.get(i);
            if (child instanceof SchemasetCustom) {
                SchemasetCustom schemaset = (SchemasetCustom)child;
                if (schemaset.isInSet(name, schema)) {
                    SchemasetCustom match = findSchemaset(schema, schemaset);
                    if (match != null) {
                        if (owner == null) {
                            owner = match;
                        } else {
                            m_validationContext.addError("schema-set overlap on schema " + name + " (first match "
View Full Code Here

        int count = 0;
        for (Iterator iter = m_validationContext.iterateSchemas(); iter.hasNext();) {
            SchemaElement schema = (SchemaElement)iter.next();
            ISchemaResolver resolver = schema.getResolver();
            s_logger.debug("Assigning customization for schema " + ++count + ": " + resolver.getName());
            SchemasetCustom owner = findSchemaset(schema, m_global);
            SchemaCustom custom = owner.forceCustomization(resolver.getName(), resolver.getId(), schema,
                m_validationContext);
            custom.validate(m_validationContext);
            String pname = custom.getPackage();
            PackageHolder holder = null;
            if (pname == null) {
View Full Code Here

     * @throws Exception
     */
    private void testSimplification(TestResolver resolver, String custom, String inclname, String rslttext)
        throws Exception {
        SchemaElement[] schemas = new SchemaElement[] { loadSchema(resolver) };
        SchemasetCustom custroot;
        if (custom == null) {
            custroot = new SchemasetCustom((SchemasetCustom)null);
        } else {
            custroot = loadCustomization(custom);
        }
        CodeGen generator = new CodeGen(custroot, m_validationContext);
        ProblemHandler handler = new ProblemConsoleLister();
View Full Code Here

            codegen.setFileset(resolvers);

            // Set Customization
            String[] bindingFiles = (String[])context.get(ToolConstants.CFG_BINDING);
            SchemasetCustom customRoot;
            if (bindingFiles == null || bindingFiles.length == 0) {
                customRoot = defaultSchemasetCustom(schemaMap);
            } else {
                customRoot = SchemasetCustom.loadCustomizations(bindingFiles[0], handler);
            }
View Full Code Here

        return null;
    }

    @SuppressWarnings("unchecked")
    private SchemasetCustom defaultSchemasetCustom(Map<String, Element> smap) {
        SchemasetCustom customRoot = new SchemasetCustom((SchemasetCustom)null);
        Set<String> schemaIds = smap.keySet();
        for (String schemaId : schemaIds) {
            SchemaCustom schemaCustom = new SchemaCustom(customRoot);
            schemaCustom.setName(schemaId);
            schemaCustom.setForceTypes(Boolean.TRUE);
            schemaCustom.setNamespace(smap.get(schemaId).getAttribute("targetNamespace"));
            customRoot.getChildren().add(schemaCustom);
        }
        for (JibxSchemaResolver r : resolvers) {
            if (!schemaIds.contains(r.getId())) {
                SchemaCustom schemaCustom = new SchemaCustom(customRoot);
                schemaCustom.setName(r.getName());
                schemaCustom.setNamespace(r.getElement().getAttribute("targetNamespace"));
                schemaCustom.setForceTypes(Boolean.TRUE);
                customRoot.getChildren().add(schemaCustom);
            }
        }
        return customRoot;
    }
View Full Code Here

            codegen.setFileset(resolvers);

            // Set Customization
            String[] bindingFiles = (String[])context.get(ToolConstants.CFG_BINDING);
            SchemasetCustom customRoot;
            if (bindingFiles == null || bindingFiles.length == 0) {
                customRoot = defaultSchemasetCustom(schemaMap);
            } else {
                customRoot = SchemasetCustom.loadCustomizations(bindingFiles[0], handler);
            }
View Full Code Here

TOP

Related Classes of org.jibx.schema.codegen.custom.SchemasetCustom

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.