com.sun.tools.internal.xjc.util.ErrorReceiverFilter Java Examples

The following examples show how to use com.sun.tools.internal.xjc.util.ErrorReceiverFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BGMBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #2
Source File: BGMBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #3
Source File: DOMForest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks the correctness of the XML Schema documents and return true
 * if it's OK.
 *
 * <p>
 * This method performs a weaker version of the tests where error messages
 * are provided without line number information. So whenever possible
 * use {@link SchemaConstraintChecker}.
 *
 * @see SchemaConstraintChecker
 */
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
    try {
        boolean disableXmlSecurity = false;
        if (options != null) {
            disableXmlSecurity = options.disableXmlSecurity;
        }
        SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
        ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
        sf.setErrorHandler(filter);
        Set<String> roots = getRootDocuments();
        Source[] sources = new Source[roots.size()];
        int i=0;
        for (String root : roots) {
            sources[i++] = new DOMSource(get(root),root);
        }
        sf.newSchema(sources);
        return !filter.hadError();
    } catch (SAXException e) {
        // the errors should have been reported
        return false;
    }
}
 
Example #4
Source File: DOMForest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks the correctness of the XML Schema documents and return true
 * if it's OK.
 *
 * <p>
 * This method performs a weaker version of the tests where error messages
 * are provided without line number information. So whenever possible
 * use {@link SchemaConstraintChecker}.
 *
 * @see SchemaConstraintChecker
 */
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
    try {
        boolean disableXmlSecurity = false;
        if (options != null) {
            disableXmlSecurity = options.disableXmlSecurity;
        }
        SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
        ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
        sf.setErrorHandler(filter);
        Set<String> roots = getRootDocuments();
        Source[] sources = new Source[roots.size()];
        int i=0;
        for (String root : roots) {
            sources[i++] = new DOMSource(get(root),root);
        }
        sf.newSchema(sources);
        return !filter.hadError();
    } catch (SAXException e) {
        // the errors should have been reported
        return false;
    }
}
 
Example #5
Source File: BGMBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #6
Source File: BGMBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #7
Source File: DOMForest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks the correctness of the XML Schema documents and return true
 * if it's OK.
 *
 * <p>
 * This method performs a weaker version of the tests where error messages
 * are provided without line number information. So whenever possible
 * use {@link SchemaConstraintChecker}.
 *
 * @see SchemaConstraintChecker
 */
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
    try {
        boolean disableXmlSecurity = false;
        if (options != null) {
            disableXmlSecurity = options.disableXmlSecurity;
        }
        SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
        ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
        sf.setErrorHandler(filter);
        Set<String> roots = getRootDocuments();
        Source[] sources = new Source[roots.size()];
        int i=0;
        for (String root : roots) {
            sources[i++] = new DOMSource(get(root),root);
        }
        sf.newSchema(sources);
        return !filter.hadError();
    } catch (SAXException e) {
        // the errors should have been reported
        return false;
    }
}
 
Example #8
Source File: DOMForest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks the correctness of the XML Schema documents and return true
 * if it's OK.
 *
 * <p>
 * This method performs a weaker version of the tests where error messages
 * are provided without line number information. So whenever possible
 * use {@link SchemaConstraintChecker}.
 *
 * @see SchemaConstraintChecker
 */
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
    try {
        boolean disableXmlSecurity = false;
        if (options != null) {
            disableXmlSecurity = options.disableXmlSecurity;
        }
        SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
        ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
        sf.setErrorHandler(filter);
        Set<String> roots = getRootDocuments();
        Source[] sources = new Source[roots.size()];
        int i=0;
        for (String root : roots) {
            sources[i++] = new DOMSource(get(root),root);
        }
        sf.newSchema(sources);
        return !filter.hadError();
    } catch (SAXException e) {
        // the errors should have been reported
        return false;
    }
}
 
Example #9
Source File: BGMBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #10
Source File: DOMForest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks the correctness of the XML Schema documents and return true
 * if it's OK.
 *
 * <p>
 * This method performs a weaker version of the tests where error messages
 * are provided without line number information. So whenever possible
 * use {@link SchemaConstraintChecker}.
 *
 * @see SchemaConstraintChecker
 */
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
    try {
        boolean disableXmlSecurity = false;
        if (options != null) {
            disableXmlSecurity = options.disableXmlSecurity;
        }
        SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
        ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
        sf.setErrorHandler(filter);
        Set<String> roots = getRootDocuments();
        Source[] sources = new Source[roots.size()];
        int i=0;
        for (String root : roots) {
            sources[i++] = new DOMSource(get(root),root);
        }
        sf.newSchema(sources);
        return !filter.hadError();
    } catch (SAXException e) {
        // the errors should have been reported
        return false;
    }
}
 
