Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WebGUI
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kieker
WebGUI
Commits
5c3ac9e1
Commit
5c3ac9e1
authored
13 years ago
by
nie
Browse files
Options
Downloads
Patches
Plain Diff
Added comments & context menu.
parent
b6aefb09
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java
+42
-16
42 additions, 16 deletions
...bGUI/src/main/java/kieker/webgui/common/PluginFinder.java
Kieker.WebGUI/src/main/webapp/main.xhtml
+16
-5
16 additions, 5 deletions
Kieker.WebGUI/src/main/webapp/main.xhtml
with
58 additions
and
21 deletions
Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java
+
42
−
16
View file @
5c3ac9e1
...
@@ -16,24 +16,50 @@ import kieker.analysis.plugin.port.Plugin;
...
@@ -16,24 +16,50 @@ import kieker.analysis.plugin.port.Plugin;
*/
*/
public
class
PluginFinder
{
public
class
PluginFinder
{
public
static
List
<
Class
<?>>
getAllPluginsWithinJar
(
final
URL
url
)
throws
IOException
{
/**
final
ClassLoader
classLoader
=
new
URLClassLoader
(
new
URL
[]{
url
});
* This method delivers all classes which are available in the given jar and
final
JarFile
jarFile
=
new
JarFile
(
new
File
(
url
.
getPath
()));
* has the Plugin-Annotation from the Kieker framework.
final
List
<
Class
<?>>
result
=
new
ArrayList
<
Class
<?>>();
*
Enumeration
<
JarEntry
>
jarEntries
=
jarFile
.
entries
();
* @param url The url for the jar.
while
(
jarEntries
.
hasMoreElements
())
{
* @return A list containing all available plugin-classes or null, if an
JarEntry
jarEntry
=
(
JarEntry
)
jarEntries
.
nextElement
();
* exception occured.
try
{
*/
String
name
=
jarEntry
.
toString
();
public
static
List
<
Class
<?>>
getAllPluginsWithinJar
(
final
URL
url
)
{
name
=
name
.
replace
(
'/'
,
'.'
);
try
{
name
=
name
.
replace
(
".class"
,
""
);
/*
Class
<?>
c
=
classLoader
.
loadClass
(
name
);
* Get a classloader and make sure that it has the system class
if
(
c
.
isAnnotationPresent
(
Plugin
.
class
))
{
* loader as parent and that it knows the url.
result
.
add
(
c
);
*/
final
ClassLoader
classLoader
=
new
URLClassLoader
(
new
URL
[]{
url
},
ClassLoader
.
getSystemClassLoader
());
/*
* Open the jar file and run through all entries within this file.
*/
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"
,
""
);
/*
* Try to find a class with the same name.
*/
Class
<?>
c
=
classLoader
.
loadClass
(
name
);
/*
* If it is a class and has the annotation - put it into our
* list.
*/
if
(
c
.
isAnnotationPresent
(
Plugin
.
class
))
{
result
.
add
(
c
);
}
}
catch
(
Throwable
ex
)
{
}
}
}
catch
(
Throwable
ex
)
{
}
}
return
result
;
}
catch
(
IOException
ex
)
{
return
null
;
}
}
return
result
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Kieker.WebGUI/src/main/webapp/main.xhtml
+
16
−
5
View file @
5c3ac9e1
...
@@ -42,24 +42,35 @@
...
@@ -42,24 +42,35 @@
<p:submenu
label=
"Help"
>
<p:submenu
label=
"Help"
>
<p:menuitem
value=
"About..."
onclick=
"AboutDialog.show();"
/>
<p:menuitem
value=
"About..."
onclick=
"AboutDialog.show();"
/>
</p:submenu>
</p:submenu>
</p:menubar>
</p:menubar>
</h:form>
</h:form>
</p:layoutUnit>
</p:layoutUnit>
<!-- The following layout is at the left side of the page and shows the available projects. -->
<!-- The following layout is at the left side of the page and shows the available projects. -->
<p:layoutUnit
style=
"font-size:15px"
header=
"Projects"
collapsible=
"true"
position=
"west"
size=
"200"
resizable=
"true"
minSize=
"100"
>
<p:layoutUnit
style=
"font-size:15px"
header=
"Projects"
collapsible=
"true"
position=
"west"
size=
"200"
resizable=
"true"
minSize=
"100"
>
<h:form
id=
"ProjectsList"
>
<h:form
id=
"ProjectsList"
>
<p:tree
selectionMode=
"single"
style=
"width: auto"
value=
"#{projectsBean.projectsRoot}"
var=
"node"
>
<p:tree
id=
"ProjectsListTree"
selectionMode=
"single"
style=
"width: auto"
value=
"#{projectsBean.projectsRoot}"
var=
"node"
>
<p:treeNode>
<p:treeNode>
<h:outputText
value=
"#{node}"
/>
<h:outputText
value=
"#{node}"
/>
</p:treeNode>
</p:treeNode>
</p:tree>
</p:tree>
<p:contextMenu
style=
"font-size:15px"
for=
"ProjectsListTree"
>
<p:menuitem
value=
"Set as Main Project"
update=
"ProjectsList"
/>
<p:menuitem
value=
"Save Project"
update=
"ProjectsList"
/>
<p:separator/>
<p:menuitem
value=
"Delete Project"
/>
</p:contextMenu>
</h:form>
</h:form>
</p:layoutUnit>
</p:layoutUnit>
<!-- The following layout unit is within the center and used for the graph. -->
<!-- The following layout unit is within the center and used for the graph. -->
<p:layoutUnit
position=
"center"
>
<p:layoutUnit
style=
"font-size:15px"
position=
"center"
>
</p:layoutUnit>
</p:layoutUnit>
<!-- The following layout unit is located at the bottom and will be used for properties. -->
<!-- The following layout unit is located at the bottom and will be used for properties. -->
...
@@ -93,7 +104,7 @@
...
@@ -93,7 +104,7 @@
<p:rowEditor
/>
<p:rowEditor
/>
</p:column>
</p:column>
</p:dataTable>
</p:dataTable>
</p:layoutUnit>
</p:layoutUnit>
<!-- The following layout unit is located at the right side of the page and is used as a tool palette. It shows the available plugins etc. -->
<!-- The following layout unit is located at the right side of the page and is used as a tool palette. It shows the available plugins etc. -->
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment