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

Added some comments

parent 6bc07219
No related branches found
No related tags found
No related merge requests found
Showing with 128 additions and 19 deletions
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
......@@ -273,7 +274,7 @@
<ruleset>${project.basedir}/config/quality-config/pmdrules.xml</ruleset>
</rulesets>
<includeTests>true</includeTests>
<targetJdk>${java.version}</targetJdk>
<targetJdk>${java.version}</targetJdk>
</configuration>
<executions>
<execution>
......@@ -403,6 +404,9 @@
<goals>
<goal>javadoc</goal>
</goals>
<configuration>
<failOnError>true</failOnError>
</configuration>
</execution>
</executions>
</plugin>
......
......@@ -79,6 +79,17 @@ public interface IProjectService {
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void deleteProject(final String projectName) throws ProjectNotExistingException, IOException, ProjectStillRunningException;
/**
* Reloads the displays of the given project.
*
* @param projectName
* The name of the project.
*
* @throws AnalysisDisplayReloadException
* If something went wrong while reloading the displays.
* @throws InvalidAnalysisStateException
* If the analysis is in an invalid state for the operation.
*/
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void reloadDisplays(final String projectName) throws AnalysisDisplayReloadException, InvalidAnalysisStateException;
......@@ -288,6 +299,7 @@ public interface IProjectService {
* @throws AnalysisInitializationException
* If an error occurred during the initialization of the analysis.
* @throws IOException
* If something went wrong while loading the file.
*/
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void initializeAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException,
......@@ -333,6 +345,17 @@ public interface IProjectService {
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void stopAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException;
/**
* Initializes an emergency shutdown.
*
* @param projectName
* The name of the project whose analysis should be stopped.
*
* @throws ProjectNotExistingException
* If a project with the given name does not exist.
* @throws InvalidAnalysisStateException
* If the analysis of the given project is in the wrong state to be stopped.
*/
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void emergencyShutdownOfAnalysis(String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException;
......
......@@ -64,7 +64,9 @@ public final class AnalysisManagementService {
* @throws InvalidAnalysisStateException
* If the analysis is in an invalid state to be initialized.
* @throws IOException
* If something went wrong while loading the file.
* @throws ProjectNotExistingException
* If a project with the given name does not exist.
*/
public void initializeAnalysis(final String projectName) throws InvalidAnalysisStateException, AnalysisInitializationException, ProjectNotExistingException,
IOException {
......@@ -77,6 +79,17 @@ public final class AnalysisManagementService {
this.analyses.put(projectName, analysis);
}
/**
* Reloads the displays of the given project.
*
* @param projectName
* The name of the project.
*
* @throws AnalysisDisplayReloadException
* If something went wrong while reloading the displays.
* @throws InvalidAnalysisStateException
* If the analysis is in an invalid state for the operation.
*/
public void reloadDisplays(final String projectName) throws AnalysisDisplayReloadException, InvalidAnalysisStateException {
// The analysis for the given project must exist!
if (!this.analyses.containsKey(projectName)) {
......@@ -159,6 +172,15 @@ public final class AnalysisManagementService {
analysis.stop();
}
/**
* Initializes an emergency shutdown of the analysis.
*
* @param projectName
* The name of the project.
*
* @throws InvalidAnalysisStateException
* If the analysis is in an invalid state for the operation.
*/
public void emergencyShutdown(final String projectName) throws InvalidAnalysisStateException {
// The analysis for the given project must exist!
if (!this.analyses.containsKey(projectName)) {
......
......@@ -52,26 +52,28 @@ public final class Analysis {
private static final long MAX_THREAD_WAIT_TIME_MS = 1000;
private final Map<String, Map<String, Object>> displayPlugins = new HashMap<String, Map<String, Object>>();
private final Map<String, Map<String, Method>> displayMethods = new HashMap<String, Map<String, Method>>();
private final Map<String, Object> pluginIDMap;
private final ClassContainer classContainer;
private final Object analysisController;
private final Object analysisControllerThread;
private final Map<String, Map<String, Object>> displayPlugins = new HashMap<String, Map<String, Object>>();
private final Map<String, Map<String, Method>> displayMethods = new HashMap<String, Map<String, Method>>();
private Object controllerAndMapping;
private Map<Object, Object> pluginMap;
private Map<String, Object> pluginIDMap;
private final Object controllerAndMapping;
/**
* Creates a new analysis using the given class loader and the given project file.
* Creates a new analysis using the given parameters.
*
* @param projectFile
* The file containing the project to be loaded.
* @param projectName
* The name of the project.
* @param projectDAO
* The data access object for the projects.
*
* @throws AnalysisInitializationException
* If an error occurred during the instantiation of the analysis.
* @throws IOException
* If something went wrong while loading the file.
* @throws ProjectNotExistingException
* If a project with the given name does not exist.
*/
public Analysis(final String projectName, final IProjectDAO projectDAO) throws AnalysisInitializationException, ProjectNotExistingException, IOException {
try {
......@@ -90,10 +92,10 @@ public final class Analysis {
this.analysisController = new Mirror().on(this.controllerAndMapping).invoke().method("getController").withoutArgs();
this.analysisControllerThread = new Mirror().on(analsisControllerThreadClass).invoke().constructor().withArgs(this.analysisController);
this.pluginMap = (Map<Object, Object>) new Mirror().on(this.controllerAndMapping).invoke().method("getPluginMap").withoutArgs();
final Map<Object, Object> pluginMap = (Map<Object, Object>) new Mirror().on(this.controllerAndMapping).invoke().method("getPluginMap").withoutArgs();
this.pluginIDMap = new HashMap<String, Object>();
for (final Map.Entry<Object, Object> entry : this.pluginMap.entrySet()) {
for (final Map.Entry<Object, Object> entry : pluginMap.entrySet()) {
final String key = (String) new Mirror().on(entry.getKey()).invoke().method("getId").withoutArgs();
this.pluginIDMap.put(key, entry.getValue());
}
......@@ -113,6 +115,9 @@ public final class Analysis {
}
/**
* Initializes an emergency shutdown.
*/
public void emergencyShutdown() {
// Not implemented yet
}
......@@ -139,15 +144,12 @@ public final class Analysis {
final String displayName = (String) new Mirror().on(display).invoke().method("getName").withoutArgs();
final String displayConnectorName = (String) new Mirror().on(displayConnector).invoke().method("getName").withoutArgs();
final Object displayParent = new Mirror().on(display).invoke().method("getParent").withoutArgs();
Object plugin = this.pluginMap.get(displayParent);
final String key = (String) new Mirror().on(displayParent).invoke().method("getId").withoutArgs();
final Object plugin = this.pluginIDMap.get(key);
if (plugin == null) {
// Try to find the element in the plugin ID map
final String key = (String) new Mirror().on(displayParent).invoke().method("getId").withoutArgs();
plugin = this.pluginIDMap.get(key);
if (plugin == null) {
continue;
}
continue;
}
final Method[] methods = plugin.getClass().getMethods();
......@@ -166,6 +168,17 @@ public final class Analysis {
}
}
/**
* Reloads the displays of the given project.
*
* @param projectName
* The name of the project.
* @param projectDAO
* The data access object for the projects.
*
* @throws AnalysisDisplayReloadException
* If something went wrong while reloading the displays.
*/
public void reloadDisplays(final String projectName, final IProjectDAO projectDAO) throws AnalysisDisplayReloadException {
try {
final File projectFile = projectDAO.getProjectFile(projectName);
......
......@@ -228,10 +228,22 @@ public final class CockpitEditorBean {
this.setModificationsFlag();
}
/**
* Copies a view.
*
* @param copyViewBean
* The bean containing the necessary data to copy the view.
*/
public void copyView(final CopyViewBean copyViewBean) {
// Not implemented yet
}
/**
* Edits an existing view.
*
* @param editViewBean
* The bean containing the necessary data to edit the view.
*/
public void editView(final EditViewBean editViewBean) {
if ((this.project != null) && this.checkViewName(editViewBean.getViewName(), editViewBean.getMessageTarget().getClientId())) {
this.selectedView.setName(editViewBean.getViewName());
......@@ -376,6 +388,9 @@ public final class CockpitEditorBean {
this.availableComponents = this.projectService.getAvailableComponents(this.projectName);
}
/**
* Performs an update on the dashboard once a name has been changed.
*/
public void updateName() {
this.fillDashboard();
}
......
......@@ -96,6 +96,9 @@ public final class ControllerBean {
}
/**
* Reloads the cockpit displays of the current project.
*/
public void reloadCockpit() {
try {
this.projectService.reloadDisplays(this.projectName);
......@@ -126,6 +129,9 @@ public final class ControllerBean {
}
}
/**
* Initializes an emergency shutdown.
*/
public void emergencyShutdown() {
try {
this.addLogEntry(this.globalPropertiesBean.getLogMsgEmergencyShutdown());
......
......@@ -88,6 +88,12 @@ public final class ProjectOverviewBean {
}
}
/**
* Adds a project to the application, using the given project bean.
*
* @param newProjectBean
* The bean containing the necessary data to create the project.
*/
public void addProject(final NewProjectBean newProjectBean) {
try {
final String projectName = newProjectBean.getProjectName();
......
......@@ -31,6 +31,16 @@ public final class AddPluginCommand extends AbstractEditorCommand {
private final MIPlugin plugin;
private final AnalysisEditorGraphBean graphBean;
/**
* Creates a new instance of this class using the given parameters.
*
* @param parent
* The parent project in which a plugin should be added.
* @param plugin
* The plugin which should be added.
* @param graphBean
* The corresponding graph bean.
*/
public AddPluginCommand(final MIProject parent, final MIPlugin plugin, final AnalysisEditorGraphBean graphBean) {
this.parent = parent;
this.plugin = plugin;
......
......@@ -29,6 +29,16 @@ public class DeletePluginCommand extends AbstractEditorCommand {
private final MIPlugin plugin;
private final AnalysisEditorGraphBean graphBean;
/**
* Creates a new instance of this class using the given parameters.
*
* @param parent
* The parent project in which a plugin should be deleted.
* @param plugin
* The plugin which should be deleted.
* @param graphBean
* The corresponding graph bean.
*/
public DeletePluginCommand(final MIProject parent, final MIPlugin plugin, final AnalysisEditorGraphBean graphBean) {
this.parent = parent;
this.plugin = 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