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

Added some more functionality; Refactored some code; Added the plugin-finder.

parent 39e5ff37
No related branches found
No related tags found
No related merge requests found
package kieker.beans; package kieker.webgui.beans;
import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped; import javax.faces.bean.RequestScoped;
......
package kieker.beans; package kieker.webgui.beans;
import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedBean;
......
package kieker.beans; package kieker.webgui.beans;
import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.MIProject;
......
package kieker.beans; package kieker.webgui.beans;
/** /**
* *
......
package kieker.beans; package kieker.webgui.beans;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
......
package kieker.webgui.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
/**
*
* @author Nils Christian Ehmke
*/
@ManagedBean
@RequestScoped
public class StringBean {
private String string;
public String getString() {
return string;
}
public void setString(String string) {
this.string = string;
}
}
package kieker.beans; package kieker.webgui.beans;
import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedBean;
......
package kieker.webgui.common;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import kieker.analysis.plugin.port.Plugin;
/**
* @author Nils Christian Ehmke
*/
public class PluginFinder {
public static List<Class<?>> getAllPluginsWithinJar(final URL url) throws IOException {
final ClassLoader classLoader = new URLClassLoader(new URL[]{url});
final JarFile jarFile = new JarFile(new File(url.getPath()));
final List<Class<?>> result = new ArrayList<Class<?>>();
Enumeration<JarEntry> jarEntries = jarFile.entries();
while (jarEntries.hasMoreElements()) {
JarEntry jarEntry = (JarEntry) jarEntries.nextElement();
try {
String name = jarEntry.toString();
name = name.replace('/', '.');
name = name.replace(".class", "");
Class<?> c = classLoader.loadClass(name);
if (c.isAnnotationPresent(Plugin.class)) {
result.add(c);
}
} catch (Throwable ex) {
}
}
return result;
}
}
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<h:form> <h:form>
<p:menubar style="font-size: 15px"> <p:menubar style="font-size: 15px">
<p:submenu label="Projects"> <p:submenu label="Projects">
<p:menuitem value="New Project" action="#{projectsBean.addProject('NewProject')}" ajax="true" update="ProjectsList"/> <p:menuitem value="New Project" onclick="NewProjectDialog.show();" ajax="true" update="ProjectsList"/>
<p:menuitem value="Save Project"/> <p:menuitem value="Save Project"/>
<p:separator /> <p:separator />
<p:menuitem value="Delete Project"/> <p:menuitem value="Delete Project"/>
...@@ -115,6 +115,16 @@ ...@@ -115,6 +115,16 @@
<h:outputText value="Copyright (c) 2011 Kieker Project"/> <br/><br/> <h:outputText value="Copyright (c) 2011 Kieker Project"/> <br/><br/>
<a href="https://se.informatik.uni-kiel.de/kieker/">https://se.informatik.uni-kiel.de/kieker/</a> <a href="https://se.informatik.uni-kiel.de/kieker/">https://se.informatik.uni-kiel.de/kieker/</a>
</p:dialog> </p:dialog>
<p:dialog header="New Project" resizable="false" modal="true" style="font-size: 15px;width: auto" widgetVar="NewProjectDialog">
<h:form>
<h:outputText value="Please enter the name of the new project: " /><br/><br/>
<center>
<p:inputText style="width: 90%" value="#{stringBean.string}" /><br/><br/>
<p:commandButton value="Submit" action="#{projectsBean.addProject(stringBean.string)}" update="ProjectsList" oncomplete="NewProjectDialog.hide();"/>
</center>
</h:form>
</p:dialog>
</f:view> </f:view>
</html> </html>
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