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

Refactoring, modifications for the quality tools, and minor bug fixing

parent 7216787a
No related branches found
No related tags found
No related merge requests found
Showing
with 587 additions and 516 deletions
......@@ -89,7 +89,7 @@ sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=false
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
......
......@@ -15,6 +15,7 @@
***************************************************************************/
package kieker.webgui.domain;
import java.util.Collections;
import java.util.List;
import kieker.webgui.domain.pluginDecorators.FilterDecorator;
......@@ -30,6 +31,10 @@ import kieker.webgui.domain.pluginDecorators.RepositoryDecorator;
*/
public class ComponentListContainer {
/** This constant represents an immutable and empty container. */
public static final ComponentListContainer EMPTY_CONTAINER = new ComponentListContainer(Collections.<ReaderDecorator>emptyList(),
Collections.<FilterDecorator>emptyList(), Collections.<RepositoryDecorator>emptyList());
private final List<ReaderDecorator> readers;
private final List<FilterDecorator> filters;
private final List<RepositoryDecorator> repositories;
......
......@@ -887,6 +887,11 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener {
}
/**
* A simple function to convert repository classes to model instances.
*
* @author Nils Christian Ehmke
*/
private class ConvertRepositoryClass2ModelInstanceFunction implements Function<Class<AbstractRepository>, RepositoryDecorator> {
private final ClassAndMethodContainer classAndMethodContainer;
......@@ -906,6 +911,11 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener {
}
/**
* A simple function to convert reader classes to model instances.
*
* @author Nils Christian Ehmke
*/
private class ConvertReaderClass2ModelInstanceFunction implements Function<Class<AbstractReaderPlugin>, ReaderDecorator> {
private final ClassAndMethodContainer classAndMethodContainer;
......@@ -925,6 +935,11 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener {
}
/**
* A simple function to convert filter classes to model instances.
*
* @author Nils Christian Ehmke
*/
private class ConvertFilterClass2ModelInstanceFunction implements Function<Class<AbstractFilterPlugin>, FilterDecorator> {
private final ClassAndMethodContainer classAndMethodContainer;
......
......@@ -34,6 +34,7 @@ import kieker.analysis.model.analysisMetaModel.MIPlugin;
import kieker.analysis.model.analysisMetaModel.MIProperty;
import kieker.analysis.model.analysisMetaModel.MIReader;
import kieker.analysis.model.analysisMetaModel.MIRepository;
import kieker.analysis.model.analysisMetaModel.MIRepositoryConnector;
import kieker.analysis.plugin.AbstractPlugin;
import kieker.analysis.plugin.filter.AbstractFilterPlugin;
import kieker.analysis.plugin.reader.AbstractReaderPlugin;
......@@ -122,6 +123,7 @@ public class Class2ModelInstanceConverter {
final Collection<MIInputPort> inputPorts = new ArrayList<MIInputPort>();
final Collection<MIOutputPort> outputPorts = new ArrayList<MIOutputPort>();
final Collection<MIDisplay> displays = new ArrayList<MIDisplay>();
final Collection<MIRepositoryConnector> repositories = new ArrayList<MIRepositoryConnector>();
final Map<String, String> propertyDescriptions = new HashMap<String, String>();
final Map<String, String> displayDescriptions = new HashMap<String, String>();
String description = "";
......@@ -131,14 +133,15 @@ public class Class2ModelInstanceConverter {
try {
description = this.fillDescription(clazz, classAndMethodContainer);
dependency = this.fillDependency(clazz, classAndMethodContainer);
this.fillProperties(clazz, classAndMethodContainer, properties, propertyDescriptions);
plugin.getProperties().addAll(properties);
if ((type == Type.Filter) || (type == Type.Reader)) {
this.fillOutputPorts((Class<AbstractPlugin>) clazz, classAndMethodContainer, outputPorts, (MIPlugin) plugin);
this.fillDisplays((Class<AbstractPlugin>) clazz, classAndMethodContainer, displays, displayDescriptions);
this.fillRepositories((Class<AbstractPlugin>) clazz, classAndMethodContainer, repositories);
((MIPlugin) plugin).getOutputPorts().addAll(outputPorts);
((MIPlugin) plugin).getDisplays().addAll(displays);
((MIPlugin) plugin).getRepositories().addAll(repositories);
if (type == Type.Filter) {
this.fillInputPorts((Class<AbstractFilterPlugin>) clazz, classAndMethodContainer, inputPorts, (MIFilter) plugin);
((MIFilter) plugin).getInputPorts().addAll(inputPorts);
......@@ -255,6 +258,19 @@ public class Class2ModelInstanceConverter {
}
}
private void fillRepositories(final Class<? extends AbstractPlugin> clazz, final ClassAndMethodContainer classAndMethodContainer,
final Collection<MIRepositoryConnector> repositories) {
final Annotation annotation = this.getSuitableAnnotation(clazz, classAndMethodContainer);
final Annotation[] repositoryPortAnnotations = (Annotation[]) new Mirror().on(annotation).invoke().method("repositoryPorts").withoutArgs();
for (final Annotation repositoryPortAnnotation : repositoryPortAnnotations) {
final MIRepositoryConnector newConnector = Class2ModelInstanceConverter.FACTORY.createRepositoryConnector();
newConnector.setName((String) new Mirror().on(repositoryPortAnnotation).invoke().method("name").withoutArgs());
repositories.add(newConnector);
}
}
private String fillDependency(final Class<? extends AbstractAnalysisComponent> clazz, final ClassAndMethodContainer classAndMethodContainer) {
final Annotation annotation = this.getSuitableAnnotation(clazz, classAndMethodContainer);
return (String) new Mirror().on(annotation).invoke().method("dependencies").withoutArgs();
......
......@@ -61,6 +61,9 @@ public interface IProjectService {
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void addProject(final String projectName, final String username) throws ProjectAlreadyExistingException, IOException;
/**
* Updates the displays of all analyses.
*/
public void updateAllAnalyses();
/**
......
......@@ -223,10 +223,16 @@ public class ACManager {
return retState;
}
/**
* Updates the displays from the given project.
*
* @param projectName
* The project to update.
*/
public void updateDisplays(final String projectName) {
if (this.analyses.containsKey(projectName)) {
this.analyses.get(projectName).updateDisplays();
}
// if (this.analyses.containsKey(projectName)) {
// this.analyses.get(projectName).updateDisplays();
// }
}
}
......@@ -18,8 +18,6 @@ package kieker.webgui.service.impl.util;
import java.io.File;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import kieker.analysis.AnalysisController;
import kieker.common.logging.Log;
......@@ -47,8 +45,8 @@ public class Analysis {
private final Object analysisController;
private final Object analysisControllerThread;
private final Map<String, Map<String, Object>> displayObjects = new HashMap<String, Map<String, Object>>();
private final Map<String, Map<String, Method>> displayMethods = new HashMap<String, Map<String, Method>>();
// private final Map<String, Map<String, Object>> displayObjects = new HashMap<String, Map<String, Object>>();
// private final Map<String, Map<String, Method>> displayMethods = new HashMap<String, Map<String, Method>>();
/**
* Creates a new instance of this class using the given parameters.
......@@ -152,7 +150,7 @@ public class Analysis {
AnalysisController.class.getName());
}
public void updateDisplays() {
// public void updateDisplays() {
}
// }
}
......@@ -18,12 +18,15 @@ package kieker.webgui.web.beans.application;
import java.io.Serializable;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
import javax.faces.application.FacesMessage.Severity;
import javax.faces.context.FacesContext;
import kieker.common.record.AbstractMonitoringRecord;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
......@@ -217,4 +220,28 @@ public class GlobalPropertiesBean implements Serializable {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, "", msg));
}
/**
* This method reads parameters from the request parameter map of the current context. The parameters are converted to actual objects, based on the given types.
* It is assumed (but not checked) that both arrays have the same size.
*
* @param parameterNames
* The name of the parameters within the request parameter map.
* @param types
* The actual types of the parameters. The method will try to convert the strings to those types.
*
* @return An array containing the actual parameter objects.
*/
public static Object[] convertObjectsFromParameterMap(final String[] parameterNames, final Class<?>[] types) {
final int numberOfObjects = parameterNames.length;
final Map<String, String> parameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
final String[] parameters = new String[numberOfObjects];
for (int i = 0; i < numberOfObjects; i++) {
parameters[i] = parameterMap.get(parameterNames[i]);
}
// We can borrow a method from the Kieker framework to convert the strings
return AbstractMonitoringRecord.fromStringArrayToTypedArray(parameters, types);
}
}
......@@ -30,7 +30,7 @@
<br />
<br />
<h:form enctype="multipart/form-data">
<p:fileUpload label="#{localizedMessages.choose}" cancelLabel="#{localizedMessages.cancel}" auto="true" allowTypes="/(\.|\/)(jar)$/" sizeLimit="104857600" mode="advanced" fileUploadListener="#{currentAnalysisEditorBean.handleFileUpload}" update=":dependenciesForm :messages :toolpalette"/>
<p:fileUpload label="#{localizedMessages.choose}" cancelLabel="#{localizedMessages.cancel}" auto="true" allowTypes="/(\.|\/)(jar)$/" sizeLimit="104857600" mode="advanced" fileUploadListener="#{currentAnalysisEditorBean.handleLibraryFileUpload}" update=":dependenciesForm :messages :toolpalette"/>
</h:form>
</div>
<hr/>
......
......@@ -39,7 +39,11 @@
</ui:define>
<ui:define name="js">
<script>
<script>
nodeEnterListener = function() {
graph.setMouseCursor('pointer');
}
nodeClickListener = function(node, info, e) {
nodeClickCommand([{name : 'ID', value : node.id}]);
markNode(node, '#FF0000');
......
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