Skip to content
Snippets Groups Projects
Commit dc2eaedd authored by nie's avatar nie
Browse files

Quality (Checkstyle, PMD,...)

parent b872d950
No related branches found
No related tags found
No related merge requests found
Showing
with 183 additions and 25 deletions
......@@ -96,7 +96,7 @@ public class AvailableProjectsBean {
/**
* Delivers the currently available projects as a tree root.
*
* @returns The root of the currently available projects.
* @return The root of the currently available projects.
*/
public final synchronized TreeNode getProjectsRoot() {
final TreeNode root = new DefaultTreeNode("Root", null);
......@@ -121,7 +121,7 @@ public class AvailableProjectsBean {
* The project to be saved.
*/
public synchronized void saveProject(final MIProject project) {
// TODO Fill method
}
/**
......@@ -131,7 +131,7 @@ public class AvailableProjectsBean {
* The project to be removed.
*/
public synchronized void deleteProject(final MIProject project) {
// TODO Fill method
}
/**
......@@ -142,6 +142,6 @@ public class AvailableProjectsBean {
* The project to be reloaded.
*/
public synchronized void resetProject(final MIProject project) {
// TODO Fill method
}
}
......@@ -34,12 +34,26 @@ import kieker.webgui.beans.session.SelectedProjectBean;
import org.primefaces.model.DualListModel;
/**
* This bean contains the currently choosen dependencies.
*
* @author Nils Christian Ehmke
*/
@ManagedBean
@RequestScoped
public class SelectedDependenciesBean {
/**
* A dual model containing all available dependencies and the currently choosen one.
*/
private DualListModel<MIDependency> dependencies;
/**
* The currently selected project.
*/
private final MIProject project;
/**
* The faces context of this bean.
*/
private final FacesContext context;
/**
......
......@@ -32,6 +32,9 @@ import javax.faces.bean.RequestScoped;
@RequestScoped
public class StringBean {
/**
* The string instance stored within this bean.
*/
private String string;
/**
......
......@@ -42,7 +42,13 @@ import kieker.webgui.beans.application.ThemeSwitcherBean;
@SessionScoped
public class CurrentThemeBean {
/**
* The default theme used for all users.
*/
private static final String DEFAULT_THEME = "glass-x";
/**
* The current theme.
*/
private String theme;
/**
......
......@@ -36,12 +36,17 @@ import org.primefaces.model.UploadedFile;
@SessionScoped
public class DependencyUploadController {
/**
* The file stored within this bean.
*/
private UploadedFile file;
/**
* Creates a new instance of this class.
*/
public DependencyUploadController() {}
public DependencyUploadController() {
/* No code necessary. */
}
/**
* Delivers the instance stored within this bean.
......
......@@ -38,14 +38,25 @@ import org.primefaces.model.TreeNode;
@SessionScoped
public class SelectedProjectBean {
/**
* The currently selected node of the current user.
*/
private TreeNode selectedNode;
/**
* The selected project of the current user.
*/
private MIProject selectedProject;
/**
* The main project of the current user.
*/
private MIProject mainProject;
/**
* Creates a new instance of this class.
*/
public SelectedProjectBean() {}
public SelectedProjectBean() {
/* No code necessary. */
}
/**
* Delivers the main project of the current user. It can be null.
......@@ -75,18 +86,44 @@ public class SelectedProjectBean {
return this.selectedProject;
}
/**
* Sets the currently selected project within the bean.
*
* @param selectedProject
* The selected project.
*/
public final void setSelectedProject(final MIProject selectedProject) {
this.selectedProject = selectedProject;
}
/**
* Delivers the currently selected node.
*
* @return The selected node.
*/
public final TreeNode getSelectedNode() {
return this.selectedNode;
}
/**
* This event should be triggered once a new node is selected
* to make sure that the newly selected node is stored within
* this bean.
*
* @param event
* The event that a node has been selected by the
* user.
*/
public final void onNodeSelect(final NodeSelectEvent event) {
this.setSelectedNode(event.getTreeNode());
}
/**
* Sets the currently selected node to a new value.
*
* @param selectedNode
* The selected node.
*/
public final void setSelectedNode(final TreeNode selectedNode) {
this.selectedNode = selectedNode;
if (selectedNode != null && selectedNode.getData() instanceof MIProject) {
......
......@@ -49,14 +49,41 @@ import org.primefaces.model.UploadedFile;
*/
public final class FileManager {
/**
* The logger within this class.
*/
private static final Log LOG = LogFactory.getLog(FileManager.class);
/**
* The root dir which contains all other directories.
*/
private static final String ROOT_DIR = "data";
/**
* The directory which contains the projects.
*/
private static final String PROJECT_DIR = FileManager.ROOT_DIR + File.separator + "projects";
/**
* The directory which contains the libraries.
*/
private static final String LIB_DIR = FileManager.ROOT_DIR + File.separator + "libraries";
/**
* The extension of the kieker analysis files.
*/
private static final String EXTENSION = ".kax";
/**
* The extension of jar-files.
*/
private static final String JAR_EXTENSION = ".jar";
/**
* The buffer size in bytes uses to upload dependencies.
*/
private static final int BUF_SIZE = 1024;
/**
* The singleton instance of this class.
*/
private static final FileManager INSTANCE = new FileManager();
/**
* The factory used to create new objects of the meta model.
*/
private final MAnalysisMetaModelFactory factory;
/**
......@@ -238,7 +265,7 @@ public final class FileManager {
out.close();
}
} catch (final IOException ex) {
// Ignore
FileManager.LOG.warn("Error while uploading dependency '" + file.getFileName() + "'.");
}
}
final MIDependency dependency = this.factory.createDependency();
......@@ -251,7 +278,7 @@ public final class FileManager {
*
* @return The singleton instance of this class.
*/
public final synchronized static FileManager getInstance() {
public static final synchronized FileManager getInstance() {
return FileManager.INSTANCE;
}
......@@ -268,12 +295,10 @@ public final class FileManager {
final File[] files = new File(FileManager.LIB_DIR).listFiles();
if (files != null) {
for (final File file : files) {
if (file.isFile()) {
if (file.getName().endsWith(FileManager.JAR_EXTENSION)) {
final MIDependency dependency = this.factory.createDependency();
dependency.setFilePath(file.getAbsolutePath());
resultList.add(dependency);
}
if (file.isFile() && file.getName().endsWith(FileManager.JAR_EXTENSION)) {
final MIDependency dependency = this.factory.createDependency();
dependency.setFilePath(file.getAbsolutePath());
resultList.add(dependency);
}
}
}
......
......@@ -30,12 +30,19 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import kieker.analysis.plugin.port.Plugin;
import kieker.common.logging.Log;
import kieker.common.logging.LogFactory;
/**
* @author Nils Christian Ehmke
*/
public final class PluginFinder {
/**
* The logger of this class.
*/
private static final Log LOG = LogFactory.getLog(PluginFinder.class);
/**
* Creates a new instance of this class.
*/
......@@ -82,6 +89,7 @@ public final class PluginFinder {
result.add(c);
}
} catch (final Throwable ex) {
PluginFinder.LOG.error("Error while scanning jar-file '" + url.getFile() + "'.");
}
}
return result;
......
......@@ -39,24 +39,52 @@ import kieker.webgui.common.PluginFinder;
@FacesConverter(value = MIDependencyToCountPluginsConverter.NAME)
public class MIDependencyToCountPluginsConverter implements Converter {
/**
* The name of this class used by the xhtml-files.
*/
public static final String NAME = "kieker.webgui.converter.MIDependencyToCountPluginsConverter";
/**
* Creates a new instance of this class.
*/
public MIDependencyToCountPluginsConverter() {}
public MIDependencyToCountPluginsConverter() {
/* No code necessary. */
}
/**
* Delivers always null
* Delivers always null.
*
* @param fc
* The FacesContext for the request being processed.
* @param uic
* The component with which this model object value is
* associated.
* @param string
* The string to be converted.
* @return Always null.
*/
@Override
public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) {
return null;
}
/**
* Converts the given dependency to a human readable string
* containing the number of plugins within the jar.
*
* @param fc
* The FacesContext for the request being processed.
* @param uic
* The component with which this model object value is
* associated.
* @param o
* The object to be converted.
* @return The number of plugins within the jar. If this is
* not possible, an empty string will be returned.
*/
@Override
public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) {
if (o == null || !(o instanceof MIDependency)) {
if (!(o instanceof MIDependency)) {
return "";
} else {
try {
......
......@@ -37,26 +37,54 @@ import kieker.analysis.model.analysisMetaModel.MIDependency;
*/
@FacesConverter(value = MIDependencyToSizeConverter.NAME)
public class MIDependencyToSizeConverter implements Converter {
/**
* The name of this class used by the xhtml-files.
*/
public static final String NAME = "kieker.webgui.converter.MIDependencyToSizeConverter";
/**
* The factor used to convert the size into MiBytes.
*/
private static final double FACTOR = 1.0 / 1024 / 1024;
/**
* Creates a new instance of this class.
*/
public MIDependencyToSizeConverter() {}
public MIDependencyToSizeConverter() {
/* No code necessary. */
}
/**
* Delivers always null
* Delivers always null.
*
* @param fc
* The FacesContext for the request being processed.
* @param uic
* The component with which this model object value is
* associated.
* @param string
* The string to be converted.
* @return Always null.
*/
@Override
public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) {
return null;
}
/**
* Delivers a string-representation of the size of the given dependency.
*
* @param fc
* The FacesContext for the request being processed.
* @param uic
* The component with which this model object value is
* associated.
* @param o
* The object to be converted.
* @return The size of the given object if it is a dependency and not null, an empty string otherwise.
*/
@Override
public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) {
if (o == null || !(o instanceof MIDependency)) {
if (!(o instanceof MIDependency)) {
return "";
} else {
final long size = new File(((MIDependency) o).getFilePath()).length();
......
......@@ -45,7 +45,9 @@ public class MIDependencyToStringConverter implements Converter {
/**
* Creates a new instance of this class.
*/
public MIDependencyToStringConverter() {}
public MIDependencyToStringConverter() {
/* No code necessary. */
}
/**
* This method delivers always null and should not be used.
......@@ -83,7 +85,7 @@ public class MIDependencyToStringConverter implements Converter {
/*
* Make sure that the given object is well-defined.
*/
if (o == null || !(o instanceof MIDependency)) {
if (!(o instanceof MIDependency)) {
return "";
} else {
return new File(((MIDependency) o).getFilePath()).getName();
......
......@@ -43,7 +43,9 @@ public class MIProjectToStringConverter implements Converter {
/**
* Creates a new instance of this class.
*/
public MIProjectToStringConverter() {}
public MIProjectToStringConverter() {
/* No code necessary. */
}
/**
* This method delivers always null and should not be used.
......@@ -81,7 +83,7 @@ public class MIProjectToStringConverter implements Converter {
/*
* Make sure that the given object is well-defined.
*/
if (o == null || !(o instanceof MIProject)) {
if (!(o instanceof MIProject)) {
return "";
} else {
return ((MIProject) o).getName();
......
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