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

Added some comments.

parent 02d68ab0
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,9 @@ public interface IProjectService {
* @throws IOException
* If something went wrong during the removing.
* @throws ProjectStillRunningException
* If the project is still running.
* @throws LockProjectException
* If the project could not be locked.
*/
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void deleteProject(final String projectName) throws ProjectNotExistingException, IOException, ProjectStillRunningException, LockProjectException;
......@@ -121,6 +123,7 @@ public interface IProjectService {
* @throws IOException
* If something went wrong during the creation of the target-project or during the loading of the source-project.
* @throws LockProjectException
* If the project could not be locked.
*/
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void copyProject(final String originalProjectName, final String newProjectName) throws ProjectNotExistingException, ProjectAlreadyExistingException,
......
......@@ -381,6 +381,7 @@ public class ProjectServiceImpl implements IProjectService {
* The map containing the locks.
*
* @throws LockProjectException
* If the project could not be locked.
*/
public static void tryLockProjects(final String projectNameA, final ConcurrentHashMap<String, Semaphore> lockMapA, final String projectNameB,
final ConcurrentHashMap<String, Semaphore> lockMapB) throws LockProjectException {
......
......@@ -29,7 +29,6 @@ import kieker.common.logging.Log;
import kieker.common.logging.LogFactory;
import kieker.webgui.common.ClassContainer;
import kieker.webgui.common.exception.AnalysisInitializationException;
import kieker.webgui.common.exception.InvalidAnalysisStateException;
import kieker.webgui.common.exception.ReflectionException;
import kieker.webgui.domain.DisplayType;
......@@ -42,6 +41,7 @@ import net.vidageek.mirror.exception.MirrorException;
*
* @author Nils Christian Ehmke
*/
// TODO Some of the methods should throw an InvalidAnalysisStateException, but do not do so, due to the usage of mirror.
public class Analysis {
private static final Log LOG = LogFactory.getLog(Analysis.class);
......@@ -143,7 +143,7 @@ public class Analysis {
/**
* Starts the analysis.
*/
public void start() throws InvalidAnalysisStateException {
public void start() {
try {
new Mirror().on(this.analysisControllerThread).invoke().method("start").withoutArgs();
} catch (final MirrorException ex) {
......
......@@ -197,6 +197,12 @@ public class CurrentAnalysisEditorGraphBean {
this.addConnections(project.getPlugins());
}
/**
* Adds a non removable node for the global configuration of the project.
*
* @param globalConfigurationInstance
* The non removable node to be added.
*/
public void addGlobalConfigurationInstance(final MIAnalysisComponent globalConfigurationInstance) {
final String name = this.globalPropertiesBean.getGlobalConfigurationComponentName();
final int id = this.componentMap.get(globalConfigurationInstance);
......@@ -204,55 +210,140 @@ public class CurrentAnalysisEditorGraphBean {
RequestContext.getCurrentInstance().execute(String.format(JS_CMD_ADD_GLOBAL_COMPONENT, "id" + id, name, name, "id" + id));
}
/**
* Adds a reader to the graph.
*
* @param reader
* The reader to be added.
*/
public void addComponent(final MIReader reader) {
final String cmd = String.format(JS_CMD_ADD_READER, this.assembleGraphString(reader), this.assembleGraphRepositoryPortString(reader.getRepositories()),
this.assembleGraphOutputPortString(reader));
RequestContext.getCurrentInstance().execute(cmd);
}
/**
* Adds a filter to the graph.
*
* @param filter
* The filter to be added.
*/
public void addComponent(final MIFilter filter) {
final String cmd = String.format(JS_CMD_ADD_FILTER, this.assembleGraphString(filter), this.assembleGraphRepositoryPortString(filter.getRepositories()),
this.assembleGraphInputPortString(filter), this.assembleGraphOutputPortString(filter));
RequestContext.getCurrentInstance().execute(cmd);
}
/**
* Adds a repository to the graph.
*
* @param repository
* The repository to be added.
*/
public void addComponent(final MIRepository repository) {
final String repoPort = String.format(JS_TEMPLATE_PORT, JS_PORT_TYPE_INPUT, REPOSITORY_INPUT_PORT, "N/A");
final String cmd = String.format(JS_CMD_ADD_REPO, this.assembleGraphString(repository), repoPort);
RequestContext.getCurrentInstance().execute(cmd);
}
/**
* Deletes a component from the graph.
*
* @param component
* The component to be deleted.
*/
public void deleteComponent(final MIAnalysisComponent component) {
// No code necessary currently
}
/**
* Renames a component within the graph.
*
* @param component
* The component to rename.
* @param newName
* The new name of the component.
*/
public void renameComponent(final MIAnalysisComponent component, final String newName) {
final String cmd = String.format(JS_CMD_RENAME_NODE, "id" + this.componentMap.get(component), CurrentAnalysisEditorGraphBean.simpleEscape(newName));
RequestContext.getCurrentInstance().execute(cmd);
}
/**
* Adds a connection between two components to the graph.
*
* @param source
* The source node.
* @param target
* The target node.
* @param outputPort
* The output port of the source node.
* @param inputPort
* The input port of the target node.
*/
public void addConnection(final MIPlugin source, final MIPlugin target, final MIOutputPort outputPort, final MIInputPort inputPort) {
final String cmd = String.format(JS_CMD_ADD_EDGE, this.assembleGraphPortID(source, outputPort), this.assembleGraphPortID(target, inputPort), "");
RequestContext.getCurrentInstance().execute(cmd);
}
/**
* Adds a connection between two components to the graph.
*
* @param source
* The source node.
* @param target
* The target node.
* @param repositoryPort
* The repository port of the source node.
*/
public void addConnection(final MIPlugin source, final MIRepository target, final MIRepositoryConnector repositoryPort) {
final String cmd = String.format(JS_CMD_ADD_EDGE, this.assembleGraphPortID(source, repositoryPort), this.assembleGraphPortID(target), "");
RequestContext.getCurrentInstance().execute(cmd);
}
/**
* Deletes a connection between two components within the graph.
*
* @param source
* The source node.
* @param target
* The target node.
* @param outputPort
* The output port of the source node.
* @param inputPort
* The input port of the target node.
*/
public void deleteConnection(final MIPlugin source, final MIPlugin target, final MIOutputPort outputPort, final MIInputPort inputPort) {
// No code necessary currently
}
/**
* Deletes a connection between two components within the graph.
*
* @param source
* The source node.
* @param target
* The target node.
* @param repositoryPort
* The repository port of the source node.
*/
public void deleteConnection(final MIPlugin source, final MIRepository target, final MIRepositoryConnector repositoryPort) {
// No code necessary currently
}
/**
* Selects a given component.
*
* @param analysisComponent
* The component to select.
*/
public void selectComponent(final MIAnalysisComponent analysisComponent) {
// No code necessary currently
}
/**
* Switches the visibility of the grid.
*/
public void switchGrid() {
if (this.gridEnabled) {
RequestContext.getCurrentInstance().execute(JS_CMD_DISABLE_GRID);
......@@ -263,6 +354,9 @@ public class CurrentAnalysisEditorGraphBean {
this.gridEnabled = !this.gridEnabled;
}
/**
* Switches the state of the snap mode.
*/
public void switchSnap() {
if (this.snapEnabled) {
RequestContext.getCurrentInstance().execute(JS_CMD_DISABLE_SNAP);
......@@ -281,29 +375,56 @@ public class CurrentAnalysisEditorGraphBean {
return this.snapEnabled;
}
/**
* Sets the color of the grid to a new value.
*
* @param color
* The new color of the grid.
*/
public void setGridColor(final String color) {
final String cmd = String.format(JS_CMD_SET_GRID_COLOR, "#" + color);
RequestContext.getCurrentInstance().execute(cmd);
}
/**
* Sets the size of the grid to a new value.
*
* @param size
* The new size of the grid.
*/
public void setGridSize(final int size) {
final String cmd = String.format(JS_CMD_SET_GRID_SIZE, size);
RequestContext.getCurrentInstance().execute(cmd);
}
/**
* Scales the graph to fit into the window.
*/
public void scaleToFit() {
RequestContext.getCurrentInstance().execute(JS_CMD_SCALE_TO_FIT);
}
/**
* Starts the auto layout of the graph.
*/
public void startAutoLayout() {
RequestContext.getCurrentInstance().execute(JS_CMD_START_AUTO_LAYOUT);
}
/**
* Loads a layout for the graph.
*
* @param layout
* The new layout of the graph.
*/
public void loadLayout(final String layout) {
final String cmd = String.format(JS_CMD_LOAD_FROM_LAYOUT, layout);
RequestContext.getCurrentInstance().execute(cmd);
}
/**
* This method is called from JavaScript. It represents the event that a component has been selected.
*/
public void jsSelectComponentEvent() {
// Get the parameters
final Object[] parameters = GlobalPropertiesBean.convertObjectsFromParameterMap(PARAMETER_NAMES_CLICK_AND_REMOVE_NODES,
......@@ -332,6 +453,9 @@ public class CurrentAnalysisEditorGraphBean {
}
/**
* This method is called from JavaScript. It represents the event that a component has been deleted.
*/
public void jsDeleteComponentEvent() {
// Get the parameters
final Object[] parameters = GlobalPropertiesBean.convertObjectsFromParameterMap(PARAMETER_NAMES_CLICK_AND_REMOVE_NODES,
......@@ -352,6 +476,9 @@ public class CurrentAnalysisEditorGraphBean {
}
}
/**
* This method is called from JavaScript. It represents the event that a connection has been added.
*/
public void jsAddConnectionEvent() {
// Get the parameters
final Object[] parameters = GlobalPropertiesBean.convertObjectsFromParameterMap(PARAMETER_NAMES_ADD_AND_REMOVE_EDGES, PARAMETER_TYPES_ADD_AND_REMOVE_EDGES);
......@@ -398,6 +525,9 @@ public class CurrentAnalysisEditorGraphBean {
}
}
/**
* This method is called from JavaScript. It represents the event that a connection has been deleted.
*/
public void jsDeleteConnectionEvent() {
// Get the parameters
final Object[] parameters = GlobalPropertiesBean.convertObjectsFromParameterMap(PARAMETER_NAMES_ADD_AND_REMOVE_EDGES, PARAMETER_TYPES_ADD_AND_REMOVE_EDGES);
......@@ -433,6 +563,9 @@ public class CurrentAnalysisEditorGraphBean {
}
}
/**
* This method is called from JavaScript. It represents the event that the auto layout has been started.
*/
public void jsAutoLayoutEvent() {
try {
// Get the parameters
......
......@@ -262,6 +262,11 @@ public class CurrentCockpitBean {
return false;
}
/**
* Checks whether the analysis is currently terminating.
*
* @return true if and only if the analysis is currently terminating.
*/
public boolean isAnalysisTerminating() {
try {
return this.projectService.getCurrentState(this.projectName) == AnalysisController.STATE.TERMINATING;
......
......@@ -172,6 +172,11 @@ public class CurrentControllerBean {
return false;
}
/**
* Checks whether the analysis is currently terminating.
*
* @return true if and only if the analysis is currently terminating.
*/
public boolean isAnalysisTerminating() {
try {
return this.projectService.getCurrentState(this.projectName) == AnalysisController.STATE.TERMINATING;
......
......@@ -23,20 +23,66 @@ import kieker.analysis.model.analysisMetaModel.MIRepository;
import kieker.analysis.model.analysisMetaModel.MIRepositoryConnector;
/**
* This interface should be implemented by classes, which are observing a graph. The listeners are informed about events within the graph.
*
* @author Nils Christian Ehmke
*/
public interface IGraphListener {
/**
* An event occurring when a component has been selected.
*
* @param selectedComponent
* The selected component.
*/
public void componentSelectedEvent(MIAnalysisComponent selectedComponent);
/**
* An event occurring when a component has been deleted.
*
* @param deletedComponent
* The deleted component.
*/
public void componentDeletedEvent(MIAnalysisComponent deletedComponent);
public void connectionAddedEvent(MIRepositoryConnector sourcePort, MIRepository target);
/**
* An event occurring when a connection has been created.
*
* @param sourcePort
* The source port.
* @param targetRepo
* The target.
*/
public void connectionAddedEvent(MIRepositoryConnector sourcePort, MIRepository targetRepo);
public void connectionAddedEvent(MIOutputPort outputPort, MIInputPort targetPort);
/**
* An event occurring when a connection has been created.
*
* @param sourcePort
* The source port.
* @param targetPort
* The target port.
*/
public void connectionAddedEvent(MIOutputPort sourcePort, MIInputPort targetPort);
/**
* An event occurring when a connection has been deleted.
*
* @param sourcePort
* The source port.
* @param targetRepo
* The target.
*/
public void connectionDeletedEvent(MIRepositoryConnector sourcePort, MIRepository targetRepo);
/**
* An event occurring when a connection has been deleted.
*
* @param sourcePort
* The source port.
* @param targetPort
* The target port.
*/
public void connectionDeletedEvent(MIOutputPort sourcePort, MIInputPort targetPort);
}
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