Skip to content
Snippets Groups Projects
Commit 52d48ae5 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Code modifications for checkstyle & pmd.

parent 68bdc5ba
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,15 @@ import org.primefaces.model.TreeNode;
@SessionScoped
public class SelectedProjectBean {
/**
* This constant is used as the host for the dependencies.
*/
private static final String URL_LOCALHOST = "localhost";
/**
* This constant is used as a protocol for the dependencies.
*/
private static final String URL_PROTOCOL_FILE = "file";
/**
* The currently selected node of the current user.
*/
......@@ -161,23 +170,27 @@ public class SelectedProjectBean {
}
}
/**
* This method delivers the available reader-plugins for the current main project. The delivered plugins are never abstract.
*
* @return A list with all readers.
*/
public final List<Class<?>> getAvailableReaders() {
final List<Class<?>> list = new ArrayList<Class<?>>();
if (this.mainProject != null) {
for (final MIDependency lib : this.mainProject.getDependencies()) {
try {
PluginClassLoader.getInstance().addURL(new URL("file", "localhost", lib.getFilePath()));
PluginClassLoader.getInstance().addURL(new URL(SelectedProjectBean.URL_PROTOCOL_FILE, SelectedProjectBean.URL_LOCALHOST, lib.getFilePath()));
} catch (final MalformedURLException ex) {
// TODO Log exception
}
try {
final List<Class<?>> plugins = PluginFinder.getAllPluginsWithinJar(new URL("file", "localhost", lib.getFilePath()));
final List<Class<?>> plugins = PluginFinder.getAllPluginsWithinJar(new URL(SelectedProjectBean.URL_PROTOCOL_FILE,
SelectedProjectBean.URL_LOCALHOST, lib.getFilePath()));
for (final Class<?> plugin : plugins) {
if (!Modifier.isAbstract(plugin.getModifiers())) {
if (AbstractReaderPlugin.class.isAssignableFrom(plugin)) {
list.add(plugin);
}
if (!Modifier.isAbstract(plugin.getModifiers()) && AbstractReaderPlugin.class.isAssignableFrom(plugin)) {
list.add(plugin);
}
}
} catch (final MalformedURLException ex) {
......@@ -190,23 +203,27 @@ public class SelectedProjectBean {
return list;
}
/**
* This method delivers the available filter-plugins for the current main project. The delivered plugins are never abstract.
*
* @return A list with all filter.
*/
public final List getAvailableFilters() {
final List<Class<?>> list = new ArrayList<Class<?>>();
if (this.mainProject != null) {
for (final MIDependency lib : this.mainProject.getDependencies()) {
try {
PluginClassLoader.getInstance().addURL(new URL("file", "localhost", lib.getFilePath()));
PluginClassLoader.getInstance().addURL(new URL(SelectedProjectBean.URL_PROTOCOL_FILE, SelectedProjectBean.URL_LOCALHOST, lib.getFilePath()));
} catch (final MalformedURLException ex) {
// TODO Log exception
}
try {
final List<Class<?>> plugins = PluginFinder.getAllPluginsWithinJar(new URL("file", "localhost", lib.getFilePath()));
final List<Class<?>> plugins = PluginFinder.getAllPluginsWithinJar(new URL(SelectedProjectBean.URL_PROTOCOL_FILE,
SelectedProjectBean.URL_LOCALHOST, lib.getFilePath()));
for (final Class<?> plugin : plugins) {
if (!Modifier.isAbstract(plugin.getModifiers())) {
if (AbstractAnalysisPlugin.class.isAssignableFrom(plugin)) {
list.add(plugin);
}
if (!Modifier.isAbstract(plugin.getModifiers()) && AbstractAnalysisPlugin.class.isAssignableFrom(plugin)) {
list.add(plugin);
}
}
} catch (final MalformedURLException ex) {
......@@ -234,12 +251,13 @@ public class SelectedProjectBean {
if (this.mainProject != null) {
for (final MIDependency lib : this.mainProject.getDependencies()) {
try {
PluginClassLoader.getInstance().addURL(new URL("file", "localhost", lib.getFilePath()));
PluginClassLoader.getInstance().addURL(new URL(SelectedProjectBean.URL_PROTOCOL_FILE, SelectedProjectBean.URL_LOCALHOST, lib.getFilePath()));
} catch (final MalformedURLException ex) {
// TODO Log exception
}
try {
final List<Class<?>> plugins = PluginFinder.getAllPluginsWithinJar(new URL("file", "localhost", lib.getFilePath()));
final List<Class<?>> plugins = PluginFinder.getAllPluginsWithinJar(new URL(SelectedProjectBean.URL_PROTOCOL_FILE,
SelectedProjectBean.URL_LOCALHOST, lib.getFilePath()));
for (final Class<?> plugin : plugins) {
if (!Modifier.isAbstract(plugin.getModifiers())) {
if (AbstractReaderPlugin.class.isAssignableFrom(plugin)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment