use of com.developmentontheedge.be5.metadata.serialization.LoadContext in project be5 by DevelopmentOnTheEdge.
the class AppValidate method loadModules.
private void loadModules() throws MojoFailureException {
LoadContext loadContext = new LoadContext();
// List<ProjectElementException> errors = new ArrayList<>();
try {
// final Project model = be5Project;
// List<Project> moduleProjects = ModuleLoader2.loadModules(model, logger, loadContext);
// errors.addAll( validateDeps(moduleProjects) );
// ModuleLoader2.mergeAllModules( model, moduleProjects, loadContext );
ModuleLoader2.mergeModules(be5Project, logger);
} catch (ProjectLoadException e) {
throw new MojoFailureException("Can not load project modules", e);
}
checkErrors(loadContext, "Modules have %d error(s)");
}
use of com.developmentontheedge.be5.metadata.serialization.LoadContext in project be5 by DevelopmentOnTheEdge.
the class ModuleLoader2 method loadAllProjects.
public static void loadAllProjects(List<URL> urls) {
modulesMap = new HashMap<>();
try {
replaceAndAddURLtoSource(urls);
for (URL url : urls) {
LoadContext loadContext = new LoadContext();
Project module;
String ext = url.toExternalForm();
if (// usual file in directory
ext.indexOf('!') < 0) {
Path path = Paths.get(url.toURI()).getParent();
module = Serialization.load(path, loadContext);
log.fine("Load module from dir: " + path);
} else // war or jar file
{
String jar = ext.substring(0, ext.indexOf('!'));
// = FileSystems.getFileSystem(URI.create(jar));
FileSystem fs;
try {
fs = FileSystems.newFileSystem(URI.create(jar), Collections.emptyMap());
} catch (FileSystemAlreadyExistsException e) {
fs = FileSystems.getFileSystem(URI.create(jar));
log.info("Get exists FileSystem after exception");
}
Path path = fs.getPath("./");
module = Serialization.load(path, loadContext);
log.fine("Load module from " + url.toExternalForm() + ", path=" + path);
}
loadContext.check();
modulesMap.put(module.getAppName(), module);
}
} catch (ProjectLoadException | IOException | URISyntaxException e) {
e.printStackTrace();
}
}
use of com.developmentontheedge.be5.metadata.serialization.LoadContext in project be5 by DevelopmentOnTheEdge.
the class ModuleLoader2 method mergeAllModules.
public static void mergeAllModules(final Project model, List<Project> modules, final LoadContext context) throws ProjectLoadException {
modules = new LinkedList<>(modules);
for (Project module : modules) {
module.mergeHostProject(model);
}
final Project compositeModule = foldModules(model, modules, context);
if (compositeModule != null) {
model.merge(compositeModule);
}
}
use of com.developmentontheedge.be5.metadata.serialization.LoadContext in project be5 by DevelopmentOnTheEdge.
the class ModuleLoader2 method mergeModules.
public static void mergeModules(Project be5Project, ProcessController logger) throws ProjectLoadException {
long startTime = System.nanoTime();
LoadContext loadContext = new LoadContext();
try {
ModuleLoader2.mergeAllModules(be5Project, logger, loadContext);
} catch (ProjectLoadException e) {
throw new ProjectLoadException("Merge modules", e);
}
loadContext.check();
log.info(ModuleLoader2.logLoadedProject(be5Project, startTime));
}
Aggregations