Example #11
Source File: DOMForest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks the correctness of the XML Schema documents and return true
 * if it's OK.
 *
 * <p>
 * This method performs a weaker version of the tests where error messages
 * are provided without line number information. So whenever possible
 * use {@link SchemaConstraintChecker}.
 *
 * @see SchemaConstraintChecker
 */
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
    try {
        boolean disableXmlSecurity = false;
        if (options != null) {
            disableXmlSecurity = options.disableXmlSecurity;
        }
        SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
        ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
        sf.setErrorHandler(filter);
        Set<String> roots = getRootDocuments();
        Source[] sources = new Source[roots.size()];
        int i=0;
        for (String root : roots) {
            sources[i++] = new DOMSource(get(root),root);
        }
        sf.newSchema(sources);
        return !filter.hadError();
    } catch (SAXException e) {
        // the errors should have been reported
        return false;
    }
}
 
Example #12
Source File: BGMBuilder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #13
Source File: BGMBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #14
Source File: DOMForest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks the correctness of the XML Schema documents and return true
 * if it's OK.
 *
 * <p>
 * This method performs a weaker version of the tests where error messages
 * are provided without line number information. So whenever possible
 * use {@link SchemaConstraintChecker}.
 *
 * @see SchemaConstraintChecker
 */
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
    try {
        boolean disableXmlSecurity = false;
        if (options != null) {
            disableXmlSecurity = options.disableXmlSecurity;
        }
        SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
        ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
        sf.setErrorHandler(filter);
        Set<String> roots = getRootDocuments();
        Source[] sources = new Source[roots.size()];
        int i=0;
        for (String root : roots) {
            sources[i++] = new DOMSource(get(root),root);
        }
        sf.newSchema(sources);
        return !filter.hadError();
    } catch (SAXException e) {
        // the errors should have been reported
        return false;
    }
}
 
Example #15
Source File: DOMForest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks the correctness of the XML Schema documents and return true
 * if it's OK.
 *
 * <p>
 * This method performs a weaker version of the tests where error messages
 * are provided without line number information. So whenever possible
 * use {@link SchemaConstraintChecker}.
 *
 * @see SchemaConstraintChecker
 */
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
    try {
        boolean disableXmlSecurity = false;
        if (options != null) {
            disableXmlSecurity = options.disableXmlSecurity;
        }
        SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
        ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
        sf.setErrorHandler(filter);
        Set<String> roots = getRootDocuments();
        Source[] sources = new Source[roots.size()];
        int i=0;
        for (String root : roots) {
            sources[i++] = new DOMSource(get(root),root);
        }
        sf.newSchema(sources);
        return !filter.hadError();
    } catch (SAXException e) {
        // the errors should have been reported
        return false;
    }
}
 
Example #16
Source File: BGMBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #17
Source File: TDTDReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
    throws AbortException {
    this.entityResolver = opts.entityResolver;
    this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
    bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
    classFactory = new CodeModelClassFactory(errorReceiver);
}
 
Example #18
Source File: TDTDReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
    throws AbortException {
    this.entityResolver = opts.entityResolver;
    this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
    bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
    classFactory = new CodeModelClassFactory(errorReceiver);
}
 
Example #19
Source File: TDTDReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
    throws AbortException {
    this.entityResolver = opts.entityResolver;
    this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
    bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
    classFactory = new CodeModelClassFactory(errorReceiver);
}
 
Example #20
Source File: TDTDReader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
    throws AbortException {
    this.entityResolver = opts.entityResolver;
    this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
    bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
    classFactory = new CodeModelClassFactory(errorReceiver);
}
 
Example #21
Source File: TDTDReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
    throws AbortException {
    this.entityResolver = opts.entityResolver;
    this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
    bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
    classFactory = new CodeModelClassFactory(errorReceiver);
}
 
Example #22
Source File: TDTDReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
    throws AbortException {
    this.entityResolver = opts.entityResolver;
    this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
    bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
    classFactory = new CodeModelClassFactory(errorReceiver);
}
 
Example #23
Source File: TDTDReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
    throws AbortException {
    this.entityResolver = opts.entityResolver;
    this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
    bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
    classFactory = new CodeModelClassFactory(errorReceiver);
}
 
Example #24
Source File: TDTDReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
    throws AbortException {
    this.entityResolver = opts.entityResolver;
    this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
    bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
    classFactory = new CodeModelClassFactory(errorReceiver);
}
 
Example #25
Source File: ModelLoader.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public ModelLoader(Options _opt, JCodeModel _codeModel, ErrorReceiver er) {
    this.opt = _opt;
    this.codeModel = _codeModel;
    this.errorReceiver = new ErrorReceiverFilter(er);
}
 
Example #26
Source File: ModelLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public ModelLoader(Options _opt, JCodeModel _codeModel, ErrorReceiver er) {
    this.opt = _opt;
    this.codeModel = _codeModel;
    this.errorReceiver = new ErrorReceiverFilter(er);
}
 
Example #27
Source File: Model.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Fully-generate the source code into the given model.
     *
     * @return
     *      null if there was any errors. Otherwise it returns a valid
     *      {@link Outline} object, which captures how the model objects
     *      are mapped to the generated source code.
     *      <p>
     *      Add-ons can use those information to further augment the generated
     *      source code.
     */
    public Outline generateCode(Options opt,ErrorReceiver receiver) {
        ErrorReceiverFilter ehf = new ErrorReceiverFilter(receiver);

        // run extensions // moved to BGMBuilder._build() - issue with hyperjaxb3
//        for( Plugin ma : opt.activePlugins )
//            ma.postProcessModel(this,ehf);

        Outline o = BeanGenerator.generate(this, ehf);

        try {// run extensions
            for( Plugin ma : opt.activePlugins )
                ma.run(o,opt,ehf);
        } catch (SAXException e) {
            // fatal error. error should have been reported
            return null;
        }

        // check for unused plug-in customizations.
        // these can be only checked after the plug-ins run, so it's here.
        // the JAXB bindings are checked by XMLSchema's builder.
        Set<CCustomizations> check = new HashSet<CCustomizations>();
        for( CCustomizations c=customizations; c!=null; c=c.next ) {
            if(!check.add(c)) {
                throw new AssertionError(); // detect a loop
            }
            for (CPluginCustomization p : c) {
                if(!p.isAcknowledged()) {
                    ehf.error(
                        p.locator,
                        Messages.format(
                            Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION,
                            p.element.getNodeName()
                        ));
                    ehf.error(
                        c.getOwner().getLocator(),
                        Messages.format(
                            Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION_LOCATION));
                }
            }
        }

        if(ehf.hadError())
            o = null;
        return o;
    }
 
Example #28
Source File: Model.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Fully-generate the source code into the given model.
     *
     * @return
     *      null if there was any errors. Otherwise it returns a valid
     *      {@link Outline} object, which captures how the model objects
     *      are mapped to the generated source code.
     *      <p>
     *      Add-ons can use those information to further augment the generated
     *      source code.
     */
    public Outline generateCode(Options opt,ErrorReceiver receiver) {
        ErrorReceiverFilter ehf = new ErrorReceiverFilter(receiver);

        // run extensions // moved to BGMBuilder._build() - issue with hyperjaxb3
//        for( Plugin ma : opt.activePlugins )
//            ma.postProcessModel(this,ehf);

        Outline o = BeanGenerator.generate(this, ehf);

        try {// run extensions
            for( Plugin ma : opt.activePlugins )
                ma.run(o,opt,ehf);
        } catch (SAXException e) {
            // fatal error. error should have been reported
            return null;
        }

        // check for unused plug-in customizations.
        // these can be only checked after the plug-ins run, so it's here.
        // the JAXB bindings are checked by XMLSchema's builder.
        Set<CCustomizations> check = new HashSet<CCustomizations>();
        for( CCustomizations c=customizations; c!=null; c=c.next ) {
            if(!check.add(c)) {
                throw new AssertionError(); // detect a loop
            }
            for (CPluginCustomization p : c) {
                if(!p.isAcknowledged()) {
                    ehf.error(
                        p.locator,
                        Messages.format(
                            Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION,
                            p.element.getNodeName()
                        ));
                    ehf.error(
                        c.getOwner().getLocator(),
                        Messages.format(
                            Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION_LOCATION));
                }
            }
        }

        if(ehf.hadError())
            o = null;
        return o;
    }
 
Example #29
Source File: ModelLoader.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public ModelLoader(Options _opt, JCodeModel _codeModel, ErrorReceiver er) {
    this.opt = _opt;
    this.codeModel = _codeModel;
    this.errorReceiver = new ErrorReceiverFilter(er);
}
 
Example #30
Source File: ModelLoader.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public ModelLoader(Options _opt, JCodeModel _codeModel, ErrorReceiver er) {
    this.opt = _opt;
    this.codeModel = _codeModel;
    this.errorReceiver = new ErrorReceiverFilter(er);
}