private void loadActionsFromFile(final Set<Class<?>> actionClasses) { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); Properties properties = new Properties(); try (InputStream stream = loader.getResourceAsStream("/configuration.properties")) { if (stream == null) { throw new RuntimeException(); } properties.load(stream); } for (FenixFrameworkArtifact artifact : FenixFrameworkArtifact.fromName(properties.getProperty("app.name")).getArtifacts()) { try (InputStream stream = loader.getResourceAsStream(artifact.getName() + "/.actionAnnotationLog")) { if (stream != null) { List<String> classnames = IOUtils.readLines(stream); for (String classname : classnames) { try { Class<?> type = loader.loadClass(classname); actionClasses.add(type); } catch (final ClassNotFoundException e) { e.printStackTrace(); } } } } } } catch (IOException | FenixFrameworkProjectException e) { e.printStackTrace(); } }
public static List<URL> getUrls() { if (urls == null) { urls = new ArrayList<URL>(); try { for (DmlFile dml : FenixFrameworkArtifact.fromName(properties.getProperty("app.name")) .getFullDmlSortedList()) { urls.add(dml.getUrl()); } } catch (FenixFrameworkProjectException e) { throw new Error(e); } catch (IOException e) { throw new Error(e); } } if (urls.isEmpty()) { System.err.println("domain Model URLs were not loaded"); } return urls; }