use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class FreemarkerUtils method getConfiguration.
public static Configuration getConfiguration(Project project) {
Configuration config = (Configuration) configTemplate.clone();
config.setCacheStorage(new SoftCacheStorage());
try {
config.setSharedVariable("project", project);
} catch (TemplateModelException e) {
throw new RuntimeException("Unexpected error: " + e, e);
}
FreemarkerScript macroCollection = project.getMacroCollection().optScript(FreemarkerCatalog.MAIN_MACRO_LIBRARY);
if (macroCollection != null) {
config.addAutoInclude(macroCollection.getCompletePath().toString());
}
for (Module module : project.getModules()) {
FreemarkerCatalog collection = module.getMacroCollection();
if (collection != null) {
FreemarkerScript script = collection.optScript(FreemarkerCatalog.MAIN_MACRO_LIBRARY);
if (script != null) {
config.addAutoInclude(script.getCompletePath().toString());
}
}
}
config.setTemplateLoader(new ProjectTemplateLoader(project));
return config;
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class ProjectProviderImpl method getProject.
@Override
public synchronized Project getProject() {
if (dirty || project == null) {
Project oldProject = project;
project = loadProject();
if (oldProject != null) {
be5Caches.clearAll();
// todo refactoring and add to be5Caches
userAwareMetaProvider.get().compileLocalizations();
// todo refactoring and add to be5Caches
groovyOperationLoaderProvider.get().initOperationMap();
groovyRegister.initClassLoader();
updateDatabaseSystem();
}
}
return project;
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class ModuleLoader2 method getFileSystem.
/**
* Returns BeanExplorerProjectFileSystem for given module if possible
*/
public static ProjectFileSystem getFileSystem(Project app, String moduleName) {
if (app.getProjectOrigin().equals(moduleName)) {
return new ProjectFileSystem(app);
}
Path modulePath = ModuleLoader2.getModulePath(moduleName);
if (modulePath != null) {
Project project = new Project(moduleName);
project.setLocation(modulePath);
project.setProjectFileStructure(new ProjectFileStructure(project));
return new ProjectFileSystem(project);
}
return null;
}
use of com.developmentontheedge.be5.metadata.model.Project 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.model.Project in project be5 by DevelopmentOnTheEdge.
the class ModuleLoader2 method logLoadedProject.
public static String logLoadedProject(Project project, long startTime) {
StringBuilder sb = new StringBuilder();
if (project.isModuleProject()) {
sb.append(JULLogger.infoBlock("Loaded module:"));
} else {
sb.append(JULLogger.infoBlock("Loaded project:"));
}
sb.append("\nName: ").append(project.getName());
if (project.getModules().getSize() > 0) {
sb.append("\nModules: ");
for (Module module : project.getModules()) {
sb.append("\n - ");
sb.append(module.getName());
}
}
sb.append("\nLoading time: ").append(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime)).append(" ms");
sb.append("\n");
return sb.toString();
}
Aggregations