Commit 177c9268 authored by Florian's avatar Florian

initial commit: first version of the plug-in

parents
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>kieker.tools.eclipse.parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding/<project>=UTF-8
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>kieker.tools.eclipse.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="kieker.tools.eclipse.feature"
label="Kieker Eclipse Plugin"
version="1.0.0.qualifier"
provider-name="Kieker">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<plugin
id="kieker.tools.eclipse.monitoring"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>kieker.tools.eclipse.feature</artifactId>
<parent>
<groupId>kieker.tools.eclipse</groupId>
<artifactId>kieker.tools.eclipse.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<packaging>eclipse-feature</packaging>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>kieker.tools.eclipse.monitoring</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Kieker-Monitoring
Bundle-SymbolicName: kieker.tools.eclipse.monitoring;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: kieker.tools.eclipse.monitoring.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.debug.core,
org.eclipse.core.resources,
org.eclipse.jdt.launching;bundle-version="3.8.0",
org.eclipse.debug.ui;bundle-version="3.11.100",
org.eclipse.jdt.debug.ui;bundle-version="3.7.0",
org.eclipse.core.expressions,
org.eclipse.ui.ide;bundle-version="3.11.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: kieker.tools.eclipse.monitoring,
kieker.tools.eclipse.monitoring.handlers,
kieker.tools.eclipse.monitoring.launch,
kieker.tools.eclipse.monitoring.views
source.. = src/
output.. = target/classes/
bin.includes = META-INF/,\
.,\
plugin.xml,\
resources/
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
name="Kieker-monitored Java Application"
delegate="kieker.tools.eclipse.monitoring.launch.KiekerMonitoringLaunchConfigurationDelegate"
modes="run"
id="org.eclipse.jdt.launching.kiekerMonitoredJavaApplication">
</launchConfigurationType>
</extension>
<extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
<launchConfigurationTypeImage
icon="resources/kieker16.png"
configTypeID="org.eclipse.jdt.launching.kiekerMonitoredJavaApplication"
id="org.eclipse.jdt.debug.ui.launchConfigurationTypeImage.KiekerMonitoredJavaApplication">
</launchConfigurationTypeImage>
</extension>
<extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
type="org.eclipse.jdt.launching.kiekerMonitoredJavaApplication"
class="kieker.tools.eclipse.monitoring.launch.KiekerMonitoredJavaApplicationTabGroup"
id="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.kiekerMonitoredJavaApplication">
</launchConfigurationTabGroup>
</extension>
<extension
point="org.eclipse.ui.views">
<view
allowMultiple="false"
category="kieker.tools.eclipse.kieker"
class="kieker.tools.eclipse.monitoring.views.ProbesView"
icon="resources/kieker16.png"
id="kieker.tools.eclipse.monitoring.views.probes"
name="Kieker Probes"
restorable="false">
</view>
<category
name="Kieker"
id="kieker.tools.eclipse.kieker">
</category>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.jdt.ui.PackageExplorer?after=additions">
<menu
icon="resources/kieker16.png"
label="Kieker">
<command
commandId="kieker.tools.eclipse.monitoring.commands.Probes"
label="Probes"
style="push">
</command>
<command
commandId="kieker.tools.eclipse.monitoring.commands.Properties"
label="Properties"
style="push">
</command>
<visibleWhen
checkEnabled="false">
<with
variable="selection">
<count
value="+">
</count>
</with>
</visibleWhen>
</menu>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="kieker.tools.eclipse.monitoring.handlers.Probes"
commandId="kieker.tools.eclipse.monitoring.commands.Probes">
</handler>
<handler
class="kieker.tools.eclipse.monitoring.handlers.Properties"
commandId="kieker.tools.eclipse.monitoring.commands.Properties">
</handler>
</extension>
</plugin>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>kieker.tools.eclipse.monitoring</artifactId>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>kieker.tools.eclipse</groupId>
<artifactId>kieker.tools.eclipse.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
</build>
</project>
\ No newline at end of file
1=kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectAnnotation
2=kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectAnnotationServlet
3=kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectFull
4=kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectFullNoGetterAndSetter
5=kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectFullServlet
6=kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectFullNoGetterAndSetterServlet
7=kieker.monitoring.probe.aspectj.flow.concurrency.ThreadingAspect
8=kieker.monitoring.probe.aspectj.flow.concurrency.SynchronizedAspect
9=kieker.monitoring.probe.aspectj.flow.construction.FullInstrumentation
10=kieker.monitoring.probe.aspectj.flow.construction.Annotation
11=kieker.monitoring.probe.aspectj.flow.constructorExecution.FullInstrumentation
12=kieker.monitoring.probe.aspectj.flow.constructorExecution.Annotation
13=kieker.monitoring.probe.aspectj.flow.constructorExecutionObject.FullInstrumentation
14=kieker.monitoring.probe.aspectj.flow.constructorExecutionObject.Annotation
15=kieker.monitoring.probe.aspectj.flow.constructorExecutionObjectInterface.FullInstrumentation
16=kieker.monitoring.probe.aspectj.flow.constructorExecutionObjectInterface.Annotation
17=kieker.monitoring.probe.aspectj.flow.constructorCall.FullInstrumentation
18=kieker.monitoring.probe.aspectj.flow.constructorCall.Annotation
19=kieker.monitoring.probe.aspectj.flow.constructorCallObject.FullInstrumentation
20=kieker.monitoring.probe.aspectj.flow.constructorCallObject.Annotation
21=kieker.monitoring.probe.aspectj.flow.operationExecution.FullInstrumentation
22=kieker.monitoring.probe.aspectj.flow.operationExecution.FullInstrumentationNoGetterAndSetter
23=kieker.monitoring.probe.aspectj.flow.operationExecution.Annotation
24=kieker.monitoring.probe.aspectj.flow.operationExecutionObject.FullInstrumentation
25=kieker.monitoring.probe.aspectj.flow.operationExecutionObject.FullInstrumentationNoGetterAndSetter
26=kieker.monitoring.probe.aspectj.flow.operationExecutionObject.Annotation
27=kieker.monitoring.probe.aspectj.flow.operationExecutionObjectInterface.FullInstrumentation
28=kieker.monitoring.probe.aspectj.flow.operationExecutionObjectInterface.FullInstrumentationNoGetterAndSetter
29=kieker.monitoring.probe.aspectj.flow.operationExecutionObjectInterface.Annotation
30=kieker.monitoring.probe.aspectj.flow.operationCall.FullInstrumentation
31=kieker.monitoring.probe.aspectj.flow.operationCall.FullInstrumentationNoGetterAndSetter
32=kieker.monitoring.probe.aspectj.flow.operationCall.Annotation
33=kieker.monitoring.probe.aspectj.flow.operationCallObject.FullInstrumentation
34=kieker.monitoring.probe.aspectj.flow.operationCallObject.FullInstrumentationNoGetterAndSetter
35=kieker.monitoring.probe.aspectj.flow.operationCallObject.Annotation
\ No newline at end of file
package kieker.tools.eclipse.monitoring;
import java.util.ArrayList;
public class AOPConfiguration {
public Options options;
public ArrayList<String> includes;
public ArrayList<String> excludes;
public Aspect aspect;
public AOPConfiguration(){
this.options = new Options();
this.aspect = new Aspect();
}
}
package kieker.tools.eclipse.monitoring;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "kieker.tools.eclipse.monitoring"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}
package kieker.tools.eclipse.monitoring;
public class Aspect {
public boolean customProbe;
public String name;
public String expression = "";
public int index;
public Aspect(){}
public Aspect(boolean customProbe, String name, String expression, int index){
this.customProbe = customProbe;
this.name = name;
this.expression = expression;
this.index = index;
}
}
package kieker.tools.eclipse.monitoring;
public class Options {
public boolean verbose;
public boolean showWeaveInfo;
public boolean synchronization;
public Options(){}
public Options(boolean verbose, boolean showWeaveInfo, boolean synchronization){
this.verbose = verbose;
this.showWeaveInfo = showWeaveInfo;
this.synchronization = synchronization;
}
}
package kieker.tools.eclipse.monitoring.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
import kieker.tools.eclipse.monitoring.Dependencies;
import kieker.tools.eclipse.monitoring.views.ProbesView;
public class Probes extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IProject project = null;
ISelection sel = HandlerUtil.getCurrentSelection(event);
if (sel instanceof IStructuredSelection) {
Object selected = ((IStructuredSelection) sel).getFirstElement();
IResource resource = (IResource) Platform.getAdapterManager().getAdapter(selected, IResource.class);
if (resource != null) {
project = resource.getProject();
Dependencies.checkResourcesFolder(project);
}
}
try {
IViewPart part = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage()
.showView("kieker.tools.eclipse.monitoring.views.probes");
if (part instanceof ProbesView) {
ProbesView view = (ProbesView) part;
view.setProject(project);
}
} catch (PartInitException e) {
e.printStackTrace();
}
return null;
}
}
package kieker.tools.eclipse.monitoring.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.ide.IDE;
import kieker.tools.eclipse.monitoring.Dependencies;
public class Properties extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection sel = HandlerUtil.getCurrentSelection(event);
if (sel instanceof IStructuredSelection) {
Object selected = ((IStructuredSelection) sel).getFirstElement();
IResource resource = (IResource) Platform.getAdapterManager().getAdapter(selected, IResource.class);
if (resource != null) {
IProject project = resource.getProject();
checkDependencies(project);
openPropertiesFile(project);
}
}
return null;
}
public void checkDependencies(IProject project) {
Dependencies.checkResourcesFolder(project);
Dependencies.checkPropertiesFile(project);
}
public void openPropertiesFile(IProject project) {
String filePath = Dependencies.completeTargetFolder + Dependencies.propertiesFile;
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IFile properties = project.getFile(filePath);
try {
IDE.openEditor(page, properties);
} catch (PartInitException e) {
e.printStackTrace();
}
}
}
package kieker.tools.eclipse.monitoring.launch;
import org.eclipse.debug.ui.*;
import org.eclipse.jdt.debug.ui.launchConfigurations.*;
public class KiekerMonitoredJavaApplicationTabGroup extends AbstractLaunchConfigurationTabGroup {
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
new JavaMainTab(),
new KiekerMonitoringTab(),
new JavaArgumentsTab(),
new JavaJRETab(),
new JavaClasspathTab(),
new EnvironmentTab(),
new CommonTab()
};
setTabs(tabs);
}
}
package kieker.tools.eclipse.monitoring.launch;
import java.io.File;
import java.util.Arrays;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants;
import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
import org.eclipse.jdt.launching.ExecutionArguments;
import org.eclipse.jdt.launching.IVMRunner;
import org.eclipse.jdt.launching.VMRunnerConfiguration;
import org.eclipse.osgi.util.NLS;
import kieker.tools.eclipse.monitoring.Dependencies;
public class KiekerMonitoringLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
*/
public static final String ATTR_KIEKER_ENABLED = IJavaDebugUIConstants.PLUGIN_ID + ".ATTR_KIEKER_ENABLED"; //$NON-NLS-1$
public static final String ATTR_KIEKER_VERSION = IJavaDebugUIConstants.PLUGIN_ID + ".ATTR_KIEKER_VERSION"; //$NON-NLS-1$
@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
throws CoreException {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask(NLS.bind("{0}...", new String[]{configuration.getName()}), 3); //$NON-NLS-1$
// check for cancellation
if (monitor.isCanceled()) {
return;
}
try {
monitor.subTask("Verifying launch attributes");
// Check if Kieker Monitoring is enabled
boolean kiekerEnabled = configuration.getAttribute(ATTR_KIEKER_ENABLED, false);
String mainTypeName = verifyMainTypeName(configuration);
IVMRunner runner = getVMRunner(configuration, mode);
File workingDir = verifyWorkingDirectory(configuration);
String workingDirName = null;
if (workingDir != null) {
workingDirName = workingDir.getAbsolutePath();
}
// Environment variables
String[] envp= getEnvironment(configuration);
// Program & VM arguments
String pgmArgs = getProgramArguments(configuration);
String vmArgs = getVMArguments(configuration);
if(kiekerEnabled){
String kiekerVersion = configuration.getAttribute(ATTR_KIEKER_VERSION, "1.12");
if(vmArgs.isEmpty()){
vmArgs = "−javaagent:libs/kieker-" + kiekerVersion + "-aspectj.jar";
}else{
vmArgs += "\r\n−javaagent:libs/kieker-" + kiekerVersion + "-aspectj.jar";
}
}
ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
// VM-specific attributes
Map<String, Object> vmAttributesMap = getVMSpecificAttributesMap(configuration);