use of eu.esdihumboldt.hale.io.project.jaxb.generated.HaleProject in project hale by halestudio.
the class ProjectParser method execute.
/**
* @see AbstractIOProvider#execute(ProgressIndicator, IOReporter)
*/
@Override
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException {
progress.begin(Messages.ProjectParser_0, ProgressIndicator.UNKNOWN);
try {
File file;
try {
file = new File(getSource().getLocation());
} catch (IllegalArgumentException e) {
file = null;
}
String basePath = (file == null) ? (new File(".").getAbsolutePath()) : (FilenameUtils.getFullPath(file.getAbsolutePath()));
// Unmarshal the project file
JAXBContext jc;
JAXBElement<HaleProject> root;
try {
jc = JAXBContext.newInstance(PROJECT_CONTEXT, ObjectFactory.class.getClassLoader());
Unmarshaller u = jc.createUnmarshaller();
u.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
root = u.unmarshal(new StreamSource(getSource().getInput()), HaleProject.class);
} catch (JAXBException e) {
reporter.error(new IOMessageImpl("Unmarshalling the HaleProject from the given resource failed: {0}", e, -1, -1, getSource().getLocation()));
reporter.setSuccess(false);
return reporter;
}
project = new Project();
projectFiles = new HashMap<String, ProjectFile>();
report = reporter;
HaleProject haleProject = root.getValue();
// populate project and project files
loadProject(haleProject);
loadSchemas(haleProject, basePath);
loadAlignment(haleProject, basePath);
loadStyle(haleProject, basePath);
loadInstances(haleProject, basePath);
loadTasks(haleProject, basePath);
loadConfig(haleProject);
report = null;
reporter.setSuccess(true);
return reporter;
} finally {
progress.end();
}
}
Aggregations