Java Code Examples for com.sun.tools.xjc.Options#EXTENSION

The following examples show how to use com.sun.tools.xjc.Options#EXTENSION . 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: DynamicCompiler.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Options createOptions() throws IOException, BadCommandLineException {
	final Options options = new Options();
	options.targetDir = targetDirectory;
	options.verbose = true;
	options.debugMode = false;
	options.setSchemaLanguage(Language.XMLSCHEMA);
	options.strictCheck = false;
	options.readOnly = false;
	options.compatibilityMode = Options.EXTENSION;
	// options.set

	if (schemas != null) {
		for (final File schema : schemas) {
			options.addGrammar(schema);
		}
	}

	if (bindings != null) {
		for (File binding : bindings) {
			options.addBindFile(binding);
		}
	}

	if (catalog != null) {
		options.addCatalog(catalog);
	}
	options.parseArguments(getArguments());
	return options;
}
 
Example 2
Source File: SchemaCompilerEx.java    From mwsc with MIT License 5 votes vote down vote up
public SchemaCompilerEx() {
    opts.compatibilityMode = Options.EXTENSION;
    resetSchema();

    if(System.getProperty("xjc-api.test")!=null) {
        opts.debugMode = true;
        opts.verbose = true;
    }
}
 
Example 3
Source File: MXJC2Task.java    From mxjc with MIT License 5 votes vote down vote up
/**
 * Controls whether the compiler will run in the strict
 * conformance mode (flg=false) or the extension mode (flg=true)
 */
public void setExtension( boolean flg ) {
    if(flg)
        this.options.compatibilityMode = Options.EXTENSION;
    else
        this.options.compatibilityMode = Options.STRICT;
}
 
Example 4
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Creates and initializes an instance of XJC options.
 *
 */
public Options createOptions(OptionsConfiguration optionsConfiguration)
		throws MojoExecutionException {
	final Options options = new Options();

	options.verbose = optionsConfiguration.isVerbose();
	options.debugMode = optionsConfiguration.isDebugMode();

	options.classpaths.addAll(optionsConfiguration.getPlugins());

	options.target = SpecVersion.V2_1;

	options.setSchemaLanguage(createLanguage(optionsConfiguration
			.getSchemaLanguage()));

	options.entityResolver = optionsConfiguration.getEntityResolver();

	for (InputSource grammar : optionsConfiguration.getGrammars()) {
		options.addGrammar(grammar);
	}

	for (InputSource bindFile : optionsConfiguration.getBindFiles()) {
		options.addBindFile(bindFile);
	}

	// Setup Other Options

	options.defaultPackage = optionsConfiguration.getGeneratePackage();
	options.targetDir = optionsConfiguration.getGenerateDirectory();

	options.strictCheck = optionsConfiguration.isStrict();
	options.readOnly = optionsConfiguration.isReadOnly();
	options.packageLevelAnnotations = optionsConfiguration
			.isPackageLevelAnnotations();
	options.noFileHeader = optionsConfiguration.isNoFileHeader();
	options.enableIntrospection = optionsConfiguration
			.isEnableIntrospection();
	// options.disableXmlSecurity =
	// optionsConfiguration.isDisableXmlSecurity();
	if (optionsConfiguration.getAccessExternalSchema() != null) {
		System.setProperty("javax.xml.accessExternalSchema",
				optionsConfiguration.getAccessExternalSchema());
	}
	if (optionsConfiguration.getAccessExternalDTD() != null) {
		System.setProperty("javax.xml.accessExternalDTD",
				optionsConfiguration.getAccessExternalDTD());
	}
	if (optionsConfiguration.isEnableExternalEntityProcessing()) {
		System.setProperty("enableExternalEntityProcessing", Boolean.TRUE.toString());
	}
	options.contentForWildcard = optionsConfiguration
			.isContentForWildcard();

	if (optionsConfiguration.isExtension()) {
		options.compatibilityMode = Options.EXTENSION;
	}

	final List<String> arguments = optionsConfiguration.getArguments();
	try {
		options.parseArguments(arguments.toArray(new String[arguments
				.size()]));
	}

	catch (BadCommandLineException bclex) {
		throw new MojoExecutionException("Error parsing the command line ["
				+ arguments + "]", bclex);
	}

	return options;
}
 
Example 5
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Creates and initializes an instance of XJC options.
 * 
 */
public Options createOptions(OptionsConfiguration optionsConfiguration)
		throws MojoExecutionException {
	final Options options = new Options();

	options.verbose = optionsConfiguration.isVerbose();
	options.debugMode = optionsConfiguration.isDebugMode();

	options.classpaths.addAll(optionsConfiguration.getPlugins());

	options.target = createSpecVersion(optionsConfiguration
			.getSpecVersion());

	final String encoding = optionsConfiguration.getEncoding();

	if (encoding != null) {
		options.encoding = createEncoding(encoding);
	}

	options.setSchemaLanguage(createLanguage(optionsConfiguration
			.getSchemaLanguage()));

	options.entityResolver = optionsConfiguration.getEntityResolver();

	for (InputSource grammar : optionsConfiguration.getGrammars()) {
		options.addGrammar(grammar);
	}

	for (InputSource bindFile : optionsConfiguration.getBindFiles()) {
		options.addBindFile(bindFile);
	}

	// Setup Other Options

	options.defaultPackage = optionsConfiguration.getGeneratePackage();
	options.targetDir = optionsConfiguration.getGenerateDirectory();

	options.strictCheck = optionsConfiguration.isStrict();
	options.readOnly = optionsConfiguration.isReadOnly();
	options.packageLevelAnnotations = optionsConfiguration
			.isPackageLevelAnnotations();
	options.noFileHeader = optionsConfiguration.isNoFileHeader();
	options.enableIntrospection = optionsConfiguration
			.isEnableIntrospection();
	options.disableXmlSecurity = optionsConfiguration
			.isDisableXmlSecurity();

	if (optionsConfiguration.getAccessExternalSchema() != null) {
		System.setProperty("javax.xml.accessExternalSchema",
				optionsConfiguration.getAccessExternalSchema());
	}
	if (optionsConfiguration.getAccessExternalDTD() != null) {
		System.setProperty("javax.xml.accessExternalDTD",
				optionsConfiguration.getAccessExternalDTD());
	}
	if (optionsConfiguration.isEnableExternalEntityProcessing()) {
		System.setProperty("enableExternalEntityProcessing", Boolean.TRUE.toString());
	}
	options.contentForWildcard = optionsConfiguration
			.isContentForWildcard();

	if (optionsConfiguration.isExtension()) {
		options.compatibilityMode = Options.EXTENSION;
	}

	final List<String> arguments = optionsConfiguration.getArguments();
	try {
		options.parseArguments(arguments.toArray(new String[arguments
				.size()]));
	}

	catch (BadCommandLineException bclex) {
		throw new MojoExecutionException("Error parsing the command line ["
				+ arguments + "]", bclex);
	}

	return options;
}
 
Example 6
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Creates and initializes an instance of XJC options.
 *
 */
public Options createOptions(OptionsConfiguration optionsConfiguration)
		throws MojoExecutionException {
	final Options options = new Options();

	options.verbose = optionsConfiguration.isVerbose();
	options.debugMode = optionsConfiguration.isDebugMode();

	options.classpaths.addAll(optionsConfiguration.getPlugins());

	options.target = SpecVersion.V2_2;

	final String encoding = optionsConfiguration.getEncoding();

	if (encoding != null) {
		options.encoding = createEncoding(encoding);
	}

	options.setSchemaLanguage(createLanguage(optionsConfiguration
			.getSchemaLanguage()));

	options.entityResolver = optionsConfiguration.getEntityResolver();

	for (InputSource grammar : optionsConfiguration.getGrammars()) {
		options.addGrammar(grammar);
	}

	for (InputSource bindFile : optionsConfiguration.getBindFiles()) {
		options.addBindFile(bindFile);
	}

	// Setup Other Options

	options.defaultPackage = optionsConfiguration.getGeneratePackage();
	options.targetDir = optionsConfiguration.getGenerateDirectory();

	options.strictCheck = optionsConfiguration.isStrict();
	options.readOnly = optionsConfiguration.isReadOnly();
	options.packageLevelAnnotations = optionsConfiguration
			.isPackageLevelAnnotations();
	options.noFileHeader = optionsConfiguration.isNoFileHeader();
	options.enableIntrospection = optionsConfiguration
			.isEnableIntrospection();
	options.disableXmlSecurity = optionsConfiguration
			.isDisableXmlSecurity();
	if (optionsConfiguration.getAccessExternalSchema() != null) {
		System.setProperty("javax.xml.accessExternalSchema",
				optionsConfiguration.getAccessExternalSchema());
	}
	if (optionsConfiguration.getAccessExternalDTD() != null) {
		System.setProperty("javax.xml.accessExternalDTD",
				optionsConfiguration.getAccessExternalDTD());
	}
	if (optionsConfiguration.isEnableExternalEntityProcessing()) {
		System.setProperty("enableExternalEntityProcessing", Boolean.TRUE.toString());
	}
	options.contentForWildcard = optionsConfiguration
			.isContentForWildcard();

	if (optionsConfiguration.isExtension()) {
		options.compatibilityMode = Options.EXTENSION;
	}

	final List<String> arguments = optionsConfiguration.getArguments();
	try {
		options.parseArguments(arguments.toArray(new String[arguments
				.size()]));
	}

	catch (BadCommandLineException bclex) {
		throw new MojoExecutionException("Error parsing the command line ["
				+ arguments + "]", bclex);
	}

	return options;
}
 
Example 7
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Creates and initializes an instance of XJC options.
 *
 */
public Options createOptions(OptionsConfiguration optionsConfiguration)
		throws MojoExecutionException {
	final Options options = new Options();

	options.verbose = optionsConfiguration.isVerbose();
	options.debugMode = optionsConfiguration.isDebugMode();

	options.classpaths.addAll(optionsConfiguration.getPlugins());

	options.target = SpecVersion.V2_2;

	final String encoding = optionsConfiguration.getEncoding();

	if (encoding != null) {
		options.encoding = createEncoding(encoding);
	}

	options.setSchemaLanguage(createLanguage(optionsConfiguration
			.getSchemaLanguage()));

	options.entityResolver = optionsConfiguration.getEntityResolver();

	for (InputSource grammar : optionsConfiguration.getGrammars()) {
		options.addGrammar(grammar);
	}

	for (InputSource bindFile : optionsConfiguration.getBindFiles()) {
		options.addBindFile(bindFile);
	}

	// Setup Other Options

	options.defaultPackage = optionsConfiguration.getGeneratePackage();
	options.targetDir = optionsConfiguration.getGenerateDirectory();

	options.strictCheck = optionsConfiguration.isStrict();
	options.readOnly = optionsConfiguration.isReadOnly();
	options.packageLevelAnnotations = optionsConfiguration
			.isPackageLevelAnnotations();
	options.noFileHeader = optionsConfiguration.isNoFileHeader();
	options.enableIntrospection = optionsConfiguration
			.isEnableIntrospection();
	options.disableXmlSecurity = optionsConfiguration
			.isDisableXmlSecurity();
	if (optionsConfiguration.getAccessExternalSchema() != null) {
		System.setProperty("javax.xml.accessExternalSchema",
				optionsConfiguration.getAccessExternalSchema());
	}
	if (optionsConfiguration.getAccessExternalDTD() != null) {
		System.setProperty("javax.xml.accessExternalDTD",
				optionsConfiguration.getAccessExternalDTD());
	}
	if (optionsConfiguration.isEnableExternalEntityProcessing()) {
		System.setProperty("enableExternalEntityProcessing", Boolean.TRUE.toString());
	}
	options.contentForWildcard = optionsConfiguration
			.isContentForWildcard();

	if (optionsConfiguration.isExtension()) {
		options.compatibilityMode = Options.EXTENSION;
	}

	final List<String> arguments = optionsConfiguration.getArguments();
	try {
		options.parseArguments(arguments.toArray(new String[arguments
				.size()]));
	}

	catch (BadCommandLineException bclex) {
		throw new MojoExecutionException("Error parsing the command line ["
				+ arguments + "]", bclex);
	}

	return options;
}
 
Example 8
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Creates and initializes an instance of XJC options.
 *
 */
public Options createOptions(OptionsConfiguration optionsConfiguration)
		throws MojoExecutionException {
	final Options options = new Options();

	options.verbose = optionsConfiguration.isVerbose();
	options.debugMode = optionsConfiguration.isDebugMode();

	options.classpaths.addAll(optionsConfiguration.getPlugins());

	options.setSchemaLanguage(createLanguage(optionsConfiguration
			.getSchemaLanguage()));

	options.entityResolver = optionsConfiguration.getEntityResolver();

	for (InputSource grammar : optionsConfiguration.getGrammars()) {
		options.addGrammar(grammar);
	}

	for (InputSource bindFile : optionsConfiguration.getBindFiles()) {
		options.addBindFile(bindFile);
	}

	// Setup Other Options

	options.defaultPackage = optionsConfiguration.getGeneratePackage();
	options.targetDir = optionsConfiguration.getGenerateDirectory();

	options.strictCheck = optionsConfiguration.isStrict();
	options.readOnly = optionsConfiguration.isReadOnly();
	options.packageLevelAnnotations = optionsConfiguration
			.isPackageLevelAnnotations();
	options.noFileHeader = optionsConfiguration.isNoFileHeader();
	// options.enableIntrospection =
	// optionsConfiguration.isEnableIntrospection();
	// options.disableXmlSecurity =
	// optionsConfiguration.isDisableXmlSecurity();
	if (optionsConfiguration.getAccessExternalSchema() != null) {
		System.setProperty("javax.xml.accessExternalSchema",
				optionsConfiguration.getAccessExternalSchema());
	}
	if (optionsConfiguration.getAccessExternalDTD() != null) {
		System.setProperty("javax.xml.accessExternalDTD",
				optionsConfiguration.getAccessExternalDTD());
	}
	if (optionsConfiguration.isEnableExternalEntityProcessing()) {
		System.setProperty("enableExternalEntityProcessing", Boolean.TRUE.toString());
	}
	// options.contentForWildcard =
	// optionsConfiguration.isContentForWildcard()

	if (optionsConfiguration.isExtension()) {
		options.compatibilityMode = Options.EXTENSION;
	}

	final List<String> arguments = optionsConfiguration.getArguments();
	try {
		options.parseArguments(arguments.toArray(new String[arguments
				.size()]));
	}

	catch (BadCommandLineException bclex) {
		throw new MojoExecutionException("Error parsing the command line ["
				+ arguments + "]", bclex);
	}

	return options;
}