@Override
protected JAXBContextState createContextState() throws JAXBException {
DynamicJAXBContextState state = new DynamicJAXBContextState((DynamicClassLoader) classLoader);
Metadata schemaMetadata = null;
Object constructorArg;
if (schema instanceof Node) {
constructorArg = schema;
} else if (schema instanceof InputStream) {
constructorArg = new StreamSource((InputStream) schema);
} else {
constructorArg = (Source) schema;
}
try {
Class<?> schemaMetadataClass = PrivilegedAccessHelper.getClassForName(SCHEMAMETADATA_CLASS_NAME);
Class<?>[] constructorClassArgs = {DynamicClassLoader.class, Map.class, constructorArg.getClass(), EntityResolver.class};
Constructor<?> constructor = PrivilegedAccessHelper.getConstructorFor(schemaMetadataClass, constructorClassArgs, true);
Object[] contructorObjectArgs = {(DynamicClassLoader) classLoader, properties, constructorArg, entityResolver};
schemaMetadata = (Metadata) PrivilegedAccessHelper.invokeConstructor(constructor, contructorObjectArgs);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof JAXBException) {
throw (JAXBException) cause;
} else if (cause instanceof org.eclipse.persistence.exceptions.JAXBException) {
throw (org.eclipse.persistence.exceptions.JAXBException) cause;
} else {
throw new JAXBException(e);
}
} catch (org.eclipse.persistence.exceptions.JAXBException e) {
throw e;
} catch (Exception e) {
throw new JAXBException(e);
}
Generator g = new Generator(schemaMetadata.getJavaModelInput(), schemaMetadata.getBindings(), classLoader, null, false);
Project p = null;
Project dp = null;
try {
p = (Project) g.generateProject();