Commit 62378142 authored by Christian Wulf's avatar Christian Wulf

fixed OS-specific monitoring

parent 27232368
......@@ -17,80 +17,81 @@ import org.eclipse.osgi.util.NLS;
import kieker.tools.eclipse.monitoring.helper.Dependencies;
public class KiekerMonitoringLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate {
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)
/*
* (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$
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");
monitor.subTask("Verifying launch attributes");
// Check if Kieker Monitoring is enabled
boolean kiekerEnabled = configuration.getAttribute(ATTR_KIEKER_ENABLED, false);
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[] 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";
if (kiekerEnabled) {
String kiekerVersion = configuration.getAttribute(ATTR_KIEKER_VERSION, "1.12");
String javaagentArgument = "−javaagent:libs/kieker-" + kiekerVersion + "-aspectj.jar";
if (!vmArgs.isEmpty()) {
vmArgs = System.lineSeparator() + javaagentArgument;
}
}
}
ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
// VM-specific attributes
Map<String, Object> vmAttributesMap = getVMSpecificAttributesMap(configuration);
// Classpath
String[] classpath = getClasspath(configuration);
if(kiekerEnabled && Dependencies.checkResourcesFolder(configuration)){
if (kiekerEnabled && Dependencies.checkResourcesFolder(configuration)) {
// check if src-resources is in classpath
boolean isResInCP = false;
for(String e : classpath){
if(e.equals(workingDirName + "src-resources")){
for (String e : classpath) {
if (e.equals(workingDirName + "src-resources")) {
isResInCP = true;
break;
}
}
if(!isResInCP){
classpath = Arrays.copyOf(classpath, classpath.length+1);
classpath[classpath.length-1] = workingDirName + "\\src-resources";
if (!isResInCP) {
classpath = Arrays.copyOf(classpath, classpath.length + 1);
classpath[classpath.length - 1] = workingDirName + File.separator + "src-resources";
}
}
// Create VM config
VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
......@@ -98,38 +99,37 @@ public class KiekerMonitoringLaunchConfigurationDelegate extends AbstractJavaLau
runConfig.setVMArguments(execArgs.getVMArgumentsArray());
runConfig.setWorkingDirectory(workingDirName);
runConfig.setVMSpecificAttributesMap(vmAttributesMap);
// Bootpath
runConfig.setBootClassPath(getBootpath(configuration));
// check for cancellation
if (monitor.isCanceled()) {
return;
}
}
// stop in main
prepareStopInMain(configuration);
// done the verification phase
monitor.worked(1);
monitor.subTask("Creating source locator");
monitor.subTask("Creating source locator");
// set the default source locator if required
setDefaultSourceLocator(launch, configuration);
monitor.worked(1);
monitor.worked(1);
// Launch the configuration - 1 unit of work
runner.run(runConfig, launch, monitor);
// check for cancellation
if (monitor.isCanceled()) {
return;
}
}
finally {
}
} finally {
monitor.done();
}
}
}
......@@ -92,6 +92,7 @@ public class KiekerMonitoringTab extends AbstractLaunchConfigurationTab {
private List<String> getVersions() {
List<String> versions = new ArrayList<String>();
versions.add("1.13");
versions.add("1.12");
versions.add("1.11");
return versions;
......
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/kieker.tools.eclipse.feature_1.0.0.201801101321.jar" id="kieker.tools.eclipse.feature" version="1.0.0.201801101321">
<feature url="features/kieker.tools.eclipse.feature_1.0.0.201801101412.jar" id="kieker.tools.eclipse.feature" version="1.0.0.201801101412">
<category name="net.kieker-monitoring"/>
</feature>
<category-def name="net.kieker-monitoring" label="Kieker - the monitoring and dynamic analysis framework"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment