com.sun.tools.internal.jxc.gen.config.Config Java Examples

The following examples show how to use com.sun.tools.internal.jxc.gen.config.Config. 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: ConfigReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private SchemaOutputResolver createSchemaOutputResolver(Config config, String xmlpath) {
    File baseDir = new File(xmlpath, config.getBaseDir().getPath());
    SchemaOutputResolverImpl outResolver = new SchemaOutputResolverImpl (baseDir);

    for( Schema schema : (List<Schema>)config.getSchema() ) {
        String namespace = schema.getNamespace();
        File location = schema.getLocation();
        outResolver.addSchemaInfo(namespace,location);
    }
    return outResolver;
}
 
Example #2
Source File: ConfigReader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses an xml config file and returns a Config object.
 *
 * @param xmlFile
 *        The xml config file which is passed by the user to annotation processing
 * @return
 *        A non null Config object
 */
private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler, boolean disableSecureProcessing) throws SAXException, IOException {
    XMLReader reader;
    try {
        SAXParserFactory factory = XmlFactory.createParserFactory(disableSecureProcessing);
        reader = factory.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException e) {
        // in practice this will never happen
        throw new Error(e);
    }
    NGCCRuntimeEx runtime = new NGCCRuntimeEx(errorHandler);

    // set up validator
    ValidatorHandler validator = configSchema.newValidator();
    validator.setErrorHandler(errorHandler);

    // the validator will receive events first, then the parser.
    reader.setContentHandler(new ForkContentHandler(validator,runtime));

    reader.setErrorHandler(errorHandler);
    Config config = new Config(runtime);
    runtime.setRootHandler(config);
    reader.parse(new InputSource(xmlFile.toURL().toExternalForm()));
    runtime.reset();

    return config;
}
 
Example #3
Source File: ConfigReader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private SchemaOutputResolver createSchemaOutputResolver(Config config, String xmlpath) {
    File baseDir = new File(xmlpath, config.getBaseDir().getPath());
    SchemaOutputResolverImpl outResolver = new SchemaOutputResolverImpl (baseDir);

    for( Schema schema : (List<Schema>)config.getSchema() ) {
        String namespace = schema.getNamespace();
        File location = schema.getLocation();
        outResolver.addSchemaInfo(namespace,location);
    }
    return outResolver;
}
 
Example #4
Source File: ConfigReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses an xml config file and returns a Config object.
 *
 * @param xmlFile
 *        The xml config file which is passed by the user to annotation processing
 * @return
 *        A non null Config object
 */
private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler, boolean disableSecureProcessing) throws SAXException, IOException {
    XMLReader reader;
    try {
        SAXParserFactory factory = XmlFactory.createParserFactory(disableSecureProcessing);
        reader = factory.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException e) {
        // in practice this will never happen
        throw new Error(e);
    }
    NGCCRuntimeEx runtime = new NGCCRuntimeEx(errorHandler);

    // set up validator
    ValidatorHandler validator = configSchema.newValidator();
    validator.setErrorHandler(errorHandler);

    // the validator will receive events first, then the parser.
    reader.setContentHandler(new ForkContentHandler(validator,runtime));

    reader.setErrorHandler(errorHandler);
    Config config = new Config(runtime);
    runtime.setRootHandler(config);
    reader.parse(new InputSource(xmlFile.toURL().toExternalForm()));
    runtime.reset();

    return config;
}
 
Example #5
Source File: ConfigReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private SchemaOutputResolver createSchemaOutputResolver(Config config, String xmlpath) {
    File baseDir = new File(xmlpath, config.getBaseDir().getPath());
    SchemaOutputResolverImpl outResolver = new SchemaOutputResolverImpl (baseDir);

    for( Schema schema : (List<Schema>)config.getSchema() ) {
        String namespace = schema.getNamespace();
        File location = schema.getLocation();
        outResolver.addSchemaInfo(namespace,location);
    }
    return outResolver;
}
 
Example #6
Source File: ConfigReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses an xml config file and returns a Config object.
 *
 * @param xmlFile
 *        The xml config file which is passed by the user to annotation processing
 * @return
 *        A non null Config object
 */
private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler, boolean disableSecureProcessing) throws SAXException, IOException {
    XMLReader reader;
    try {
        SAXParserFactory factory = XmlFactory.createParserFactory(disableSecureProcessing);
        reader = factory.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException e) {
        // in practice this will never happen
        throw new Error(e);
    }
    NGCCRuntimeEx runtime = new NGCCRuntimeEx(errorHandler);

    // set up validator
    ValidatorHandler validator = configSchema.newValidator();
    validator.setErrorHandler(errorHandler);

    // the validator will receive events first, then the parser.
    reader.setContentHandler(new ForkContentHandler(validator,runtime));

    reader.setErrorHandler(errorHandler);
    Config config = new Config(runtime);
    runtime.setRootHandler(config);
    reader.parse(new InputSource(xmlFile.toURL().toExternalForm()));
    runtime.reset();

    return config;
}
 
Example #7
Source File: ConfigReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private SchemaOutputResolver createSchemaOutputResolver(Config config, String xmlpath) {
    File baseDir = new File(xmlpath, config.getBaseDir().getPath());
    SchemaOutputResolverImpl outResolver = new SchemaOutputResolverImpl (baseDir);

    for( Schema schema : (List<Schema>)config.getSchema() ) {
        String namespace = schema.getNamespace();
        File location = schema.getLocation();
        outResolver.addSchemaInfo(namespace,location);
    }
    return outResolver;
}
 
Example #8
Source File: ConfigReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses an xml config file and returns a Config object.
 *
 * @param xmlFile
 *        The xml config file which is passed by the user to annotation processing
 * @return
 *        A non null Config object
 */
private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler, boolean disableSecureProcessing) throws SAXException, IOException {
    XMLReader reader;
    try {
        SAXParserFactory factory = XmlFactory.createParserFactory(disableSecureProcessing);
        reader = factory.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException e) {
        // in practice this will never happen
        throw new Error(e);
    }
    NGCCRuntimeEx runtime = new NGCCRuntimeEx(errorHandler);

    // set up validator
    ValidatorHandler validator = configSchema.newValidator();
    validator.setErrorHandler(errorHandler);

    // the validator will receive events first, then the parser.
    reader.setContentHandler(new ForkContentHandler(validator,runtime));

    reader.setErrorHandler(errorHandler);
    Config config = new Config(runtime);
    runtime.setRootHandler(config);
    reader.parse(new InputSource(xmlFile.toURL().toExternalForm()));
    runtime.reset();

    return config;
}
 
Example #9
Source File: ConfigReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private SchemaOutputResolver createSchemaOutputResolver(Config config, String xmlpath) {
    File baseDir = new File(xmlpath, config.getBaseDir().getPath());
    SchemaOutputResolverImpl outResolver = new SchemaOutputResolverImpl (baseDir);

    for( Schema schema : (List<Schema>)config.getSchema() ) {
        String namespace = schema.getNamespace();
        File location = schema.getLocation();
        outResolver.addSchemaInfo(namespace,location);
    }
    return outResolver;
}
 
Example #10
Source File: ConfigReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses an xml config file and returns a Config object.
 *
 * @param xmlFile
 *        The xml config file which is passed by the user to annotation processing
 * @return
 *        A non null Config object
 */
private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler, boolean disableSecureProcessing) throws SAXException, IOException {
    XMLReader reader;
    try {
        SAXParserFactory factory = XmlFactory.createParserFactory(disableSecureProcessing);
        reader = factory.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException e) {
        // in practice this will never happen
        throw new Error(e);
    }
    NGCCRuntimeEx runtime = new NGCCRuntimeEx(errorHandler);

    // set up validator
    ValidatorHandler validator = configSchema.newValidator();
    validator.setErrorHandler(errorHandler);

    // the validator will receive events first, then the parser.
    reader.setContentHandler(new ForkContentHandler(validator,runtime));

    reader.setErrorHandler(errorHandler);
    Config config = new Config(runtime);
    runtime.setRootHandler(config);
    reader.parse(new InputSource(xmlFile.toURL().toExternalForm()));
    runtime.reset();

    return config;
}
 
Example #11
Source File: ConfigReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private SchemaOutputResolver createSchemaOutputResolver(Config config, String xmlpath) {
    File baseDir = new File(xmlpath, config.getBaseDir().getPath());
    SchemaOutputResolverImpl outResolver = new SchemaOutputResolverImpl (baseDir);

    for( Schema schema : (List<Schema>)config.getSchema() ) {
        String namespace = schema.getNamespace();
        File location = schema.getLocation();
        outResolver.addSchemaInfo(namespace,location);
    }
    return outResolver;
}
 
Example #12
Source File: ConfigReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses an xml config file and returns a Config object.
 *
 * @param xmlFile
 *        The xml config file which is passed by the user to annotation processing
 * @return
 *        A non null Config object
 */
private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler, boolean disableSecureProcessing) throws SAXException, IOException {
    XMLReader reader;
    try {
        SAXParserFactory factory = XmlFactory.createParserFactory(disableSecureProcessing);
        reader = factory.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException e) {
        // in practice this will never happen
        throw new Error(e);
    }
    NGCCRuntimeEx runtime = new NGCCRuntimeEx(errorHandler);

    // set up validator
    ValidatorHandler validator = configSchema.newValidator();
    validator.setErrorHandler(errorHandler);

    // the validator will receive events first, then the parser.
    reader.setContentHandler(new ForkContentHandler(validator,runtime));

    reader.setErrorHandler(errorHandler);
    Config config = new Config(runtime);
    runtime.setRootHandler(config);
    reader.parse(new InputSource(xmlFile.toURL().toExternalForm()));
    runtime.reset();

    return config;
}
 
Example #13
Source File: ConfigReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private SchemaOutputResolver createSchemaOutputResolver(Config config, String xmlpath) {
    File baseDir = new File(xmlpath, config.getBaseDir().getPath());
    SchemaOutputResolverImpl outResolver = new SchemaOutputResolverImpl (baseDir);

    for( Schema schema : (List<Schema>)config.getSchema() ) {
        String namespace = schema.getNamespace();
        File location = schema.getLocation();
        outResolver.addSchemaInfo(namespace,location);
    }
    return outResolver;
}
 
Example #14
Source File: ConfigReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses an xml config file and returns a Config object.
 *
 * @param xmlFile
 *        The xml config file which is passed by the user to annotation processing
 * @return
 *        A non null Config object
 */
private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler, boolean disableSecureProcessing) throws SAXException, IOException {
    XMLReader reader;
    try {
        SAXParserFactory factory = XmlFactory.createParserFactory(disableSecureProcessing);
        reader = factory.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException e) {
        // in practice this will never happen
        throw new Error(e);
    }
    NGCCRuntimeEx runtime = new NGCCRuntimeEx(errorHandler);

    // set up validator
    ValidatorHandler validator = configSchema.newValidator();
    validator.setErrorHandler(errorHandler);

    // the validator will receive events first, then the parser.
    reader.setContentHandler(new ForkContentHandler(validator,runtime));

    reader.setErrorHandler(errorHandler);
    Config config = new Config(runtime);
    runtime.setRootHandler(config);
    reader.parse(new InputSource(xmlFile.toURL().toExternalForm()));
    runtime.reset();

    return config;
}
 
Example #15
Source File: ConfigReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private SchemaOutputResolver createSchemaOutputResolver(Config config, String xmlpath) {
    File baseDir = new File(xmlpath, config.getBaseDir().getPath());
    SchemaOutputResolverImpl outResolver = new SchemaOutputResolverImpl (baseDir);

    for( Schema schema : (List<Schema>)config.getSchema() ) {
        String namespace = schema.getNamespace();
        File location = schema.getLocation();
        outResolver.addSchemaInfo(namespace,location);
    }
    return outResolver;
}
 
Example #16
Source File: ConfigReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses an xml config file and returns a Config object.
 *
 * @param xmlFile
 *        The xml config file which is passed by the user to annotation processing
 * @return
 *        A non null Config object
 */
private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler, boolean disableSecureProcessing) throws SAXException, IOException {
    XMLReader reader;
    try {
        SAXParserFactory factory = XmlFactory.createParserFactory(disableSecureProcessing);
        reader = factory.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException e) {
        // in practice this will never happen
        throw new Error(e);
    }
    NGCCRuntimeEx runtime = new NGCCRuntimeEx(errorHandler);

    // set up validator
    ValidatorHandler validator = configSchema.newValidator();
    validator.setErrorHandler(errorHandler);

    // the validator will receive events first, then the parser.
    reader.setContentHandler(new ForkContentHandler(validator,runtime));

    reader.setErrorHandler(errorHandler);
    Config config = new Config(runtime);
    runtime.setRootHandler(config);
    reader.parse(new InputSource(xmlFile.toURL().toExternalForm()));
    runtime.reset();

    return config;
}
 
Example #17
Source File: ConfigReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param classes
 *      The set of classes passed to the AnnotationProcessor
 * @param xmlFile
 *      The configuration file.
 * @throws SAXException
 *      If this is thrown, the error has already been reported.
 * @throws IOException
 *     If any IO errors occur.
 */
