}
public void generate(ToolContext context) throws ToolException {
Map<String, String> ns2pkgMap = context.getNamespacePackageMap();
Map<String, PackageInfo> packageInfoTable =
createPackageInfoTable(schemaCollection, ns2pkgMap);
ClassCollector classCollector = context.get(ClassCollector.class);
try {
if (!dynamic) {
// No XSD2Java is needed for dynamic SDO
genModel = generatePackages(packageRegistry.values(), targetDirectory,
new Hashtable<String, PackageInfo>(packageInfoTable),
genOptions, allNamespaces);
List<GenPackage> packages = CastUtils.cast(genModel.getGenPackages());
for (Iterator<GenPackage> iter = packages.iterator(); iter.hasNext();) {
// loop through the list, once to build up the eclass to genclass mapper
GenPackage genPackage = iter.next();
List<GenClass> classes = CastUtils.cast(genPackage.getGenClasses());
for (Iterator<GenClass> classIter = classes.iterator(); classIter.hasNext();) {
GenClass genClass = classIter.next();
genClasses.put(genClass.getEcoreClass(), genClass);
//This gets the "impl" classes, how do we get everything else?
String s = genClass.getQualifiedClassName();
String p = s.substring(0, s.lastIndexOf('.'));
s = s.substring(s.lastIndexOf('.') + 1);
classCollector.addTypesClassName(p,
s,
genClass.getQualifiedClassName());
p = genClass.getGenPackage().getInterfacePackageName();
s = genClass.getInterfaceName();
classCollector.addTypesClassName(p,
s,
p + "." + s);
}
String p = genPackage.getInterfacePackageName();
String s = genPackage.getFactoryInterfaceName();
classCollector.addTypesClassName(p,
s,
p + "." + s);
p = genPackage.getClassPackageName();
s = genPackage.getFactoryClassName();
classCollector.addTypesClassName(p,
s,
p + "." + s);
}
}
} catch (Exception e) {