producesFilesSet.add(f);
}
}
Generator generator = new GeneratorImpl();
generator.setForcingOverwrite(isForce());
generator.setSettingReadOnly(isReadOnly());
generator.setValidating(isValidating());
if (getPackage() != null) {
generator.setProperty("jaxme.package.name", getPackage());
}
Property[] myProperties = getProperties();
for (int i = 0; i < myProperties.length; i++) {
Property ot = myProperties[i];
log("Option " + ot.getName() + "=" + ot.getValue(), Project.MSG_VERBOSE);
generator.setProperty(ot.getName(), ot.getValue());
}
SchemaReader reader = getSchemaReader();
if (reader instanceof JAXBSchemaReader) {
((JAXBSchemaReader) reader).setSupportingExtensions(true);
}
generator.setSchemaReader(reader);
reader.setGenerator(generator);
generator.setTargetDirectory(getTarget());
ClassType[] mySgFactoryChains = getSGFactoryChains();
if (mySgFactoryChains.length > 0) {
if (!(reader instanceof JAXBSchemaReader)) {
throw new BuildException("The nested child element 'sgFactoryChain' is valid only, if the schema reader is an instance of "
+ JAXBSchemaReader.class.getName(), getLocation());
}
for (int i = 0; i < mySgFactoryChains.length; i++) {
ClassType ct = mySgFactoryChains[i];
Class c;
try {
c = cl.loadClass(ct.getClassName());
} catch (ClassNotFoundException e) {
throw new BuildException("Failed to load SGFactoryChain implementation class " + ct.getClassName(),
getLocation());
}
if (!SGFactoryChain.class.isAssignableFrom(c)) {
throw new BuildException("The SGFactoryChain class " + c.getName() +
" is not implementing " + SGFactoryChain.class.getName(),
getLocation());
}
reader.addSGFactoryChain(c);
}
}
for (int i = 0; i < schemaFiles.length; i++) {
try {
SchemaSG schemaSG = generator.generate(schemaFiles[i]);
if (producesFilesSet != null) {
JavaSourceFactory jsf = schemaSG.getJavaSourceFactory();
File targetDirectory = getTarget();
for (Iterator iter = jsf.getJavaSources(); iter.hasNext(); ) {
JavaSource js = (JavaSource) iter.next();