public ConfigReader(ProcessingEnvironment env, Collection<? extends TypeElement> classes, File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException {
    this.env = env;
    Config config = parseAndGetConfig(xmlFile, errorHandler, env.getOptions().containsKey(Options.DISABLE_XML_SECURITY));
    checkAllClasses(config,classes);
    String path =   xmlFile.getAbsolutePath();
    String xmlPath = path.substring(0,path.lastIndexOf(File.separatorChar));
    schemaOutputResolver = createSchemaOutputResolver(config,xmlPath);

}
 
Example #18
Source File: ConfigReader.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param classes
 *      The set of classes passed to the AnnotationProcessor
 * @param xmlFile
 *      The configuration file.
 * @throws SAXException
 *      If this is thrown, the error has already been reported.
 * @throws IOException
 *     If any IO errors occur.
 */
public ConfigReader(ProcessingEnvironment env, Collection<? extends TypeElement> classes, File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException {
    this.env = env;
    Config config = parseAndGetConfig(xmlFile, errorHandler, env.getOptions().containsKey(Options.DISABLE_XML_SECURITY));
    checkAllClasses(config,classes);
    String path =   xmlFile.getAbsolutePath();
    String xmlPath = path.substring(0,path.lastIndexOf(File.separatorChar));
    schemaOutputResolver = createSchemaOutputResolver(config,xmlPath);

}
 
Example #19
Source File: ConfigReader.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param classes
 *      The set of classes passed to the AnnotationProcessor
 * @param xmlFile
 *      The configuration file.
 * @throws SAXException
 *      If this is thrown, the error has already been reported.
 * @throws IOException
 *     If any IO errors occur.
 */
public ConfigReader(ProcessingEnvironment env, Collection<? extends TypeElement> classes, File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException {
    this.env = env;
    Config config = parseAndGetConfig(xmlFile, errorHandler, env.getOptions().containsKey(Options.DISABLE_XML_SECURITY));
    checkAllClasses(config,classes);
    String path =   xmlFile.getAbsolutePath();
    String xmlPath = path.substring(0,path.lastIndexOf(File.separatorChar));
    schemaOutputResolver = createSchemaOutputResolver(config,xmlPath);

}
 
Example #20
Source File: ConfigReader.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param classes
 *      The set of classes passed to the AnnotationProcessor
 * @param xmlFile
 *      The configuration file.
 * @throws SAXException
 *      If this is thrown, the error has already been reported.
 * @throws IOException
 *     If any IO errors occur.
 */
public ConfigReader(ProcessingEnvironment env, Collection<? extends TypeElement> classes, File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException {
    this.env = env;
    Config config = parseAndGetConfig(xmlFile, errorHandler, env.getOptions().containsKey(Options.DISABLE_XML_SECURITY));
    checkAllClasses(config,classes);
    String path =   xmlFile.getAbsolutePath();
    String xmlPath = path.substring(0,path.lastIndexOf(File.separatorChar));
    schemaOutputResolver = createSchemaOutputResolver(config,xmlPath);

}
 
Example #21
Source File: ConfigReader.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param classes
 *      The set of classes passed to the AnnotationProcessor
 * @param xmlFile
 *      The configuration file.
 * @throws SAXException
 *      If this is thrown, the error has already been reported.
 * @throws IOException
 *     If any IO errors occur.
 */
public ConfigReader(ProcessingEnvironment env, Collection<? extends TypeElement> classes, File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException {
    this.env = env;
    Config config = parseAndGetConfig(xmlFile, errorHandler, env.getOptions().containsKey(Options.DISABLE_XML_SECURITY));
    checkAllClasses(config,classes);
    String path =   xmlFile.getAbsolutePath();
    String xmlPath = path.substring(0,path.lastIndexOf(File.separatorChar));
    schemaOutputResolver = createSchemaOutputResolver(config,xmlPath);

}
 
Example #22
Source File: ConfigReader.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param classes
 *      The set of classes passed to the AnnotationProcessor
 * @param xmlFile
 *      The configuration file.
 * @throws SAXException
 *      If this is thrown, the error has already been reported.
 * @throws IOException
 *     If any IO errors occur.
 */
public ConfigReader(ProcessingEnvironment env, Collection<? extends TypeElement> classes, File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException {
    this.env = env;
    Config config = parseAndGetConfig(xmlFile, errorHandler, env.getOptions().containsKey(Options.DISABLE_XML_SECURITY));
    checkAllClasses(config,classes);
    String path =   xmlFile.getAbsolutePath();
    String xmlPath = path.substring(0,path.lastIndexOf(File.separatorChar));
    schemaOutputResolver = createSchemaOutputResolver(config,xmlPath);

}
 
Example #23
Source File: ConfigReader.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param classes
 *      The set of classes passed to the AnnotationProcessor
 * @param xmlFile
 *      The configuration file.
 * @throws SAXException
 *      If this is thrown, the error has already been reported.
 * @throws IOException
 *     If any IO errors occur.
 */
public ConfigReader(ProcessingEnvironment env, Collection<? extends TypeElement> classes, File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException {
    this.env = env;
    Config config = parseAndGetConfig(xmlFile, errorHandler, env.getOptions().containsKey(Options.DISABLE_XML_SECURITY));
    checkAllClasses(config,classes);
    String path =   xmlFile.getAbsolutePath();
    String xmlPath = path.substring(0,path.lastIndexOf(File.separatorChar));
    schemaOutputResolver = createSchemaOutputResolver(config,xmlPath);

}
 
Example #24
Source File: ConfigReader.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param classes
 *      The set of classes passed to the AnnotationProcessor
 * @param xmlFile
 *      The configuration file.
 * @throws SAXException
 *      If this is thrown, the error has already been reported.
 * @throws IOException
 *     If any IO errors occur.
 */
public ConfigReader(ProcessingEnvironment env, Collection<? extends TypeElement> classes, File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException {
    this.env = env;
    Config config = parseAndGetConfig(xmlFile, errorHandler, env.getOptions().containsKey(Options.DISABLE_XML_SECURITY));
    checkAllClasses(config,classes);
    String path =   xmlFile.getAbsolutePath();
    String xmlPath = path.substring(0,path.lastIndexOf(File.separatorChar));
    schemaOutputResolver = createSchemaOutputResolver(config,xmlPath);

}