diff --git a/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar b/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar index 2b90350faeb6f5183920c7db2904a0c67012dc01..602b5194f4809d48124453bbefdc43664cc4974d 100644 Binary files a/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar and b/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar differ diff --git a/Kieker.WebGUI/pom.xml b/Kieker.WebGUI/pom.xml index e160f04d7b1ab9fdfbe7f6b8e36a2d7642cacff8..328f387d021cf4036dad99c2e61e44c79f2aaf01 100644 --- a/Kieker.WebGUI/pom.xml +++ b/Kieker.WebGUI/pom.xml @@ -86,7 +86,7 @@ <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> - <version>3.4-SNAPSHOT</version> + <version>3.4.RC1</version> </dependency> <dependency> <groupId>org.primefaces.themes</groupId> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java index 3620b05cd47e733a2862f799efca6d4484c56e1e..fd83efb10ddae607ccfa663525a8b2202a0d128e 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java @@ -49,6 +49,7 @@ import kieker.analysis.model.analysisMetaModel.MIPlugin; import kieker.analysis.model.analysisMetaModel.MIPort; import kieker.analysis.model.analysisMetaModel.MIProject; 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.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; @@ -96,6 +97,42 @@ import org.eclipse.emf.ecore.EObject; @ManagedBean @ViewScoped public final class CurrentAnalysisEditorBean { + /** + * This is the javascript command to initialize the visual graph. + */ + private static final String JS_CMD_INIT_GRAPH = "var graph = GraphFlow(); graph.initGraph(null);"; + /** + * This is the javascript command for a node object. + */ + private static final String JS_CMD_NODE = "{\"id\":\"%s\", \"name\":\"%s\", \"nodeClass\":\"%s\", \"tooltip\":\"%s\"}"; + /** + * This is the javascript command for a port object. + */ + private static final String JS_CMD_PORT = "{\"name\":\"%s\",\"id\":\"%s\", \"tooltip\":\"%s\"}"; + /** + * This is the javascript type name for an input port. + */ + private static final String JS_CMD_PORT_TYPE_INPUT = "inputPort"; + /** + * This is the javascript command to add a filter to the graph. + */ + private static final String JS_CMD_ADD_FILTER = "graph.addFilter(%d, %d, %s,[%s],[%s],[%s]);"; + /** + * This is the javascript command to add a reader to the graph. + */ + private static final String JS_CMD_ADD_READER = "graph.addReader(%d, %d, %s,[%s],[%s]);"; + /** + * This is the javascript command to add a repository to the graph. + */ + private static final String JS_CMD_ADD_REPOSITORY = "graph.addRepository(%d, %d, %s,%s);"; + /** + * This is the javascript command to add an edge to the graph. + */ + private static final String JS_CMD_ADD_EDGE = "graph.addEdge(\"%s\", \"%s\");"; + /** + * This is the javascript command to redraw the command. + */ + private static final String JS_CMD_REFRESH_GRAPH = "graph.refresh();"; /** * This is the log for errors, exceptions etc. */ @@ -908,6 +945,15 @@ public final class CurrentAnalysisEditorBean { // Add it to the project this.project.getRepositories().add(repository); this.repositoryMap.get(repository); + + // Add the element to the graph + final RequestContext context = RequestContext.getCurrentInstance(); + + final int pos = ((this.project.getRepositories().size() - 1) * 100) - 250; + final String repoPort = String.format(CurrentAnalysisEditorBean.JS_CMD_PORT, CurrentAnalysisEditorBean.JS_CMD_PORT_TYPE_INPUT, "ip1", "N/A"); + context.execute(String.format(CurrentAnalysisEditorBean.JS_CMD_ADD_REPOSITORY, 0, pos, this.assembleGraphString(repository), repoPort)); + + context.execute(CurrentAnalysisEditorBean.JS_CMD_REFRESH_GRAPH); } } } @@ -954,6 +1000,21 @@ public final class CurrentAnalysisEditorBean { for (final MIRepositoryConnector mConnector : mConnectors) { this.filter2repositoryConnections.add(new ConnectionFilterToRepository(plugin, mConnector.getRepository(), mConnector)); } + + // Add the element to the graph + final RequestContext context = RequestContext.getCurrentInstance(); + + final int pos = (this.project.getPlugins().size() - 1) * 100; + if (plugin instanceof MIReader) { + context.execute(String.format(CurrentAnalysisEditorBean.JS_CMD_ADD_READER, pos, pos, this.assembleGraphString(plugin), + this.assembleGraphRepositoryPortString(plugin), this.assembleGraphOuputPortString(plugin))); + } else { + context.execute(String.format(CurrentAnalysisEditorBean.JS_CMD_ADD_FILTER, pos, pos, this.assembleGraphString(plugin), + this.assembleGraphRepositoryPortString(plugin), this.assembleGraphInputPortString((MIFilter) plugin), + this.assembleGraphOuputPortString(plugin))); + } + + context.execute(CurrentAnalysisEditorBean.JS_CMD_REFRESH_GRAPH); } } } @@ -1366,4 +1427,200 @@ public final class CurrentAnalysisEditorBean { public MIRepository getRepositoryByID(final String string) { return this.repositoryMap.get(Integer.parseInt(string)); } + + /** + * This method initializes the modified jit-graph by delivering the necessary javascript commands to the client. It prints all current existing plugins, + * repositories and their connections. All further components will be added mostly by other methods. + */ + public void initializeGraph() { + final RequestContext context = RequestContext.getCurrentInstance(); + // Make sure that the graph exists in the first place + context.execute(CurrentAnalysisEditorBean.JS_CMD_INIT_GRAPH); + // Initialize the listener for the clicks on the components + context.execute("graph.addListener(\"onClick\", nodeClickListener);"); + + // Paint all necessary components + this.initializeGraphPlugins(); + this.initializeGraphRepositories(); + this.initializeGraphConnections(); + + // Repaint the whole graph to make sure that everything will be shown. + context.execute(CurrentAnalysisEditorBean.JS_CMD_REFRESH_GRAPH); + } + + /** + * This method initializes the modified jit-grpah by delivering the necessary javascript commands to paint the connections between the components. + */ + private void initializeGraphConnections() { + final RequestContext context = RequestContext.getCurrentInstance(); + + // First the connections between the filters + for (final ConnectionFilterToFilter connection : this.filter2filterConnections) { + context.execute(String.format(CurrentAnalysisEditorBean.JS_CMD_ADD_EDGE, this.assembleGraphPortID(connection.getSource(), connection.getOutputPort()), + this.assembleGraphPortID(connection.getDestination(), connection.getInputPort()))); + } + + // TODO Now the connections between filters and repositories + } + + public void nodeClicked() { + final Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); + final String clickedNodeType = paramMap.get("type"); + final String clickedNodeID = paramMap.get("ID"); + + // Select the correct plugin/repository, based on type and ID + if ("Filter".equalsIgnoreCase(clickedNodeType) || "Reader".equalsIgnoreCase(clickedNodeType)) { + // Try to find the ID as a filter/reader + this.setSelectedPlugin(this.pluginMap.get(Integer.parseInt(clickedNodeID))); + } else { + // Try to find the ID as a repository + this.setSelectedRepository(this.repositoryMap.get(Integer.parseInt(clickedNodeID))); + } + } + + /** + * This method initializes the modified jit-graph by delivering the necessary javascript commands to paint the repository components. + */ + private void initializeGraphRepositories() { + final RequestContext context = RequestContext.getCurrentInstance(); + + int posCounter = 0; + for (final MIRepository repository : this.project.getRepositories()) { + final int pos = (posCounter * 100) - 250; + final String repoPort = String.format(CurrentAnalysisEditorBean.JS_CMD_PORT, CurrentAnalysisEditorBean.JS_CMD_PORT_TYPE_INPUT, "ip1", "N/A"); + context.execute(String.format(CurrentAnalysisEditorBean.JS_CMD_ADD_REPOSITORY, 0, pos, this.assembleGraphString(repository), repoPort)); + posCounter++; + } + } + + /** + * This method initializes the modified jit-graph by delivering the necessary javascript commands to paint the plugin components. + */ + private void initializeGraphPlugins() { + final RequestContext context = RequestContext.getCurrentInstance(); + + int posCounter = 0; + for (final MIPlugin plugin : this.project.getPlugins()) { + final int pos = posCounter * 100; + if (plugin instanceof MIReader) { + context.execute(String.format(CurrentAnalysisEditorBean.JS_CMD_ADD_READER, pos, pos, this.assembleGraphString(plugin), + this.assembleGraphRepositoryPortString(plugin), this.assembleGraphOuputPortString(plugin))); + } else { + context.execute(String.format(CurrentAnalysisEditorBean.JS_CMD_ADD_FILTER, pos, pos, this.assembleGraphString(plugin), + this.assembleGraphRepositoryPortString(plugin), this.assembleGraphInputPortString((MIFilter) plugin), + this.assembleGraphOuputPortString(plugin))); + } + posCounter++; + } + } + + /** + * This method assembles the string containing the given ports. + * + * @param ports + * The ports to be used within the string command. + * @return A string containing the JS commands to create the ports. + */ + private String assembleGraphPortString(final EList<? extends MIPort> ports) { + final StringBuilder builder = new StringBuilder(); + final int len = ports.size(); + + for (int i = 0; i < len; i++) { + final MIPort port = ports.get(i); + + if (i != 0) { + builder.append(','); + } + + builder.append(String.format(CurrentAnalysisEditorBean.JS_CMD_PORT, port.getName(), this.portMap.get(port), port.getName())); + } + + return builder.toString(); + } + + /** + * This method assembles the string containing the available repository ports of the given plugin. + * + * @param plugin + * The plugin whose repository ports will be used. + * @return A string containing the JS commands to create the repository ports. + */ + private String assembleGraphRepositoryPortString(final MIPlugin plugin) { + final StringBuilder builder = new StringBuilder(); + final int len = plugin.getRepositories().size(); + + for (int i = 0; i < len; i++) { + final MIRepositoryConnector port = plugin.getRepositories().get(i); + + if (i != 0) { + builder.append(','); + } + + builder.append(String.format(CurrentAnalysisEditorBean.JS_CMD_PORT, port.getName(), port.getName(), port.getName())); + } + + return builder.toString(); + } + + /** + * This method assembles the string containing the available input ports of the given filter. + * + * @param filter + * The filter whose input ports will be used. + * @return A string containing the JS commands to create the input ports. + */ + private String assembleGraphInputPortString(final MIFilter filter) { + return this.assembleGraphPortString(filter.getInputPorts()); + } + + /** + * This method assembles the string containing the available output ports of the given plugin. + * + * @param plugin + * The plugin whose output ports will be used. + * @return A string containing the JS commands to create the output ports. + */ + private String assembleGraphOuputPortString(final MIPlugin plugin) { + return this.assembleGraphPortString(plugin.getOutputPorts()); + } + + /** + * This method assembles the ID of the port for the graph based on the given parameters. + * + * @param plugin + * The parent plugin of the port. + * @param port + * The port itself. + * @return The ID for the port within the graph + */ + private String assembleGraphPortID(final MIPlugin plugin, final MIPort port) { + return this.pluginMap.get(plugin) + "_" + this.portMap.get(port); + } + + /** + * Assembles a human-readable string of the given repository, which can also be used as a graph ID. + * + * @param repository + * The repository whose ID should be delivered. + * @return A human readable ID. + */ + private String assembleGraphString(final MIRepository repository) { + final String className = repository.getClassname(); + final String shortName = className.substring(className.lastIndexOf('.') + 1); + return String.format(CurrentAnalysisEditorBean.JS_CMD_NODE, this.repositoryMap.get(repository), repository.getName(), shortName, className); + } + + /** + * Assembles a human-readable string of the given plugin, which can also be used as a graph ID. + * + * @param plugin + * The plugin whose ID should be delivered. + * @return A human readable ID. + */ + private String assembleGraphString(final MIPlugin plugin) { + final String className = plugin.getClassname(); + final String shortName = className.substring(className.lastIndexOf('.') + 1); + return String.format(CurrentAnalysisEditorBean.JS_CMD_NODE, this.pluginMap.get(plugin), plugin.getName(), shortName, className); + } + } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBeanV2.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBeanV2.java deleted file mode 100644 index 97fdc0a3e5b1291bab1964ccbce7a2455ac8b405..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBeanV2.java +++ /dev/null @@ -1,1536 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ - -package kieker.webgui.beans.view; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.faces.application.FacesMessage; -import javax.faces.application.FacesMessage.Severity; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.ManagedProperty; -import javax.faces.bean.ViewScoped; -import javax.faces.context.FacesContext; - -import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; -import kieker.analysis.model.analysisMetaModel.MIDependency; -import kieker.analysis.model.analysisMetaModel.MIDisplay; -import kieker.analysis.model.analysisMetaModel.MIFilter; -import kieker.analysis.model.analysisMetaModel.MIInputPort; -import kieker.analysis.model.analysisMetaModel.MIOutputPort; -import kieker.analysis.model.analysisMetaModel.MIPlugin; -import kieker.analysis.model.analysisMetaModel.MIPort; -import kieker.analysis.model.analysisMetaModel.MIProject; -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.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; -import kieker.analysis.plugin.AbstractPlugin; -import kieker.analysis.plugin.annotation.Plugin; -import kieker.analysis.plugin.filter.AbstractFilterPlugin; -import kieker.analysis.plugin.reader.AbstractReaderPlugin; -import kieker.analysis.repository.AbstractRepository; -import kieker.analysis.repository.annotation.Repository; -import kieker.common.configuration.Configuration; -import kieker.common.logging.Log; -import kieker.common.logging.LogFactory; -import kieker.monitoring.core.registry.Registry; -import kieker.webgui.beans.application.ProjectsBean; -import kieker.webgui.common.ConnectionFilterToFilter; -import kieker.webgui.common.ConnectionFilterToRepository; -import kieker.webgui.common.FSManager; -import kieker.webgui.common.Global; -import kieker.webgui.common.Pair; -import kieker.webgui.common.PluginFinder; -import kieker.webgui.common.exception.LibraryAlreadyExistingException; -import kieker.webgui.common.exception.NewerProjectException; - -import org.primefaces.context.RequestContext; -import org.primefaces.event.FileUploadEvent; -import org.primefaces.model.DefaultTreeNode; -import org.primefaces.model.TreeNode; -import org.primefaces.model.UploadedFile; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * The {@link CurrentAnalysisEditorBeanV2} contains the necessary data behind an instance of the analysis editor. It provides various methods to manipulate the - * current - * project, as the analysis editor is the most important part of the whole application.<br> - * The class is a JSF managed bean with view scope to make sure that one user (even in one session) can open multiple projects at a time without causing any - * problems. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@ManagedBean -@ViewScoped -public final class CurrentAnalysisEditorBeanV2 { - /** - * This is the javascript command to initialize the visual graph. - */ - private static final String JS_CMD_INIT_GRAPH = "var graph = GraphFlow(); graph.initGraph(null);"; - /** - * This is the javascript command for a node object. - */ - private static final String JS_CMD_NODE = "{\"id\":\"%s\", \"name\":\"%s\", \"nodeClass\":\"%s\", \"tooltip\":\"%s\"}"; - /** - * This is the javascript command for a port object. - */ - private static final String JS_CMD_PORT = "{\"name\":\"%s\",\"id\":\"%s\", \"tooltip\":\"%s\"}"; - /** - * This is the javascript type name for an input port. - */ - private static final String JS_CMD_PORT_TYPE_INPUT = "inputPort"; - /** - * This is the javascript command to add a filter to the graph. - */ - private static final String JS_CMD_ADD_FILTER = "graph.addFilter(%d, %d, %s,[%s],[%s],[%s]);"; - /** - * This is the javascript command to add a reader to the graph. - */ - private static final String JS_CMD_ADD_READER = "graph.addReader(%d, %d, %s,[%s],[%s]);"; - /** - * This is the javascript command to add a repository to the graph. - */ - private static final String JS_CMD_ADD_REPOSITORY = "graph.addRepository(%d, %d, %s,%s);"; - /** - * This is the javascript command to add an edge to the graph. - */ - private static final String JS_CMD_ADD_EDGE = "graph.addEdge(\"%s\", \"%s\");"; - /** - * This is the javascript command to redraw the command. - */ - private static final String JS_CMD_REFRESH_GRAPH = "graph.refresh();"; - /** - * This is the log for errors, exceptions etc. - */ - private static final Log LOG = LogFactory.getLog(CurrentAnalysisEditorBeanV2.class); - /** - * This is the factory which will be used to create new components for the project. - */ - private final MIAnalysisMetaModelFactory factory = new MAnalysisMetaModelFactory(); - /** - * This is the actual model instance. It is the in-memory-model of the current (session) user. - */ - private MIProject project; - /** - * This is the corresponding class loader to the project. It contains always the libraries within the lib-folder of the project. - */ - private ClassLoader classLoader; - /** - * This is the name of the stored project. It can be used as an identifier within the FS-Manager - */ - private String projectName; - /** - * This is the time stamp of the moment, the project was loaded or last saved. It can be used to check whether the project has been modified in the meanwhile. - */ - private long timeStamp; - /** - * This list contains the available repositories for the current project. The list is from the type Class<?> to allow a modular algorithm for the tree - * assembling. - */ - private final List<Class<?>> availableRepositories = Collections.synchronizedList(new ArrayList<Class<?>>()); - /** - * This list contains the available filters for the current project. The list is from the type Class<?> to allow a modular algorithm for the tree - * assembl - */ - private final List<Class<?>> availableFilters = Collections.synchronizedList(new ArrayList<Class<?>>()); - /** - * This list contains the available readers for the current project. The list is from the type Class<?> to allow a modular algorithm for the tree - * assembl - */ - private final List<Class<?>> availableReaders = Collections.synchronizedList(new ArrayList<Class<?>>()); - /** - * This map contains the mapping between the plugins and their ID. - */ - private Registry<MIPlugin> pluginMap = new Registry<MIPlugin>(); - /** - * This map contains the mapping between the ports and their ID. - */ - private Registry<MIPort> portMap = new Registry<MIPort>(); - /** - * This map contains the mapping between the repositories and their ID. - */ - private Registry<MIRepository> repositoryMap = new Registry<MIRepository>(); - /** - * This field contains the currently selected plugin. - */ - private MIPlugin selectedPlugin; - /** - * The currently selected repository. - */ - private MIRepository selectedRepository; - /** - * This list contains the currently available connections between filters. - */ - private final List<ConnectionFilterToFilter> filter2filterConnections = new ArrayList<ConnectionFilterToFilter>(); - /** - * This list contains the currently available connections between filters and repositories. - */ - private final List<ConnectionFilterToRepository> filter2repositoryConnections = new ArrayList<ConnectionFilterToRepository>(); - - @ManagedProperty(value = "#{projectsBean}") - private ProjectsBean projectsBean; - - /** - * Creates a new instance of this class. - */ - public CurrentAnalysisEditorBeanV2() { - // No code necessary - } - - /** - * This method delivers the project stored in this bean. - * - * @return The project for this user. - */ - public MIProject getProject() { - synchronized (this) { - return this.project; - } - } - - /** - * Getter for the attribute {@link CurrentAnalysisEditorBeanV2#projectsBean}. - * - * @return Delivers the value of the attribute. - */ - public ProjectsBean getProjectsBean() { - return this.projectsBean; - } - - /** - * Setter for the attribute {@link CurrentAnalysisEditorBeanV2#projectsBean}. - * - * @param projectsBean - * The new value of the attribute. - */ - public void setProjectsBean(final ProjectsBean projectsBean) { - this.projectsBean = projectsBean; - } - - /** - * This method sets the project stored within this bean and returns the new page for the navigation - depending on the given values. - * - * @param newName - * The name of the project. - */ - public void setProjectName(final String newName) { - synchronized (this) { - // Remember the given parameters - this.projectName = newName; - } - } - - /** - * This method initializes this bean, based on the project name and everything. - */ - public void initialize() { - synchronized (this) { - this.project = this.projectsBean.openProject(this.projectName); - this.getConnectionsFromProject(); - - if (this.project != null) { - // Remember the current time! This is important for the later comparison of the time stamps. - this.resetTimeStamp(); - // Update the class loader - this.reloadClassLoader(); - // Add the libraries within the lib-folder to the current model - this.addLibrariesToModel(); - // Load the available readers, filters and repositories - this.loadToolPalette(); - // Load the hashmaps to get the plugins and ports - this.intializeHashMaps(); - } - } - } - - /** - * Assembles and returns the available components as a primefaces tree. Keep in mind that the tree is currently assembled every time this method is called. - * - * @return The tree with all available filters, readers and repositories. - */ - public TreeNode getAvailableComponentsAsRoot() { - synchronized (this) { - // Create the necessary roots - final TreeNode root = new DefaultTreeNode("Root", null); - final TreeNode readerRoot = new DefaultTreeNode("Reader", root); - final TreeNode filterRoot = new DefaultTreeNode("Filter", root); - final TreeNode repositoryRoot = new DefaultTreeNode("Repository", root); - - // Fill the tree - CurrentAnalysisEditorBeanV2.assembleTree(readerRoot, this.availableReaders, "readerLeaf"); - CurrentAnalysisEditorBeanV2.assembleTree(filterRoot, this.availableFilters, "filterLeaf"); - CurrentAnalysisEditorBeanV2.assembleTree(repositoryRoot, this.availableRepositories, "repositoryLeaf"); - - return root; - } - } - - /** - * This method is used to "assemble" the tree containing the available components based on the given parameters. - * - * @param root - * The root-node used for the tree. - * @param clazzList - * The list of available classes which will be used to fill the tree. - * @param leafName - * The typename of the leaf-nodes. - */ - private static void assembleTree(final TreeNode root, final List<Class<?>> clazzList, final String leafName) { - final Map<String, TreeNode> map = new HashMap<String, TreeNode>(); // NOPMD (No concurrent access) - - for (final Class<?> clazz : clazzList) { - // Get the single components of the class name - final String className = clazz.getName(); - final String[] nameComponents = className.split("\\."); - final int compLen = nameComponents.length; - final StringBuilder fullQualifiedName = new StringBuilder(); - - TreeNode parent = root; - for (int i = 0; i < (compLen - 1); i++) { - fullQualifiedName.append(nameComponents[i]); - // Get the correct node if it exists already or create it if necessary - TreeNode node = map.get(fullQualifiedName.toString()); - - if (node == null) { - node = new DefaultTreeNode(nameComponents[i], parent); - map.put(fullQualifiedName.toString(), node); - } - - parent = node; - } - new DefaultTreeNode(leafName, clazz, parent); - } - } - - /** - * This method initializes the hash maps of the plugins, the ports and the repositories. The maps are cleaned beforehand. - */ - private void intializeHashMaps() { - synchronized (this) { - // Clear all maps - this.pluginMap = new Registry<MIPlugin>(); - this.portMap = new Registry<MIPort>(); - this.repositoryMap = new Registry<MIRepository>(); - - // Initialize the plugin map... - for (final MIPlugin plugin : this.project.getPlugins()) { - this.pluginMap.get(plugin); - // ..and the port map - for (final MIPort port : plugin.getOutputPorts()) { - this.portMap.get(port); - } - if (plugin instanceof MIFilter) { - for (final MIPort port : ((MIFilter) plugin).getInputPorts()) { - this.portMap.get(port); - } - } - } - // Now initialize the repository map - for (final MIRepository repository : this.project.getRepositories()) { - this.repositoryMap.get(repository); - } - } - } - - /** - * This method loads the list of available readers, filters and repositories, using the current libraries within the model. - */ - private void loadToolPalette() { - synchronized (this) { - // Clean our tool palette - this.availableFilters.clear(); - this.availableReaders.clear(); - this.availableRepositories.clear(); - - // Make sure there is a project. - if (this.project != null) { - // Run through all libraries - for (final MIDependency lib : this.project.getDependencies()) { - this.addToToolPalette(lib); - } - } - } - } - - /** - * This method adds all available readers, filters and repositories within the given library to the lists of this bean. - * - * @param lib - * The library used to load the plugins and repositories. - */ - private void addToToolPalette(final MIDependency lib) { - synchronized (this) { - try { - final List<Class<AbstractRepository>> repositories = PluginFinder.getAllRepositoriesWithinJar(FSManager.getInstance().getURL(lib, this.projectName), - this.classLoader); - final List<Class<AbstractPlugin>> plugins = PluginFinder.getAllPluginsWithinJar(FSManager.getInstance().getURL(lib, this.projectName), - this.classLoader); - // Now run through the available classes and add all non-abstract classes to our lists - for (final Class<AbstractRepository> repository : repositories) { - if (!Modifier.isAbstract(repository.getModifiers())) { - this.availableRepositories.add(repository); - } - } - for (final Class<? extends AbstractPlugin> plugin : plugins) { - if (!Modifier.isAbstract(plugin.getModifiers())) { - // The following cast results in the unchecked-cast-warnings, but we know that the cast should be correct. - if (AbstractFilterPlugin.class.isAssignableFrom(plugin)) { - this.availableFilters.add(plugin); - } else { - if (AbstractReaderPlugin.class.isAssignableFrom(plugin)) { - this.availableReaders.add(plugin); - } - } - } - } - } catch (final MalformedURLException ex) { - ex.printStackTrace(); - } - } - } - - /** - * This method takes all libraries from the lib-folder and adds them to the in-memory-model. - */ - private void addLibrariesToModel() { - synchronized (this) { - final List<MIDependency> libs = FSManager.getInstance().getModelLibraries(this.projectName); - // Add them, but remove all existing dependencies so far to avoid double entries. This also makes sure that the model - after it has been opened - points - // just to valid dependencies (and to all of them). - this.project.getDependencies().clear(); - this.project.getDependencies().addAll(libs); - } - } - - /** - * This method reloads the class loader. In other words: The class loader will always be able to load classes from the jar-files within the lib-folder of the - * project. - */ - private void reloadClassLoader() { - synchronized (this) { - this.classLoader = FSManager.getInstance().getClassLoader(this.projectName); - } - } - - /** - * This method sets the time stamp to the current system time. - */ - public void resetTimeStamp() { - synchronized (this) { - this.timeStamp = System.currentTimeMillis(); - } - } - - /** - * This method delivers the project name stored in this bean. - * - * @return The project name for this user. - */ - public String getProjectName() { - synchronized (this) { - return this.projectName; - } - } - - /** - * This method delivers the current time stamp. - * - * @return The time stamp for this user. - */ - public long getTimeStamp() { - synchronized (this) { - return this.timeStamp; - } - } - - /** - * This method clears the bean. In other words: The stored project is set to null and it will return the page of the project overview for navigation purposes. - * - * @return The name of the page of the project overview. - */ - public String clearProject() { - synchronized (this) { - this.project = null; // NOPMD - this.projectName = null; // NOPMD - this.classLoader = null; // NOPMD - this.selectedPlugin = null; // NOPMD - this.selectedRepository = null; // NOPMD - this.timeStamp = 0; - this.availableFilters.clear(); - this.availableReaders.clear(); - this.availableRepositories.clear(); - this.pluginMap = new Registry<MIPlugin>(); - this.portMap = new Registry<MIPort>(); - this.repositoryMap = new Registry<MIRepository>(); - this.filter2filterConnections.clear(); - this.filter2repositoryConnections.clear(); - } - - return Global.PAGE_PROJECT_OVERVIEW; - } - - /** - * This method can be used to get the description of an {@link AbstractPlugin}- or an {@link AbstractRepository}-class. The description is read via the - * annotation. - * - * @param clazz - * The class whose description should be extracted. - * @return The description for the class or a substitute if none is available. This is in either case human readable. - */ - public String getDescription(final Class<?> clazz) { - // Get the two potential annotations - final Plugin annotationPlugin = clazz.getAnnotation(Plugin.class); - final Repository annotationRepository = clazz.getAnnotation(Repository.class); - - // Now check which one of them is available - if ((annotationPlugin == null) || annotationPlugin.description().isEmpty()) { - if ((annotationRepository == null) || annotationRepository.description().isEmpty()) { - // None. Deliver a human readable substitute. - return "No description available"; - } else { - return annotationRepository.description(); - } - } else { - return annotationPlugin.description(); - } - } - - /** - * This method is the handler for the file upload. It tries to upload the given file and informs the user via the growl-component. - * - * @param event - * The upload event. - */ - public void handleFileUpload(final FileUploadEvent event) { - // Get the file from the event - final UploadedFile file = event.getFile(); - - try { - // Use the file system manager to upload the new file - final MIDependency lib; - synchronized (this) { - lib = FSManager.getInstance().uploadLibrary(file, this.projectName); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_INFO, "Libary uploaded."); - // As it seem to have worked, we can add the library to our model. - this.project.getDependencies().add(lib); - } - // Update our class loader and the available plugins & repositories - this.reloadClassLoader(); - this.addToToolPalette(lib); - } catch (final LibraryAlreadyExistingException ex) { - CurrentAnalysisEditorBeanV2.LOG.info("A library with the same name exists already.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_WARN, "A library with the same name exists already."); - } catch (final IOException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An error occured while uploading the library.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while uploading the library."); - } - } - - /** - * This method delivers the available libraries of this project as a pair of strings. The first element is the name of the library, the second one te size in - * MiBytes as human readable string. - * - * @return The available libraries. - */ - public List<Pair<String, String>> getLibraries() { - synchronized (this) { - return FSManager.getInstance().getLibraries(this.projectName); - } - } - - /** - * 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() { - return this.availableReaders; - } - - /** - * 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<Class<?>> getAvailableFilters() { - return this.availableFilters; - } - - /** - * This method delivers the available repositories for the current main project. The delivered repositories are never abstract. - * - * @return A list with all repositories. - */ - public final List<Class<?>> getAvailableRepositories() { - return this.availableRepositories; - } - - /** - * This method tries to save the current project and informs the user about success or fail. - * - * @param overwriteNewerProject - * This flag determines whether a newer project should be overwritten. - */ - public void saveProject(final boolean overwriteNewerProject) { - synchronized (this) { - try { - FSManager.getInstance().saveProject(this.projectName, this.project, this.timeStamp, overwriteNewerProject); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_INFO, "Project saved."); - // Update the time stamp! - this.resetTimeStamp(); - } catch (final IOException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An error occured while saving the project.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while saving the project."); - } catch (final NewerProjectException ex) { - CurrentAnalysisEditorBeanV2.LOG.info("The project has been modified externally in the meanwhile.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_WARN, "The project has been modified externally in the meanwhile."); - // Give the user the possibility to force-save the project - RequestContext.getCurrentInstance().execute("forceSaveDlg.show()"); - } - } - } - - /** - * This method initializes the modified jit-graph by delivering the necessary javascript commands to the client. It prints all current existing plugins, - * repositories and their connections. All further components will be added mostly by other methods. - */ - public void initializeGraph() { - final RequestContext context = RequestContext.getCurrentInstance(); - // Make sure that the graph exists in the first place - context.execute(CurrentAnalysisEditorBeanV2.JS_CMD_INIT_GRAPH); - // Initialize the listener for the clicks on the components - context.execute("graph.addListener(\"onClick\", nodeClickListener);"); - - // Paint all necessary components - this.initializeGraphPlugins(); - this.initializeGraphRepositories(); - this.initializeGraphConnections(); - - // Repaint the whole graph to make sure that everything will be shown. - context.execute(CurrentAnalysisEditorBeanV2.JS_CMD_REFRESH_GRAPH); - } - - /** - * This method initializes the modified jit-grpah by delivering the necessary javascript commands to paint the connections between the components. - */ - private void initializeGraphConnections() { - final RequestContext context = RequestContext.getCurrentInstance(); - - // First the connections between the filters - for (final ConnectionFilterToFilter connection : this.filter2filterConnections) { - context.execute(String.format(CurrentAnalysisEditorBeanV2.JS_CMD_ADD_EDGE, this.assembleGraphPortID(connection.getSource(), connection.getOutputPort()), - this.assembleGraphPortID(connection.getDestination(), connection.getInputPort()))); - } - - // TODO Now the connections between filters and repositories - } - - private String clickedNodeID; - private String clickedNodeType; - - public void setClickedNodeID(final String id) { - this.clickedNodeID = id; - } - - public String getClickedNodeID() { - return this.clickedNodeID; - } - - public void setClickedNodeType(final String type) { - this.clickedNodeType = type; - } - - public String getClickedNodeType() { - return this.clickedNodeType; - } - - public void nodeClicked() { - if (this.clickedNodeType.equalsIgnoreCase("Filter") || this.clickedNodeType.equalsIgnoreCase("Reader")) { - // Try to find the ID as a filter/reader - this.setSelectedPlugin(this.pluginMap.get(Integer.parseInt(this.clickedNodeID))); - } else { - // Try to find the ID as a repository - this.setSelectedRepository(this.repositoryMap.get(Integer.parseInt(this.clickedNodeID))); - } - } - - /** - * This method initializes the modified jit-graph by delivering the necessary javascript commands to paint the repository components. - */ - private void initializeGraphRepositories() { - final RequestContext context = RequestContext.getCurrentInstance(); - - int posCounter = 0; - for (final MIRepository repository : this.project.getRepositories()) { - final int pos = (posCounter * 100) - 250; - final String repoPort = String.format(CurrentAnalysisEditorBeanV2.JS_CMD_PORT, CurrentAnalysisEditorBeanV2.JS_CMD_PORT_TYPE_INPUT, "ip1", "N/A"); - context.execute(String.format(CurrentAnalysisEditorBeanV2.JS_CMD_ADD_REPOSITORY, 0, pos, this.assembleGraphString(repository), repoPort)); - posCounter++; - } - } - - /** - * This method initializes the modified jit-graph by delivering the necessary javascript commands to paint the plugin components. - */ - private void initializeGraphPlugins() { - final RequestContext context = RequestContext.getCurrentInstance(); - - int posCounter = 0; - for (final MIPlugin plugin : this.project.getPlugins()) { - final int pos = posCounter * 100; - if (plugin instanceof MIReader) { - context.execute(String.format(CurrentAnalysisEditorBeanV2.JS_CMD_ADD_READER, pos, pos, this.assembleGraphString(plugin), - this.assembleGraphRepositoryPortString(plugin), this.assembleGraphOuputPortString(plugin))); - } else { - context.execute(String.format(CurrentAnalysisEditorBeanV2.JS_CMD_ADD_FILTER, pos, pos, this.assembleGraphString(plugin), - this.assembleGraphRepositoryPortString(plugin), this.assembleGraphInputPortString((MIFilter) plugin), - this.assembleGraphOuputPortString(plugin))); - } - posCounter++; - } - } - - /** - * This method assembles the string containing the given ports. - * - * @param ports - * The ports to be used within the string command. - * @return A string containing the JS commands to create the ports. - */ - private String assembleGraphPortString(final EList<? extends MIPort> ports) { - final StringBuilder builder = new StringBuilder(); - final int len = ports.size(); - - for (int i = 0; i < len; i++) { - final MIPort port = ports.get(i); - - if (i != 0) { - builder.append(','); - } - - builder.append(String.format(CurrentAnalysisEditorBeanV2.JS_CMD_PORT, port.getName(), this.portMap.get(port), port.getName())); - } - - return builder.toString(); - } - - /** - * This method assembles the string containing the available repository ports of the given plugin. - * - * @param plugin - * The plugin whose repository ports will be used. - * @return A string containing the JS commands to create the repository ports. - */ - private String assembleGraphRepositoryPortString(final MIPlugin plugin) { - final StringBuilder builder = new StringBuilder(); - final int len = plugin.getRepositories().size(); - - for (int i = 0; i < len; i++) { - final MIRepositoryConnector port = plugin.getRepositories().get(i); - - if (i != 0) { - builder.append(','); - } - - builder.append(String.format(CurrentAnalysisEditorBeanV2.JS_CMD_PORT, port.getName(), port.getName(), port.getName())); - } - - return builder.toString(); - } - - /** - * This method assembles the string containing the available input ports of the given filter. - * - * @param filter - * The filter whose input ports will be used. - * @return A string containing the JS commands to create the input ports. - */ - private String assembleGraphInputPortString(final MIFilter filter) { - return this.assembleGraphPortString(filter.getInputPorts()); - } - - /** - * This method assembles the string containing the available output ports of the given plugin. - * - * @param plugin - * The plugin whose output ports will be used. - * @return A string containing the JS commands to create the output ports. - */ - private String assembleGraphOuputPortString(final MIPlugin plugin) { - return this.assembleGraphPortString(plugin.getOutputPorts()); - } - - /** - * This method assembles the ID of the port for the graph based on the given parameters. - * - * @param plugin - * The parent plugin of the port. - * @param port - * The port itself. - * @return The ID for the port within the graph - */ - private String assembleGraphPortID(final MIPlugin plugin, final MIPort port) { - return this.pluginMap.get(plugin) + "_" + this.portMap.get(port); - } - - /** - * Assembles a human-readable string of the given repository, which can also be used as a graph ID. - * - * @param repository - * The repository whose ID should be delivered. - * @return A human readable ID. - */ - private String assembleGraphString(final MIRepository repository) { - final String className = repository.getClassname(); - final String shortName = className.substring(className.lastIndexOf('.') + 1); - return String.format(CurrentAnalysisEditorBeanV2.JS_CMD_NODE, this.repositoryMap.get(repository), repository.getName(), shortName, className); - } - - /** - * Assembles a human-readable string of the given plugin, which can also be used as a graph ID. - * - * @param plugin - * The plugin whose ID should be delivered. - * @return A human readable ID. - */ - private String assembleGraphString(final MIPlugin plugin) { - final String className = plugin.getClassname(); - final String shortName = className.substring(className.lastIndexOf('.') + 1); - return String.format(CurrentAnalysisEditorBeanV2.JS_CMD_NODE, this.pluginMap.get(plugin), plugin.getName(), shortName, className); - } - - /** - * This method fills the displays of the given plugin. In other words: It tries to instantiate the given class and to extract the displays. If the instantiation - * fails (for various reasons), the method informs the user and executes normally - without an exception. - * - * @param clazz - * The class to be used as a base. - * @param plugin - * The plugin to be filled. - * @return true iff the plugin has been intialized properly. - */ - private boolean fillDisplays(final Class<AbstractPlugin> clazz, final MIPlugin plugin) { - synchronized (this) { - try { - // Try to instantiate the given class, using the special constructor of Kieker. - final AbstractPlugin pluginInstance = clazz.getConstructor(Configuration.class).newInstance(new Configuration()); - // Get the displays and convert them into model instances - final String[] displayNames = pluginInstance.getAllDisplayNames(); - for (final String displayName : displayNames) { - final MIDisplay mDisplay = this.factory.createDisplay(); - mDisplay.setName(displayName); - plugin.getDisplays().add(mDisplay); - } - return true; - } catch (final InstantiationException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An error occured while loading the displays of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the displays of the plugin."); - return false; - } catch (final IllegalAccessException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An error occured while loading the displays of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the displays of the plugin."); - return false; - } catch (final InvocationTargetException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An error occured while loading the displays of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the displays of the plugin."); - return false; - } catch (final NoSuchMethodException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An error occured while loading the displays of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the displays of the plugin."); - return false; - } catch (final NoClassDefFoundError ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An error occured while loading the displays of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the displays of the plugin."); - return false; - } - } - } - - /** - * This method fills the ports of the given plugin. In other words: It tries to instantiate the given class and to extract the ports. If the instantiation fails - * (for various reasons), the method informs the user and executes normally - without an exception. - * - * @param clazz - * The class to be used as a base. - * @param plugin - * The plugin to be filled. - * @return true iff the plugin has been intialized properly. - */ - private boolean fillPorts(final Class<AbstractPlugin> clazz, final MIPlugin plugin) { - synchronized (this) { - try { - // Try to instantiate the given class, using the special constructor of Kieker. - final AbstractPlugin pluginInstance = clazz.getConstructor(Configuration.class).newInstance(new Configuration()); - - // Get the port and use them to initialize the model plugin. - final String[] inputPortNames = pluginInstance.getAllInputPortNames(); - final String[] outputPortNames = pluginInstance.getAllOutputPortNames(); - final String[] repositoryPortNames = pluginInstance.getAllRepositoryPortNames(); - - // Add input ports - if (plugin instanceof MIFilter) { - for (final String inputPortName : inputPortNames) { - final MIInputPort mInputPort = this.factory.createInputPort(); - mInputPort.setName(inputPortName); - - mInputPort.setParent((MIFilter) plugin); - } - } - - // Add output ports. - for (final String outputPortName : outputPortNames) { - final MIOutputPort mOutputPort = this.factory.createOutputPort(); - mOutputPort.setName(outputPortName); - mOutputPort.setParent(plugin); - } - - // Add repository ports. - for (final String repositoryPortName : repositoryPortNames) { - final MIRepositoryConnector mConnector = this.factory.createRepositoryConnector(); - mConnector.setName(repositoryPortName); - plugin.getRepositories().add(mConnector); - } - - return true; - - } catch (final InstantiationException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the ports of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); - return false; - } catch (final IllegalAccessException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the ports of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); - return false; - } catch (final InvocationTargetException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the ports of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); - return false; - } catch (final NoSuchMethodException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the ports of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); - return false; - } catch (final NoClassDefFoundError ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the ports of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); - return false; - } - } - } - - /** - * This method fills the properties of the given repository. In other words: It tries to instantiate the given class and to extract the configuration keys. If - * the instantiation fails (for various reasons), the method informs the user and executes normally - without an exception. - * - * @param clazz - * The class to be used as a base. - * @param repository - * The repository to be filled. - * @return true iff the repository has been intialized properly. - */ - private boolean fillProperties(final Class<AbstractRepository> clazz, final MIRepository repository) { - try { - // Try to instantiate the given class, using the special constructor of Kieker. - final AbstractRepository repositoryInstance = clazz.getConstructor(Configuration.class).newInstance(new Configuration()); - // Get the current configuration and use it to initialize the model repository, as THIS configuration instance will contain all keys. - final Configuration configuration = repositoryInstance.getCurrentConfiguration(); - - repository.getProperties().addAll(this.extractProperties(configuration)); - - return true; - } catch (final InstantiationException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the repository.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); - return false; - } catch (final IllegalAccessException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the repository.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); - return false; - } catch (final InvocationTargetException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the repository.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); - return false; - } catch (final NoSuchMethodException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the repository.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); - return false; - } catch (final NoClassDefFoundError ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the repository.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); - return false; - } - } - - /** - * This method fills the properties of the given plugin. In other words: It tries to instantiate the given class and to extract the configuration keys. If - * the instantiation fails (for various reasons), the method informs the user and executes normally - without an exception. - * - * @param clazz - * The class to be used as a base. - * @param plugin - * The plugin to be filled. - * @return true iff the plugin has been intialized properly. - */ - private boolean fillProperties(final Class<AbstractPlugin> clazz, final MIPlugin plugin) { - try { - // Try to instantiate the given class, using the special constructor of Kieker. - final AbstractPlugin pluginInstance = clazz.getConstructor(Configuration.class).newInstance(new Configuration()); - // Get the current configuration and use it to initialize the model plugin, as THIS configuration instance will contain all keys. - final Configuration configuration = pluginInstance.getCurrentConfiguration(); - - plugin.getProperties().addAll(this.extractProperties(configuration)); - - return true; - } catch (final InstantiationException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); - return false; - } catch (final IllegalAccessException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); - return false; - } catch (final InvocationTargetException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); - return false; - } catch (final NoSuchMethodException ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); - return false; - } catch (final NoClassDefFoundError ex) { - CurrentAnalysisEditorBeanV2.LOG.error("An errcor occured while loading the properties of the plugin.", ex); - CurrentAnalysisEditorBeanV2.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); - return false; - } - } - - /** - * This method extracts the properties from the given configuration. In other words: For every key within the configuration, the method creates a model - * counterpart. - * - * @param configuration - * The configuration to be used for extraction. - * @return The list containing one {@link MIProperty} for every key within the configuration. - */ - private List<MIProperty> extractProperties(final Configuration configuration) { - final List<MIProperty> result = new ArrayList<MIProperty>(); - - // Run through all entries. - final Iterator<Map.Entry<Object, Object>> iterator = configuration.entrySet().iterator(); - while (iterator.hasNext()) { - final Map.Entry<Object, Object> entry = iterator.next(); - // Create a property object for the current entry. - final MIProperty property = this.factory.createProperty(); - property.setName(entry.getKey().toString()); - property.setValue(entry.getValue().toString()); - - result.add(property); - } - - return result; - } - - /** - * This method adds a new repository to the current model, using the given instance of {@code Class} for it. - * - * @param clazz - * The class of the repository to be added. - */ - public void addRepository(final Class<AbstractRepository> clazz) { - // Create a new instance for the model - final MIRepository repository = this.factory.createRepository(); - repository.setClassname(clazz.getName()); - repository.setName(clazz.getSimpleName()); - - final boolean check = this.fillProperties(clazz, repository); - // Make sure that everything has been loaded correctly. If something went wrong, we don't add the component to our model - if (check) { - synchronized (this) { - // Add it to the project - this.project.getRepositories().add(repository); - this.repositoryMap.get(repository); - } - } - } - - /** - * This method adds a new plugin to the current model, using the given instance of {@code Class} for it. - * - * @param clazz - * The class of the plugin to be added. This can be both, a filter or a reader. - */ - public void addPlugin(final Class<AbstractPlugin> clazz) { - // Create a new instance for the model - final MIPlugin plugin; - if (AbstractReaderPlugin.class.isAssignableFrom(clazz)) { - plugin = this.factory.createReader(); - } else { - plugin = this.factory.createFilter(); - } - plugin.setClassname(clazz.getName()); - plugin.setName(clazz.getSimpleName()); - - boolean check = true; - check &= this.fillProperties(clazz, plugin); - check &= this.fillPorts(clazz, plugin); - check &= this.fillDisplays(clazz, plugin); - - // Make sure that everything has been loaded correctly. If something went wrong, we don't add the component to our model - if (check) { - synchronized (this) { - // Add it to the project and don't forget to add the ports. - this.project.getPlugins().add(plugin); - this.pluginMap.get(plugin); - for (final MIPort port : plugin.getOutputPorts()) { - this.portMap.get(port); - } - if (plugin instanceof MIFilter) { - for (final MIPort port : ((MIFilter) plugin).getInputPorts()) { - this.portMap.get(port); - } - } - - // Make sure the user can edit the repository connections. - final EList<MIRepositoryConnector> mConnectors = plugin.getRepositories(); - for (final MIRepositoryConnector mConnector : mConnectors) { - this.filter2repositoryConnections.add(new ConnectionFilterToRepository(plugin, mConnector.getRepository(), mConnector)); - } - } - } - } - - /** - * This method removes the given repository from the project. If it is also the currently selected repository, it will be deselected. - * - * @param repository - * The repository to be removed from the project. - */ - public void removeRepository(final MIRepository repository) { - synchronized (this) { - this.project.getRepositories().remove(repository); - - // Remove the corresponding repositories from the connections - final List<ConnectionFilterToRepository> fRDelList = new ArrayList<ConnectionFilterToRepository>(); - for (final ConnectionFilterToRepository conn : this.filter2repositoryConnections) { - if (conn.getDestination() == repository) { - fRDelList.add(conn); - } - } - - // Remove them from the project as well - for (final ConnectionFilterToRepository conn : fRDelList) { - conn.getOutputPort().setRepository(null); - } - - this.repositoryMap.remove(repository); - - if (this.selectedRepository == repository) { - this.selectedRepository = null; // NOPMD - } - } - } - - /** - * Uses the given plugin to remove the corresponding connections (to other plugins or repositories) from the current project. - * - * @param plugin - * The plugin whose connections have to be removed. - */ - private void removeCorrespondingConnections(final MIPlugin plugin) { - synchronized (this) { - final List<ConnectionFilterToFilter> ffDelList = new ArrayList<ConnectionFilterToFilter>(); - for (final ConnectionFilterToFilter conn : this.filter2filterConnections) { - if ((conn.getSource() == plugin) || (conn.getDestination() == plugin)) { - ffDelList.add(conn); - } - } - this.filter2filterConnections.removeAll(ffDelList); - - // Remove them from the project as well - for (final ConnectionFilterToFilter conn : ffDelList) { - if (conn.getDestination() == plugin) { - conn.getOutputPort().getSubscribers().remove(conn.getInputPort()); - } - } - - final List<ConnectionFilterToRepository> fRDelList = new ArrayList<ConnectionFilterToRepository>(); - for (final ConnectionFilterToRepository conn : this.filter2repositoryConnections) { - if (conn.getSource() == plugin) { - fRDelList.add(conn); - } - } - this.filter2repositoryConnections.removeAll(fRDelList); - } - } - - /** - * Uses the given plugin to remove the corresponding ports from the current project. - * - * @param plugin - * The plugin whose ports have to be removed. - */ - private void removeCorrespondingPorts(final MIPlugin plugin) { - synchronized (this) { - // Remove the ports from the registry - for (final MIPort mPort : plugin.getOutputPorts()) { - this.portMap.remove(mPort); - } - // Remove the ports from the project - if (plugin instanceof MIFilter) { - for (final MIPort mPort : ((MIFilter) plugin).getInputPorts()) { - this.portMap.remove(mPort); - } - } - } - } - - /** - * This method removes the given plugin from the project. If it is also the currently selected plugin, it will be deselected. - * - * @param plugin - * The plugin to be removed from the project. - */ - public void removePlugin(final MIPlugin plugin) { - synchronized (this) { - this.project.getPlugins().remove(plugin); - this.pluginMap.remove(plugin); - - this.removeCorrespondingConnections(plugin); - this.removeCorrespondingPorts(plugin); - - if (this.selectedPlugin == plugin) { - this.selectedPlugin = null; // NOPMD - } - } - } - - /** - * This method delivers the currently selected plugin (or the currently selected repository). If nothing has been selected, null will be returned. - * - * @return The currently selected plugin or repository. - */ - public EObject getSelectedPlugin() { - synchronized (this) { - if (this.selectedPlugin != null) { - return this.selectedPlugin; - } else { - return this.selectedRepository; - } - } - } - - /** - * This method sets the currently selected plugin. The selected repository is set automatically to null. - * - * @param selectedPlugin - * The new selection. - */ - public void setSelectedPlugin(final MIPlugin selectedPlugin) { - synchronized (this) { - this.selectedPlugin = selectedPlugin; - this.selectedRepository = null; // NOPMD - } - } - - /** - * This method sets the currently selected repository. The selected plugin is set automatically to null. - * - * @param selectedRepository - * The new selection. - */ - public void setSelectedRepository(final MIRepository selectedRepository) { - synchronized (this) { - this.selectedRepository = selectedRepository; - this.selectedPlugin = null; // NOPMD - } - } - - /** - * This method delivers the properties of the currently selected plugin, but it adds also the name-property as a string to the list. - * - * @return A list with all properties of the plugin plus the name-property. If no plugin is selected, an empty list will be returned. - */ - public List<Object> getAdvancedPluginProperties() { - synchronized (this) { - final List<Object> result = new ArrayList<Object>(); - - // Add the name-property as a string - result.add("Name"); - // Get the original properties of the plugin - if (this.selectedPlugin != null) { - result.addAll(this.selectedPlugin.getProperties()); - } else { - result.addAll(this.selectedRepository.getProperties()); - } - - return result; - } - } - - /** - * This method delivers a list containing all available filters within the model instance. It is the same as calling project.getPlugins() but instead this method - * returns only instances of {@link MIFilter}. - * - * @return A list with the available filters. - */ - public List<MIPlugin> getFilters() { - synchronized (this) { - final EList<MIPlugin> plugins = this.project.getPlugins(); - final List<MIPlugin> filter = new ArrayList<MIPlugin>(); - - for (final MIPlugin plugin : plugins) { - if (plugin instanceof MIFilter) { - filter.add(plugin); - } - } - - return filter; - } - } - - /** - * This method extracts the connections between the filters from the current main project. - */ - private void getConnectionsFromProject() { - synchronized (this) { - this.filter2filterConnections.clear(); - this.filter2repositoryConnections.clear(); - - if (this.project != null) { - final EList<MIPlugin> mPlugins = this.project.getPlugins(); - - for (final MIPlugin mPlugin : mPlugins) { - final EList<MIOutputPort> mOutputPorts = mPlugin.getOutputPorts(); - for (final MIOutputPort mOutputPort : mOutputPorts) { - final EList<MIInputPort> mInputPorts = mOutputPort.getSubscribers(); - for (final MIInputPort mInputPort : mInputPorts) { - this.filter2filterConnections.add(new ConnectionFilterToFilter(mPlugin, mInputPort.getParent(), mInputPort, mOutputPort)); - } - } - - final EList<MIRepositoryConnector> mConnectors = mPlugin.getRepositories(); - for (final MIRepositoryConnector mConnector : mConnectors) { - this.filter2repositoryConnections.add(new ConnectionFilterToRepository(mPlugin, mConnector.getRepository(), mConnector)); - } - } - } - } - } - - /** - * Delivers the connections (between the filters) within the current main project. - * - * @return A list containing all available connections. - */ - public List<ConnectionFilterToFilter> getFilterConnections() { - return this.filter2filterConnections; - } - - /** - * Delivers the connections (between filters and repositories) within the current main project. - * - * @return A list containing all available connections. - */ - public List<ConnectionFilterToRepository> getRepoConnections() { - return this.filter2repositoryConnections; - } - - /** - * Delivers the <b>valid</b> connections (between filters and repositories) within the current main project. - * - * @return A list containing all available and valid connections. - */ - public List<ConnectionFilterToRepository> getValidRepoConnections() { - final List<ConnectionFilterToRepository> list = new ArrayList<ConnectionFilterToRepository>(); - - synchronized (this) { - for (final ConnectionFilterToRepository conn : this.filter2repositoryConnections) { - if (conn.isValid()) { - list.add(conn); - } - } - } - - return list; - } - - /** - * Delivers all available repositories. - * - * @return A list with all repositories within the model. - */ - public EList<MIRepository> getRepositories() { - synchronized (this) { - return this.project.getRepositories(); - } - } - - /** - * Delivers the name of the currently selected plugin/repository. This is only necessary for the correct renaming of the components. - * - * @return The name of the plugin/repository. - */ - public String getCurrentPluginName() { - synchronized (this) { - if (this.selectedPlugin != null) { - return this.selectedPlugin.getName(); - } else { - return this.selectedRepository.getName(); - } - } - } - - /** - * Delivers the valid connections (between the filters) within the current main project. - * - * @return A list containing all available and valid connections. - */ - public List<ConnectionFilterToFilter> getValidConnections() { - synchronized (this) { - final List<ConnectionFilterToFilter> validConnections = new ArrayList<ConnectionFilterToFilter>(); - final List<ConnectionFilterToFilter> availableConnections = this.getFilterConnections(); - - for (final ConnectionFilterToFilter connection : availableConnections) { - if (connection.isValid()) { - validConnections.add(connection); - } - } - - return validConnections; - } - } - - /** - * This method adds an empty connection to the current main project. - */ - public void addConnection() { - this.filter2filterConnections.add(new ConnectionFilterToFilter(null, null, null, null)); - } - - /** - * This method "submits" the current connections to the main project (In other words: The connections will be stored within the main project). - */ - public void submitConnections() { - synchronized (this) { - for (final ConnectionFilterToFilter connection : this.filter2filterConnections) { - if (connection.isValid()) { - connection.getOutputPort().getSubscribers().add(connection.getInputPort()); - } - } - - for (final ConnectionFilterToRepository connection : this.filter2repositoryConnections) { - if (connection.isValid()) { - connection.getOutputPort().setRepository(connection.getDestination()); - } - } - } - } - - /** - * This method shows the current user a message by using the growl-component of PrimeFaces. - * - * @param severity - * The severity of the message. - * @param msg - * The message itself. - */ - private static void showMessage(final Severity severity, final String msg) { - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, "", msg)); - } - - /** - * Delivers the id which the plugin has in the plugin map of this bean. - * - * @param plugin - * The plugin whose id should be delivered. - * @return The id of the plugin. - */ - public int getPluginID(final MIPlugin plugin) { - return this.pluginMap.get(plugin); - } - - /** - * Delivers the id which the repository has in the repository map of this bean. - * - * @param repository - * The repository whose id should be delivered. - * @return The id of the repository. - */ - public int getRepositoryID(final MIRepository repository) { - return this.repositoryMap.get(repository); - } - - /** - * Delivers the id which the port has in the port map of this bean. - * - * @param port - * The port whose id should be delivered. - * @return The id of the port. - */ - public int getPortID(final MIPort port) { - return this.portMap.get(port); - } - - /** - * This method searches a plugin by name (the name should be delivered using the toString-method of the object). - * - * @param string - * The name of the plugin. - * @return The plugin with the given name if it exists, null otherwise. - */ - public MIPlugin getPluginByID(final String string) { - return this.pluginMap.get(Integer.parseInt(string)); - } - - /** - * This method searches a port by name (the name should be delivered using the toString-method of the object). - * - * @param string - * The name of the port. - * @return The port with the given name if it exists, null otherwise. - */ - public MIPort getPortByID(final String string) { - return this.portMap.get(Integer.parseInt(string)); - } - - /** - * This method searches a repository by name (the name should be delivered using the toString-method of the object). - * - * @param string - * The name of the repository. - * @return The plugin with the given name if it exists, null otherwise. - */ - public MIRepository getRepositoryByID(final String string) { - return this.repositoryMap.get(Integer.parseInt(string)); - } -} diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml index 81c83b3452508fa1034d2c7da4d4a2b905588958..b3a205bd7b3a934f1ec70648bd6f04cbc035b92a 100644 --- a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml +++ b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml @@ -15,17 +15,42 @@ <h:head> <title>Kieker.WebGUI</title> - <!-- Load the necessary CSS files. --> + <link rel="stylesheet" type="text/css" href="../css/base.css" /> + <link rel="stylesheet" type="text/css" href="../css/FlowEditor.css" /> <link rel="stylesheet" type="text/css" href="../css/Common.css" /> - <link rel="stylesheet" type="text/css" href="../css/js-graph-it.css"/> <link rel="stylesheet" type="text/css" href="../css/AnalysisEditor.css" /> - <!-- Load the necessary JS filed. --> - <script type="text/javascript" src="../js/js-graph-it.js"/> + + <!-- Load the necessary JS files. --> + <script language="javascript" type="text/javascript" src="../js/jit.js"></script> + <script language="javascript" type="text/javascript" src="../js/flowEditor.js"></script> + + <script> + window.onload = function() { + document.getElementById('hidden:link').onclick(); + } + + nodeClickListener = function(node, info, e) { + nodeClickCommand([{name : 'ID', value : node.id}, {name : 'type', value : node.data.$nodeType}]); + } + + nodeRemoveListener = function(node, info, e) { + nodeRemoveCommand([{name : 'ID', value : node.id}, {name : 'type', value : node.data.$nodeType}]); + } + </script> </h:head> - <!-- The initPageObjects()-method initializes the graph. --> - <h:body onload="initPageObjects();"> + <h:body> + <h:form id="hidden" style="display:none"> + <h:commandLink id="link"> + <f:ajax event="click" listener="#{currentAnalysisEditorBean.initializeGraph()}" /> + </h:commandLink> + </h:form> + <h:form id="hiddenNodeProperties" style="display:none"> + <p:remoteCommand name="nodeClickCommand" action="#{currentAnalysisEditorBean.nodeClicked()}" update=":propertiesForm"/> + <p:remoteCommand name="nodeRemoveCommand" action="#{currentAnalysisEditorBean.nodeRemoved()}" update=":propertiesForm"/> + </h:form> + <p:layout fullPage="true"> <p:layoutUnit position="north"> @@ -81,46 +106,10 @@ <!-- This is the center component showing the graph and everything. --> <p:layoutUnit style="font-size: 12px" position="center" id="centerLayout"> - <h:form id="centerForm" style="height: 100%" rendered="#{not empty currentAnalysisEditorBean.project}"> - <div class="canvas" id="mainCanvas" style="width : 100%;height: 100%"> - <ui:repeat value="#{currentAnalysisEditorBean.project.plugins}" var="plugin" varStatus="counter"> - <p:remoteCommand name="setPlugin#{counter.index}" action="#{currentAnalysisEditorBean.setSelectedPlugin(plugin)}" update=":propertiesForm"/> - <!-- Netbeans reports an error here, but the code does still work though... --> - <div onclick="setPlugin#{counter.index}();" style="left: #{counter.index * 90}px; top: #{counter.index * 70}px; position: absolute" class="ui-panel ui-widget ui-widget-content ui-corner-all block draggable" id="plugin#{currentAnalysisEditorBean.getPluginID(plugin)}" > - <div class="ui-panel-titlebar ui-widget-header ui-corner-all"> - <h:outputText style="font-weight: bold" value="#{plugin.getName()}"/> - </div> - <p:commandLink ajax="true" value="Remove" action="#{currentAnalysisEditorBean.removePlugin(plugin)}" update=":propertiesForm :centerForm"/> - </div> - </ui:repeat> - <ui:repeat value="#{currentAnalysisEditorBean.project.repositories}" var="repository" varStatus="counter"> - <p:remoteCommand name="setRepository#{counter.index}" action="#{currentAnalysisEditorBean.setSelectedRepository(repository)}" update=":propertiesForm"/> - <!-- Netbeans reports an error here, but the code does still work though... --> - <div onclick="setRepository#{counter.index}();" style="left: #{(currentAnalysisEditorBean.project.plugins.size() + counter.index) * 90}px; top: #{counter.index * 70}px; position: absolute" class="ui-panel ui-widget ui-widget-content ui-corner-all block draggable" id="repository#{currentAnalysisEditorBean.getRepositoryID(repository)}" > - <div class="ui-panel-titlebar ui-widget-header ui-corner-all"> - <h:outputText style="font-weight: bold" value="#{repository.getName()}"/> - </div> - <p:commandLink ajax="true" value="Remove" action="#{currentAnalysisEditorBean.removeRepository(repository)}" update=":propertiesForm :centerForm"/> - </div> - </ui:repeat> - - <ui:repeat value="#{currentAnalysisEditorBean.filterConnections}" var="connection"> - <div class="connector plugin#{currentAnalysisEditorBean.getPluginID(connection.source)} plugin#{currentAnalysisEditorBean.getPluginID(connection.destination)}"> - <label class="source-label"><h:outputText value="#{connection.outputPort.getName()}"/></label> - <label class="destination-label"><h:outputText value="#{connection.inputPort.getName()}"/></label> - <img src="../img/arrow.gif" class="connector-end"/> - </div> - </ui:repeat> - - <ui:repeat value="#{currentAnalysisEditorBean.validRepoConnections}" var="connection"> - <div class="connector plugin#{currentAnalysisEditorBean.getPluginID(connection.source)} repository#{currentAnalysisEditorBean.getRepositoryID(connection.destination)}"> - <label class="source-label"><h:outputText value="#{connection.outputPort.getName()}"/></label> - <img src="../img/arrow.gif" class="connector-end"/> - </div> - </ui:repeat> - </div> - </h:form> - </p:layoutUnit> + <div id="center-container" style="width: 100%;height: 100%"> + <div id="infovis"/> + </div> + </p:layoutUnit> <!-- This is the component presenting the available properties. --> <p:layoutUnit style="font-size: 12px" position="south" size="150" header="Properties" resizable="true" collapsible="true"> @@ -138,7 +127,7 @@ <h:outputText value="#{currentAnalysisEditorBean.selectedPlugin.classname}" rendered="#{rowIndex == 0}"/> <p:inplace editor="true" rendered="#{rowIndex == 1}" > <p:inputText value="#{currentAnalysisEditorBean.selectedPlugin.name}" /> - <p:ajax event="save" update=":centerForm" /> + <p:ajax event="save" /> </p:inplace> <p:inplace editor="true" rendered="#{rowIndex > 1}"> <p:inputText value="#{property.value}" /> @@ -154,7 +143,7 @@ <p:accordionPanel multiple="true" activeIndex=""> <p:tab title="Reader"> <ui:repeat value="#{currentAnalysisEditorBean.availableReaders}" var="reader"> - <p:commandLink id="readerLink" value="#{reader.simpleName}" action="#{currentAnalysisEditorBean.addPlugin(reader)}" update=":centerForm :messages" /><br/> + <p:commandLink id="readerLink" value="#{reader.simpleName}" action="#{currentAnalysisEditorBean.addPlugin(reader)}" update=":messages" /><br/> <p:tooltip for="readerLink"> <b><h:outputText value="#{reader.simpleName} (#{reader.name})"/></b> <br/> @@ -173,7 +162,7 @@ </p:tab> <p:tab title="Filter"> <ui:repeat value="#{currentAnalysisEditorBean.availableFilters}" var="filter"> - <p:commandLink id="filterLink" value="#{filter.simpleName}" action="#{currentAnalysisEditorBean.addPlugin(filter)}" update=":centerForm :messages"/><br/> + <p:commandLink id="filterLink" value="#{filter.simpleName}" action="#{currentAnalysisEditorBean.addPlugin(filter)}" update=":messages"/><br/> <p:tooltip for="filterLink"> <b><h:outputText value="#{filter.simpleName} (#{filter.name})"/></b> <br/> @@ -196,7 +185,7 @@ </p:tab> <p:tab title="Repositories"> <ui:repeat value="#{currentAnalysisEditorBean.availableRepositories}" var="repository"> - <p:commandLink id="repositoryLink" value="#{repository.simpleName}" action="#{currentAnalysisEditorBean.addRepository(repository)}" update=":centerForm :messages"/><br/> + <p:commandLink id="repositoryLink" value="#{repository.simpleName}" action="#{currentAnalysisEditorBean.addRepository(repository)}" update=":messages"/><br/> <p:tooltip for="repositoryLink"> <b><h:outputText value="#{repository.simpleName} (#{repository.name})"/></b> <br/> diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisEditor_V2.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisEditor_V2.xhtml deleted file mode 100644 index b3ddba4b04b4267e9c5bcaeeecc1931ce1d1e815..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/AnalysisEditor_V2.xhtml +++ /dev/null @@ -1,187 +0,0 @@ -<?xml version='1.0' encoding='UTF-8' ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:p="http://primefaces.org/ui" - xmlns:c="http://java.sun.com/jsp/jstl/core"> - - <f:metadata> - <f:viewParam name="projectName" value="#{currentAnalysisEditorBeanV2.projectName}"/> - <f:event type="preRenderView" listener="#{currentAnalysisEditorBeanV2.initialize()}" /> - </f:metadata> - - <h:head> - <title>Kieker.WebGUI</title> - - <link rel="stylesheet" type="text/css" href="css/base.css" /> - <link rel="stylesheet" type="text/css" href="css/FlowEditor.css" /> - <link rel="stylesheet" type="text/css" href="css/Common.css" /> - <link rel="stylesheet" type="text/css" href="css/AnalysisEditor.css" /> - - <script language="javascript" type="text/javascript" src="js/jit.js"></script> - <script language="javascript" type="text/javascript" src="js/flowEditor.js"></script> - - <script> - window.onload = function() { - document.getElementById('hidden:link').onclick(); - } - - nodeClickListener = function(node, info, e) { - document.getElementById('hiddenNodeProperties:clickedNodeID').value = node.id; - document.getElementById('hiddenNodeProperties:clickedNodeType').value = node.data.$nodeType; - document.getElementById('hiddenNodeProperties:cmdBtnSelection').click(); - } - </script> - </h:head> - - <h:body> - <h:form id="hidden" style="display:none"> - <h:commandLink id="link"> - <f:ajax event="click" listener="#{currentAnalysisEditorBeanV2.initializeGraph()}" /> - </h:commandLink> - </h:form> - <h:form id="hiddenNodeProperties" style="display:none"> - <h:inputHidden id="clickedNodeID" value="#{currentAnalysisEditorBeanV2.clickedNodeID}"/> - <h:inputHidden id="clickedNodeType" value="#{currentAnalysisEditorBeanV2.clickedNodeType}"/> - <p:commandButton id="cmdBtnSelection" ajax="true" action="#{currentAnalysisEditorBeanV2.nodeClicked()}" update=":propertiesForm" value="submit"/> - </h:form> - - <p:layout id="layout" fullPage="true"> - - <p:layoutUnit position="north"> - <h:form> - <p:toolbar> - <p:toolbarGroup align="left"> - <h:outputText styleClass="kieker-title" value="Kieker » #{stringBean.shortenLongName(currentAnalysisEditorBeanV2.projectName, 30)}"/> - </p:toolbarGroup> - <p:toolbarGroup align="right"> - <p:commandButton styleClass="perspective-button" icon="ui-icon-home" action="ProjectOverview.xhtml" /> - <p:separator/> - <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Analysis Editor" style="white-space: none" disabled="true"/> - <p:button styleClass="perspective-button" icon="ui-icon-circle-triangle-e" value="Analysis" style="white-space: none" outcome="Controller.xhtml"> - <f:param name="projectName" value="#{currentAnalysisEditorBeanV2.projectName}" /> - </p:button> - <p:separator/> - <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Cockpit Editor" style="white-space: none" outcome="CockpitEditor.xhtml"> - <f:param name="projectName" value="#{currentAnalysisEditorBeanV2.projectName}" /> - </p:button> - <p:button styleClass="perspective-button" icon="ui-icon-image" value="Cockpit" style="white-space: none" outcome="Cockpit.xhtml"> - <f:param name="projectName" value="#{currentAnalysisEditorBeanV2.projectName}" /> - </p:button> - </p:toolbarGroup> - </p:toolbar> - - <p:menubar> - <p:submenu label="File"> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-disk" value=" Save Project" update=":messages" ajax="true" action="#{currentAnalysisEditorBeanV2.saveProject(false)}" disabled="#{empty currentAnalysisEditorBeanV2.project}"/> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-disk" value=" Save Project As" update=":messages" ajax="true" disabled="#{true or empty currentAnalysisEditorBeanV2.project}"/> - <p:separator /> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-refresh" value=" Reload Project" ajax="true" disabled="#{empty currentAnalysisEditorBeanV2.project or true}" /> - <p:separator/> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-bookmark" value=" Manage Libraries" onclick="manageLibrariesDialog.show()" ajax="true" disabled="#{empty currentAnalysisEditorBeanV2.project}"/> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-shuffle" ajax="true" value=" Edit Connections" update=":connectionDialogForm" onclick="connectionDialog.show();" disabled="#{empty currentAnalysisEditorBeanV2.project}"/> - <p:separator /> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-gear" value=" Settings" onclick="settingsDlg.show()" ajax="true"/> - <p:separator /> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-circle-close" value=" Close Project" action="#{currentAnalysisEditorBeanV2.clearProject()}" ajax="false"/> - </p:submenu> - - <p:submenu label="Help"> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-help" value=" User Guide" ajax="true" disabled="true"/> - <p:separator/> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-comment" value=" About..." onclick="aboutDlg.show()" ajax="true"/> - </p:submenu> - - <p:menuitem styleClass="logOutButton" icon="ui-icon-power" value="#{userBean.userName}" ajax="true" disabled="true"/> - </p:menubar> - </h:form> - </p:layoutUnit> - - <p:layoutUnit style="font-size: 12px" position="center" id="centerLayout"> - <div id="center-container" style="width: 100%;height: 100%"> - <div id="infovis"/> - </div> - </p:layoutUnit> - - <p:layoutUnit style="font-size: 12px" position="south" size="150" header="Properties" resizable="true" collapsible="true"> - <h:form id="propertiesForm" > - <p:dataTable editable="true" value="#{currentAnalysisEditorBeanV2.advancedPluginProperties}" var="property" emptyMessage="No properties available" rendered="#{not empty currentAnalysisEditorBeanV2.selectedPlugin}"> - <p:column headerText="Key" style="width:125px"> - <h:outputText value="#{property.name}" rendered="#{not stringBean.checkString(property)}"/> - <h:outputText value="Name" rendered="#{stringBean.checkString(property)}"/> - </p:column> - - <p:column headerText="Value" style="width:125px"> - <p:inplace editor="true" rendered="#{not stringBean.checkString(property)}"> - <p:inputText value="#{property.value}" /> - </p:inplace> - <p:inplace editor="true" rendered="#{stringBean.checkString(property)}" > - <p:inputText value="#{currentAnalysisEditorBeanV2.selectedPlugin.name}" /> - <!-- <p:ajax event="save" update=":centerForm" /> --> - </p:inplace> - </p:column> - </p:dataTable> - </h:form> - </p:layoutUnit> - - <!-- tree fuer toolpalette, packages --> - - <p:layoutUnit style="font-size: 12px" position="east" size="300" header="Available Plugins" - resizable="true" collapsible="true"> - <h:form id="toolpalette"> - <p:accordionPanel style="font-size: 12px" multiple="true" activeIndex=""> - <p:tab title="Reader"> - <ui:repeat value="#{currentAnalysisEditorBeanV2.availableReaders}" var="reader"> - <p:commandLink id="readerLink" value="#{reader.simpleName}" action="#{currentAnalysisEditorBeanV2.addPlugin(reader)}" update=":messages" /><br/> - <p:tooltip style="font-size: 15px" for="readerLink" value="#{currentAnalysisEditorBeanV2.getDescription(reader)}"/> - </ui:repeat> - </p:tab> - <p:tab title="Filter"> - <ui:repeat value="#{currentAnalysisEditorBeanV2.availableFilters}" var="filter"> - <p:commandLink id="filterLink" value="#{filter.simpleName}" action="#{currentAnalysisEditorBeanV2.addPlugin(filter)}" update=":messages"/><br/> - <p:tooltip style="font-size: 15px" for="filterLink" value="#{currentAnalysisEditorBeanV2.getDescription(filter)}"/> - </ui:repeat> - </p:tab> - <p:tab title="Repositories"> - <ui:repeat value="#{currentAnalysisEditorBeanV2.availableRepositories}" var="repository"> - <p:commandLink id="repositoryLink" value="#{repository.simpleName}" action="#{currentAnalysisEditorBeanV2.addRepository(repository)}" update=":messages"/><br/> - <p:tooltip style="font-size: 15px" for="repositoryLink" value="#{currentAnalysisEditorBeanV2.getDescription(repository)}"/> - </ui:repeat> - </p:tab> - </p:accordionPanel> - </h:form> - </p:layoutUnit> - <!-- ******************************************************************************** --> - </p:layout> - - <p:dialog header="Save Project" resizable="false" modal="true" widgetVar="forceSaveDlg"> - <h:form> - <div style="text-align: center"> - <h:outputText value="The project has been modified externally in the meanwhile. Do you want to overwrite the changes?" /> - </div> - <hr/> - <div style="text-align: right"> - <p:commandButton value="Yes" action="#{currentAnalysisEditorBeanV2.saveProject(true)}" oncomplete="forceSaveDlg.hide()" update=":messages" /> - <p:spacer width="10px" height="10" /> - <p:commandButton value="Cancel" onclick="forceSaveDlg.hide()" /> - </div> - </h:form> - </p:dialog> - - <p:growl id="messages" life="1500" showDetail="true" autoUpdate="false" sticky="true"/> - - <!-- Include the dialog for the configuration. --> - <ui:include src="dialogs/settingsDialog.xhtml" /> - - <!-- Include the about-dialog. --> - <ui:include src="dialogs/aboutDialog.xhtml" /> - - <!-- Include the dialog to handle the connections. --> - <ui:include src="dialogs/connectionDialog.xhtml" /> - - <ui:include src="dialogs/manageLibrariesDialog.xhtml" /> - - </h:body> -</html> \ No newline at end of file