private static void runExtensions(List extensions, SchemaTypeSystem system, File classesDir)
{
if (extensions != null && extensions.size() > 0)
{
SchemaCompilerExtension sce = null;
Iterator i = extensions.iterator();
Map extensionParms = null;
String classesDirName = null;
try
{
classesDirName = classesDir.getCanonicalPath();
}
catch(java.io.IOException e)
{
System.out.println("WARNING: Unable to get the path for schema jar file");
classesDirName = classesDir.getAbsolutePath();
}
while (i.hasNext())
{
Extension extension = (Extension) i.next();
try
{
sce = (SchemaCompilerExtension) extension.getClassName().newInstance();
}
catch (InstantiationException e)
{
System.out.println("UNABLE to instantiate schema compiler extension:" + extension.getClassName().getName());
System.out.println("EXTENSION Class was not run");
break;
}
catch (IllegalAccessException e)
{
System.out.println("ILLEGAL ACCESS Exception when attempting to instantiate schema compiler extension: " + extension.getClassName().getName());
System.out.println("EXTENSION Class was not run");
break;
}
System.out.println("Running Extension: " + sce.getExtensionName());
extensionParms = new HashMap();
Iterator parmsi = extension.getParams().iterator();
while (parmsi.hasNext())
{
Extension.Param p = (Extension.Param) parmsi.next();
extensionParms.put(p.getName(), p.getValue());
}
extensionParms.put("classesDir", classesDirName);
sce.schemaCompilerExtension(system, extensionParms);
}
}
}