Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java17
-rw-r--r--plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java3
-rw-r--r--plugins/org.eclipse.objectteams.otdt/plugin.xml11
-rw-r--r--plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDTPlugin.java18
-rw-r--r--plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTREContainer.java20
-rw-r--r--plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTRuntimeClasspathProvider.java20
-rw-r--r--plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTRuntimeVariableInitializer.java39
-rw-r--r--plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTVariableInitializer.java28
-rw-r--r--plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/hook/ClassScanner.java17
-rw-r--r--plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/hook/IOTTransformer.java57
-rw-r--r--plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/OTEquinoxServiceWatcher.java24
-rw-r--r--plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/TransformerHook.java35
-rw-r--r--plugins/org.eclipse.objectteams.otequinox.runtime/.classpath3
-rw-r--r--plugins/org.eclipse.objectteams.otequinox.runtime/.project2
-rw-r--r--plugins/org.eclipse.objectteams.otequinox.runtime/META-INF/MANIFEST.MF17
-rw-r--r--plugins/org.eclipse.objectteams.otequinox.runtime/README.txt5
-rw-r--r--plugins/org.eclipse.objectteams.otequinox.runtime/build.properties7
-rw-r--r--plugins/org.eclipse.objectteams.otequinox/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/TransformerPlugin.java9
-rw-r--r--plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/internal/TransformerServiceDelegate.java79
20 files changed, 280 insertions, 137 deletions
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
index 397e51431..7290f2f7e 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2008 Technical University Berlin, Germany.
+ * Copyright 2008, 2010 Technical University Berlin, Germany.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -22,17 +22,13 @@ import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.objectteams.otdt.core.ext.OTREContainer;
-import org.eclipse.objectteams.otdt.core.ext.OTRuntimeClasspathProvider;
-import org.eclipse.objectteams.otdt.debug.IOTLaunchConstants;
import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
import org.eclipse.objectteams.otdt.debug.OTVMRunnerAdaptor;
import org.eclipse.objectteams.otdt.debug.TeamBreakpointInstaller;
@@ -93,7 +89,7 @@ public team class JDTLaunchingAdaptor {
for (int i = 0; i < origEntries.length; i++)
{
IRuntimeClasspathEntry entry = origEntries[i];
- if (OTRuntimeClasspathProvider.BCEL_JAR.equals(entry.getPath()))
+ if (OTREContainer.BCEL_JAR.equals(entry.getPath()))
hasBCEL = true;
else if (OTREContainer.OTRE_JAR_PATH.equals(entry.getPath().toString()))
hasOTRE_min = true;
@@ -103,7 +99,7 @@ public team class JDTLaunchingAdaptor {
IRuntimeClasspathEntry entry;
if (!hasBCEL) {
- entry = JavaRuntime.newArchiveRuntimeClasspathEntry(OTRuntimeClasspathProvider.BCEL_JAR);
+ entry = JavaRuntime.newArchiveRuntimeClasspathEntry(OTREContainer.BCEL_JAR);
entry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
result.add(entry);
}
@@ -117,7 +113,7 @@ public team class JDTLaunchingAdaptor {
}
if (!hasOTRE_min && !useJMangler) {
- entry = JavaRuntime.newArchiveRuntimeClasspathEntry(JavaCore.getResolvedVariablePath(new Path(OTREContainer.OTRE_MIN_JAR_PATH)));
+ entry = JavaRuntime.newArchiveRuntimeClasspathEntry(OTREContainer.OTRE_MIN_JAR_PATH);
entry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
result.add(entry);
}
@@ -188,9 +184,10 @@ public team class JDTLaunchingAdaptor {
}
static boolean isNormalOTJLaunch(ILaunchConfiguration config) {
+ // FIXME(SH): see https://bugs.eclipse.org/302976
try {
return config.getAttribute(OTDebugPlugin.OT_LAUNCH, false) // OT/J ?
- && !config.getAttribute(IOTLaunchConstants.ATTR_USE_JPLIS, false) // not JPLIS ?
+ && false//&& !config.getAttribute(IOTLaunchConstants.ATTR_USE_JPLIS, false) // not JPLIS ?
&& (config.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, (String)null) == null); // not PDE ?
} catch (CoreException e) {
return false; // don't apply adaptations to bogus config
@@ -200,7 +197,7 @@ public team class JDTLaunchingAdaptor {
static boolean isJPLISOTJLaunch(ILaunchConfiguration config) {
try {
return config.getAttribute(OTDebugPlugin.OT_LAUNCH, false) // OT/J ?
- && config.getAttribute(IOTLaunchConstants.ATTR_USE_JPLIS, false) // JPLIS ?
+ //&& config.getAttribute(IOTLaunchConstants.ATTR_USE_JPLIS, false) // JPLIS ?
&& (config.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, (String)null) == null); // not PDE ?
} catch (CoreException e) {
return false; // don't apply adaptations to bogus config
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java
index cc48eb624..ff489695d 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java
@@ -37,6 +37,7 @@ import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.VMRunnerConfiguration;
import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+import org.eclipse.objectteams.otdt.core.ext.OTREContainer;
import org.eclipse.objectteams.otdt.debug.internal.TempFileManager;
@@ -54,7 +55,7 @@ public class OTVMRunnerAdaptor
static {
JPLIS_VMARGS = new ArrayList<String>();
JPLIS_VMARGS.add("-Dot.otdt");
- JPLIS_VMARGS.add("-javaagent:" + OTDTPlugin.calculateAbsoluteRuntimePath("/lib/otre_agent.jar"));
+ JPLIS_VMARGS.add("-javaagent:" + "\""+OTREContainer.OTRE_AGENT_JAR_PATH.toOSString()+'"'); // support blanks in path
}
final static private boolean _useJPLIS = true;
diff --git a/plugins/org.eclipse.objectteams.otdt/plugin.xml b/plugins/org.eclipse.objectteams.otdt/plugin.xml
index 4c374444c..e2cd84c74 100644
--- a/plugins/org.eclipse.objectteams.otdt/plugin.xml
+++ b/plugins/org.eclipse.objectteams.otdt/plugin.xml
@@ -41,6 +41,9 @@
<classpathVariableInitializer
variable="OTDT_INSTALLDIR"
class="org.eclipse.objectteams.otdt.core.ext.OTVariableInitializer"/>
+ <classpathVariableInitializer
+ variable="OTRUNTIME_LIBDIR"
+ class="org.eclipse.objectteams.otdt.core.ext.OTVariableInitializer"/>
</extension>
<extension
@@ -51,14 +54,6 @@
class="org.eclipse.objectteams.otdt.core.ext.OTREContainerInitializer"/>
</extension>
- <extension
- point="org.eclipse.jdt.core.classpathVariableInitializer">
- <classpathVariableInitializer
- variable="OTRUNTIME_INSTALLDIR"
- class="org.eclipse.objectteams.otdt.core.ext.OTRuntimeVariableInitializer">
- </classpathVariableInitializer>
- </extension>
-
<extension point="org.eclipse.jdt.launching.classpathProviders">
<classpathProvider
id="org.eclipse.objectteams.otdt.OTRuntimeClasspathProvider"
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDTPlugin.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDTPlugin.java
index 36dcf9a63..198a62886 100644
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDTPlugin.java
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDTPlugin.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2003, 2010 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -22,6 +22,7 @@ package org.eclipse.objectteams.otdt.core.ext;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
@@ -40,6 +41,7 @@ public class OTDTPlugin extends Plugin
public static final String PLUGIN_ID = JavaCore.OTDT_PLUGIN_ID;
public static final String OTDT_INSTALLDIR = "OTDT_INSTALLDIR"; //$NON-NLS-1$
+ public static final String OTRUNTIME_LIBDIR = "OTRUNTIME_LIBDIR" ; //$NON-NLS-1$
// === IDs for configurable options for the compiler : ===
public static final String OT_COMPILER_BASE_CALL =
@@ -92,9 +94,6 @@ public class OTDTPlugin extends Plugin
public static final String OT_COMPILER_DEPRECATED_PATH_SYNTAX =
PLUGIN_ID + ".compiler.problem.deprecated_path_syntax"; //$NON-NLS-1$;
-
- public static String OTRUNTIME_INSTALLDIR = "OTRUNTIME_INSTALLDIR"; //$NON-NLS-1$
-
private static OTDTPlugin _singleton = null;
@@ -143,13 +142,12 @@ public class OTDTPlugin extends Plugin
return new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, exception);
}
- /**
- * Take relativeFileName relative to OTRUNTIME_INSTALLDIR and make an absolute path from that.
- * The returned string is enclosed in double-quotes so it is safe to have blanks within.
+ /**
+ * Take relativeFileName relative to a given classpath variable and make an absolute path from that.
*/
- public static String calculateAbsoluteRuntimePath(String relativeFileName)
+ public static IPath getResolvedVariablePath(String variableName, String relativeFilename)
{
- Path path = new Path(OTDTPlugin.OTRUNTIME_INSTALLDIR + relativeFileName);
- return "\""+JavaCore.getResolvedVariablePath( path ).toOSString()+'"'; //$NON-NLS-1$
+ Path path = new Path(variableName + '/'+ relativeFilename);
+ return JavaCore.getResolvedVariablePath(path);
}
}
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTREContainer.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTREContainer.java
index 921b82b9a..eb8e03fbb 100644
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTREContainer.java
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTREContainer.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2003, 2010 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -33,17 +33,25 @@ import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
/**
+ * This class serves the "OTRE" classpath container.
+ * It also provides access to resolved paths for all OTRE-related jars.
* @author gis
*/
public class OTREContainer implements IClasspathContainer
{
- public static final String OTRE_CONTAINER_NAME = "OTRE"; //$NON-NLS-1$
- public static final String OTRE_JAR_FILENAME = "otre.jar"; //$NON-NLS-1$
- public static final String OTRE_MIN_JAR_FILENAME = "otre_min.jar"; //$NON-NLS-1$
+ public static final String OTRE_CONTAINER_NAME = "OTRE"; //$NON-NLS-1$
+ public static final String OTRE_JAR_FILENAME = "otre.jar"; //$NON-NLS-1$
+ public static final String BCEL_JAR_FILENAME = "BCEL.jar"; //$NON-NLS-1$
+ public static final String OTRE_MIN_JAR_FILENAME = "otre_min.jar"; //$NON-NLS-1$
+ public static final String OTRE_AGENT_JAR_FILENAME = "otre_agent.jar"; //$NON-NLS-1$
public static final IPath OTRE_CONTAINER_PATH = new Path(OTRE_CONTAINER_NAME);
- public static final String OTRE_JAR_PATH = OTDTPlugin.OTDT_INSTALLDIR + "/lib/" + OTRE_JAR_FILENAME; //$NON-NLS-1$
- public static final String OTRE_MIN_JAR_PATH = OTDTPlugin.OTDT_INSTALLDIR + "/lib/" + OTRE_MIN_JAR_FILENAME; //$NON-NLS-1$
+ // these are served from the current plugin:
+ public static final IPath OTRE_MIN_JAR_PATH = OTDTPlugin.getResolvedVariablePath(OTDTPlugin.OTDT_INSTALLDIR, "lib/"+OTRE_MIN_JAR_FILENAME); //$NON-NLS-1$
+ public static final IPath OTRE_AGENT_JAR_PATH = OTDTPlugin.getResolvedVariablePath(OTDTPlugin.OTDT_INSTALLDIR, "lib/"+OTRE_AGENT_JAR_FILENAME); //$NON-NLS-1$
+ // these are served from org.eclipse.objectteams.runtime/lib:
+ public static final String OTRE_JAR_PATH = OTDTPlugin.OTRUNTIME_LIBDIR + '/' + OTRE_JAR_FILENAME; //$NON-NLS-1$
+ public static final IPath BCEL_JAR = OTDTPlugin.getResolvedVariablePath(OTDTPlugin.OTRUNTIME_LIBDIR, BCEL_JAR_FILENAME); //$NON-NLS-1$
private IClasspathEntry[] _cpEntries;
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTRuntimeClasspathProvider.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTRuntimeClasspathProvider.java
index e90bfe421..faf6a5655 100644
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTRuntimeClasspathProvider.java
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTRuntimeClasspathProvider.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2003, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2003, 2010 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -24,10 +24,7 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.StandardClasspathProvider;
@@ -41,9 +38,7 @@ public class OTRuntimeClasspathProvider extends StandardClasspathProvider
{
public static final String PROVIDER_ID = "org.eclipse.objectteams.otdt.OTRuntimeClasspathProvider"; //$NON-NLS-1$
- public static IPath BCEL_JAR = getVariablePath("/lib/BCEL.jar"); //$NON-NLS-1$
-
- public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration configuration) throws CoreException
+ public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration configuration) throws CoreException
{
// add BCEL, JMangler-core and JMangler-start (classpath / bootclasspath)
IRuntimeClasspathEntry[] origEntries = super.computeUnresolvedClasspath(configuration);
@@ -75,7 +70,7 @@ public class OTRuntimeClasspathProvider extends StandardClasspathProvider
for (int i = 0; i < origEntries.length; i++)
{
IRuntimeClasspathEntry entry = origEntries[i];
- if (BCEL_JAR.equals(entry.getPath()))
+ if (OTREContainer.BCEL_JAR.equals(entry.getPath()))
hasBCEL = true;
}
@@ -86,7 +81,7 @@ public class OTRuntimeClasspathProvider extends StandardClasspathProvider
// Also fix getVariablePath() then.
if (!hasBCEL)
{
- entry = JavaRuntime.newArchiveRuntimeClasspathEntry(BCEL_JAR);
+ entry = JavaRuntime.newArchiveRuntimeClasspathEntry(OTREContainer.BCEL_JAR);
entry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
result.add(entry);
}
@@ -104,13 +99,6 @@ public class OTRuntimeClasspathProvider extends StandardClasspathProvider
return result.toArray(new IRuntimeClasspathEntry[result.size()]);
}
- private static IPath getVariablePath(String filename)
- {
- Path path = new Path(OTDTPlugin.OTRUNTIME_INSTALLDIR + filename);
- //return path;
- return JavaCore.getResolvedVariablePath(path);
- }
-
public IRuntimeClasspathEntry[] resolveClasspath(
IRuntimeClasspathEntry[] entries,
ILaunchConfiguration configuration)
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTRuntimeVariableInitializer.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTRuntimeVariableInitializer.java
deleted file mode 100644
index c81ca4362..000000000
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTRuntimeVariableInitializer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**********************************************************************
- * This file is part of "Object Teams Development Tooling"-Software
- *
- * Copyright 2003, 2006 Fraunhofer Gesellschaft, Munich, Germany,
- * for its Fraunhofer Institute for Computer Architecture and Software
- * Technology (FIRST), Berlin, Germany and Technical University Berlin,
- * Germany.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * $Id: OTRuntimeVariableInitializer.java 23419 2010-02-03 20:43:26Z stephan $
- *
- * Please visit http://www.eclipse.org/objectteams for updates and contact.
- *
- * Contributors:
- * Fraunhofer FIRST - Initial API and implementation
- * Technical University Berlin - Initial API and implementation
- **********************************************************************/
-package org.eclipse.objectteams.otdt.core.ext;
-
-import org.eclipse.jdt.core.ClasspathVariableInitializer;
-
-/**
- * FIXME(SH): try if this VARIABLE can be removed altogether.
- * @author gis
- * @version $Id: OTRuntimeVariableInitializer.java 23419 2010-02-03 20:43:26Z stephan $
- */
-public class OTRuntimeVariableInitializer extends ClasspathVariableInitializer
-{
- public void initialize(String variable)
- {
- if (OTDTPlugin.OTRUNTIME_INSTALLDIR.equals(variable))
- {
- OTVariableInitializer.setPluginInstallationPathVariable(OTDTPlugin.getDefault(), variable);
- }
- }
-}
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTVariableInitializer.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTVariableInitializer.java
index e7d07dab2..8f820bb48 100644
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTVariableInitializer.java
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTVariableInitializer.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2003, 2010 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -29,6 +29,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.jdt.core.ClasspathVariableInitializer;
import org.eclipse.jdt.core.JavaCore;
+import org.osgi.framework.Bundle;
/**
@@ -48,21 +49,33 @@ public class OTVariableInitializer extends ClasspathVariableInitializer
{
if (OTDTPlugin.OTDT_INSTALLDIR.equals(variable))
{
- setPluginInstallationPathVariable(OTDTPlugin.getDefault(), variable);
+ setPluginInstallationPathVariable(OTDTPlugin.getDefault(), null, null, variable);
}
+ else if (OTDTPlugin.OTRUNTIME_LIBDIR.equals(variable))
+ {
+ setPluginInstallationPathVariable(OTDTPlugin.getDefault(), "org.eclipse.objectteams.runtime", "lib", variable);
+ }
+
}
- public static void setPluginInstallationPathVariable(Plugin relativePlugin, String variable)
+ public static void setPluginInstallationPathVariable(Plugin relativePlugin, String bundleName, String relativeDir, String variable)
{
try
{
- URL installDirectory = relativePlugin.getBundle().getEntry("/"); //$NON-NLS-1$
+ URL installDirectory;
+ if (bundleName == null)
+ installDirectory = relativePlugin.getBundle().getEntry("/"); //$NON-NLS-1$
+ else
+ installDirectory = getBundle(bundleName).getEntry("/"); //$NON-NLS-1$
+
// On Windows, the next line leads to something like "/C:/Programme/Eclipse/plugins/my.plugin
// If we simply make an org.eclipse.core.runtime.Path out of it, the leading '/' makes the
// parsing fail (device, e.g. 'C:' is not detected). We must use java.io.File to parse it
// properly.
String path = FileLocator.toFileURL(installDirectory).getPath();
+ if (relativeDir != null)
+ path += relativeDir;
String fixedPath = new File(path).getPath();
JavaCore.setClasspathVariable(variable, new Path(fixedPath), new NullProgressMonitor());
}
@@ -71,4 +84,11 @@ public class OTVariableInitializer extends ClasspathVariableInitializer
OTDTPlugin.getExceptionHandler().logException(ex);
}
}
+
+ private static Bundle getBundle(String symbolicName) {
+ for (Bundle bundle : OTDTPlugin.getDefault().getBundle().getBundleContext().getBundles())
+ if (bundle.getSymbolicName().equals(symbolicName))
+ return bundle;
+ return null;
+ }
}
diff --git a/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/hook/ClassScanner.java b/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/hook/ClassScanner.java
index 0627ee673..9671c74ca 100644
--- a/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/hook/ClassScanner.java
+++ b/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/hook/ClassScanner.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2008 Technical University Berlin, Germany.
+ * Copyright 2008, 2010 Technical University Berlin, Germany.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -24,8 +24,6 @@ import java.util.HashMap;
import java.util.List;
import org.eclipse.objectteams.otequinox.internal.hook.Util;
-import org.eclipse.objectteams.otre.jplis.ObjectTeamsTransformer;
-import org.eclipse.objectteams.otre.util.CallinBindingManager;
import org.osgi.framework.Bundle;
/**
@@ -41,7 +39,8 @@ public class ClassScanner
// default is "on", leave this switch for trouble shooting and profiling:
public static final boolean REPOSITORY_USE_RESOURCE_LOADER = !"off".equals(System.getProperty("otequinox.repository.hook"));
- ObjectTeamsTransformer transformer = new ObjectTeamsTransformer();
+ // access to the OTRE
+ IOTTransformer transformerService;
// collect class names recorded by readOTAttributes:
@@ -52,6 +51,10 @@ public class ClassScanner
ArrayList<String> roleClassNames = new ArrayList<String>();
+ public ClassScanner(IOTTransformer transformerService) {
+ this.transformerService = transformerService;
+ }
+
/**
* Read all OT byte code attributes for the specified class.
* While doing so the names of roles and adapted base classes are collected.
@@ -71,8 +74,8 @@ public class ClassScanner
URL classFile = bundle.getResource(className.replace('.', '/')+".class");
if (classFile == null)
throw new ClassNotFoundException(className);
- this.transformer.readOTAttributes(classFile.openStream(), classFile.getFile(), loader);
- Collection<String> currentBaseNames = this.transformer.fetchAdaptedBases(); // destructive read
+ Object token = this.transformerService.readOTAttributes(classFile.openStream(), classFile.getFile(), loader);
+ Collection<String> currentBaseNames = this.transformerService.fetchAdaptedBases(token); // destructive read
if (currentBaseNames != null) {
// store per team:
ArrayList<String> basesPerTeam = this.baseClassNamesByTeam.get(className);
@@ -123,7 +126,7 @@ public class ClassScanner
String className,
ClassLoader resourceLoader)
{
- List<String> roles = CallinBindingManager.getRolePerTeam(className);
+ List<String> roles = this.transformerService.getRolesPerTeam(className);
if (roles != null) {
ILogger logger = HookConfigurator.getLogger();
for (String roleName: roles) {
diff --git a/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/hook/IOTTransformer.java b/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/hook/IOTTransformer.java
new file mode 100644
index 000000000..d7f9407af
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/hook/IOTTransformer.java
@@ -0,0 +1,57 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2010 Stephan Herrmann
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Stephan Herrmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otequinox.hook;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.instrument.ClassFileTransformer;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Service interface for access to the OTRE.
+ * @author stephan
+ * @since 0.7.0
+ */
+public interface IOTTransformer {
+
+ /** Create a new instance of the OTRE transformer (of class org.eclipse.objectteams.otre.jplis.ObjectTeamsTransformer). */
+ ClassFileTransformer getNewTransformer();
+
+ /**
+ * Read all OT-relevant bytecode attributes for a class.
+ * @param openStream an opened input stream providing the class bytes
+ * @param file file name of the class file
+ * @param loader class loader to use for subsequent class lookup
+ * @return returns as a token the transformer which can be passed back to {@link #fetchAdaptedBases(Object)} for retrieving information found during scanning.
+ */
+ Object readOTAttributes(InputStream openStream, String file, ClassLoader loader) throws ClassFormatError, IOException;
+
+ /**
+ * Get all adapted base classes that were recorded during a prior call to {@link #readOTAttributes(InputStream, String, ClassLoader)}.
+ * @param token the result return from the call to {@link #readOTAttributes(InputStream, String, ClassLoader)}
+ * @return a collection of fully qualified names of bound base classes.
+ */
+ Collection<String> fetchAdaptedBases(Object token);
+
+ /**
+ * Retrieve the list of all roles from a given team
+ * @param teamClassName name of the team class
+ * @return list of fully qualified role names (in attribute syntax using '.' and '$' delimiters)
+ */
+ List<String> getRolesPerTeam(String teamClassName);
+}
diff --git a/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/OTEquinoxServiceWatcher.java b/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/OTEquinoxServiceWatcher.java
index 0dc137ba9..295aedfc9 100644
--- a/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/OTEquinoxServiceWatcher.java
+++ b/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/OTEquinoxServiceWatcher.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2007, 2010 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -25,6 +25,7 @@ import java.net.URLConnection;
import java.util.Properties;
import org.eclipse.objectteams.otequinox.hook.IOTEquinoxService;
+import org.eclipse.objectteams.otequinox.hook.IOTTransformer;
import org.eclipse.osgi.baseadaptor.BaseAdaptor;
import org.eclipse.osgi.baseadaptor.hooks.AdaptorHook;
import org.eclipse.osgi.framework.log.FrameworkLog;
@@ -67,6 +68,20 @@ public class OTEquinoxServiceWatcher implements AdaptorHook {
catch (Exception ex) {
ex.printStackTrace();
}
+ transformerFilter = "(objectclass="+IOTTransformer.class.getName()+")"; //$NON-NLS-1$ //$NON-NLS-2$
+ //Add listener to listen for the registration of the OTRE service:
+ transformerListener = new ServiceListener() {
+ public void serviceChanged(ServiceEvent event) {
+ if(event.getType() == ServiceEvent.REGISTERED)
+ connectOTTransformerService(context);
+ }
+ };
+ try {
+ context.addServiceListener(transformerListener,transformerFilter);
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
ServiceReference ref= context.getServiceReference(PackageAdmin.class.getName());
if (ref!=null)
this.hook.connectPackageAdmin((PackageAdmin)context.getService(ref));
@@ -77,9 +92,14 @@ public class OTEquinoxServiceWatcher implements AdaptorHook {
ServiceReference ref= context.getServiceReference(IOTEquinoxService.class.getName());
if (ref!=null)
this.hook.connectOTEquinoxService((IOTEquinoxService)context.getService(ref));
+ }
+
+ private void connectOTTransformerService (BundleContext context) {
+ ServiceReference ref= context.getServiceReference(IOTTransformer.class.getName());
+ if (ref!=null)
+ this.hook.connectOTTransformerService((IOTTransformer)context.getService(ref));
}
-
/**
* Capture the system bundle at start-up:
* (see {@link AdaptorHook#frameworkStart(BundleContext)}
diff --git a/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/TransformerHook.java b/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/TransformerHook.java
index 87e86e95e..aac5fe194 100644
--- a/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/TransformerHook.java
+++ b/plugins/org.eclipse.objectteams.otequinox.hook/src/org/eclipse/objectteams/otequinox/internal/hook/TransformerHook.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2004, 2009 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -21,6 +21,7 @@
package org.eclipse.objectteams.otequinox.internal.hook;
import java.io.InputStream;
+import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.net.URL;
import java.security.ProtectionDomain;
@@ -51,9 +52,9 @@ import org.eclipse.objectteams.otequinox.hook.HookConfigurator;
import org.eclipse.objectteams.otequinox.hook.IByteCodeAnalyzer;
import org.eclipse.objectteams.otequinox.hook.ILogger;
import org.eclipse.objectteams.otequinox.hook.IOTEquinoxService;
+import org.eclipse.objectteams.otequinox.hook.IOTTransformer;
import org.eclipse.objectteams.otequinox.hook.ITeamLoader;
import org.eclipse.objectteams.otequinox.internal.hook.Util.ProfileKind;
-import org.eclipse.objectteams.otre.jplis.ObjectTeamsTransformer;
import org.osgi.framework.Bundle;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -179,6 +180,9 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
// logging (console or via FrameworkLog):
final private ILogger logger;
+ // gateway to the OTRE proper:
+ private IOTTransformer transformerService;
+
final private HashSet<Bundle> uninstalling = new HashSet<Bundle>();
// Class loaders for which initializedClassLoader is currently executing (usable, but not yet registered):
@@ -205,6 +209,11 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
this.logger.log(Util.INFO, "OT/Equinox: connected the transformer service");
}
+ /** Invoked when the TransformerPlugin has registered the OTRE as a service. */
+ void connectOTTransformerService(IOTTransformer transformerService) {
+ this.transformerService = transformerService;
+ }
+
void connectPackageAdmin(PackageAdmin packageAdmin) {
this.packageAdmin = packageAdmin;
}
@@ -241,7 +250,7 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
// on each invocation because the OTRE is _not_ thread safe,
// specifically the field ObjectTeamsTransformation.factory
// MUST NOT be accessed or even assigned concurrently.
- ObjectTeamsTransformer objectTeamsTransformer= null;
+ ClassFileTransformer objectTeamsTransformer= null;
ClassLoader resourceLoader = null;
if (ClassScanner.REPOSITORY_USE_RESOURCE_LOADER)
@@ -253,13 +262,13 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
ClassKind classKind= fetchTransformationKind(classbytes, name, resourceLoader, bundle);
if (Util.PROFILE) Util.profile(time, ProfileKind.SuperClassFetching, "", this.logger);
if (classKind == ClassKind.BASE) {
- objectTeamsTransformer= new ObjectTeamsTransformer();
+ objectTeamsTransformer= this.transformerService.getNewTransformer();
classbytes= transformClass(objectTeamsTransformer, resourceLoader,
name, classbytes, domain,
"potential base", ProfileKind.BaseTransformation);
// ==== loading a role class?
} else if (classKind == ClassKind.ROLE) {
- objectTeamsTransformer= new ObjectTeamsTransformer();
+ objectTeamsTransformer= this.transformerService.getNewTransformer();
classbytes= transformClass(objectTeamsTransformer, resourceLoader,
name, classbytes, domain,
"role", ProfileKind.AspectTransformation); //$NON-NLS-1$
@@ -277,7 +286,7 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
}
AspectBundleRole.markLoadingTeams(bundleRegistry, bundle.getSymbolicName(), true);
// transform the aspect:
- objectTeamsTransformer= new ObjectTeamsTransformer();
+ objectTeamsTransformer= this.transformerService.getNewTransformer();
classbytes= transformClass(objectTeamsTransformer, resourceLoader,
name, classbytes, domain,
"team", ProfileKind.AspectTransformation); //$NON-NLS-1$
@@ -289,7 +298,7 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
&& WEAVE_BUNDLES.contains(bundle.getSymbolicName())
&& this.aspectRegistry.isAdaptedBasePlugin(bundle.getSymbolicName()))
{
- objectTeamsTransformer= new ObjectTeamsTransformer();
+ objectTeamsTransformer= this.transformerService.getNewTransformer();
classbytes= transformClass(objectTeamsTransformer, resourceLoader,
name, classbytes, domain,
"ordinary class (could be sub base class)", ProfileKind.BaseTransformation);
@@ -306,7 +315,7 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
}
// transform, log and profile:
- private byte[] transformClass(ObjectTeamsTransformer objectTeamsTransformer, ClassLoader resourceLoader,
+ private byte[] transformClass(ClassFileTransformer objectTeamsTransformer, ClassLoader resourceLoader,
String name, byte[] classbytes, ProtectionDomain domain,
String kind, ProfileKind profileKind)
throws IllegalClassFormatException
@@ -320,7 +329,7 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
}
// hook method, no specific action
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public boolean addClassPathEntry(
ArrayList cpEntries,
String cp,
@@ -452,7 +461,7 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
private void checkLoadTeams(BaseClassLoader bundleClassLoader, Bundle bundle)
{
this.pendingClassLoaders.put(bundle,bundleClassLoader);
- ClassScanner scanner = new ClassScanner();
+ ClassScanner scanner = new ClassScanner(this.transformerService);
this.bundleRegistry.checkLoadTeams(bundle, this.aspectRegistry, this.teamLoadingService, scanner);
recordRolesAndBases(scanner);
this.pendingClassLoaders.remove(bundle);
@@ -520,7 +529,7 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
// aspectRole needed to record 'aspectRole.isLoading' from processClass().
this.bundleRegistry.createAspectRole(bundle.getSymbolicName());
this.logger.log(Util.OK, "Will load internal teams of "+bundle.getSymbolicName());
- ClassScanner scanner = new ClassScanner();
+ ClassScanner scanner = new ClassScanner(this.transformerService);
if (this.teamLoadingService.loadInternalTeams(bundle, scanner)) {
recordRolesAndBases(scanner);
BaseBundleRole baseRole= BaseBundleRole.createBaseBundleRole(bundleRegistry, bundle, bundle); // self-adapting
@@ -636,7 +645,7 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
public URL postFindResource(String name, BundleClassLoader classLoader, BundleData data) {
return null;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Enumeration postFindResources(String name, BundleClassLoader classLoader, BundleData data) {
return null;
}
@@ -646,7 +655,7 @@ public class TransformerHook implements ClassLoadingHook, BundleWatcher, ClassLo
public URL preFindResource(String name, BundleClassLoader classLoader, BundleData data) {
return null;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Enumeration preFindResources(String name, BundleClassLoader classLoader, BundleData data) {
return null;
}
diff --git a/plugins/org.eclipse.objectteams.otequinox.runtime/.classpath b/plugins/org.eclipse.objectteams.otequinox.runtime/.classpath
index 7cec603db..3826cef1d 100644
--- a/plugins/org.eclipse.objectteams.otequinox.runtime/.classpath
+++ b/plugins/org.eclipse.objectteams.otequinox.runtime/.classpath
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry exported="true" kind="lib" path="lib/BCEL.jar" sourcepath="/bcel-5.2/src/java"/>
+ <classpathentry exported="true" kind="lib" path="lib/otre.jar"/>
</classpath>
diff --git a/plugins/org.eclipse.objectteams.otequinox.runtime/.project b/plugins/org.eclipse.objectteams.otequinox.runtime/.project
index e016377de..2b6494e47 100644
--- a/plugins/org.eclipse.objectteams.otequinox.runtime/.project
+++ b/plugins/org.eclipse.objectteams.otequinox.runtime/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.objectteams.otequinox.runtime</name>
+ <name>org.eclipse.objectteams.runtime</name>
<comment></comment>
<projects>
</projects>
diff --git a/plugins/org.eclipse.objectteams.otequinox.runtime/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otequinox.runtime/META-INF/MANIFEST.MF
index 7ed71413a..6762f33bc 100644
--- a/plugins/org.eclipse.objectteams.otequinox.runtime/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otequinox.runtime/META-INF/MANIFEST.MF
@@ -1,10 +1,17 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: OTRE OSGI Extension Bundle
-Bundle-SymbolicName: org.eclipse.objectteams.otequinox.runtime
-Bundle-Version: 1.4.0.qualifier
-Bundle-Vendor: objectteams.org
-Fragment-Host: org.eclipse.osgi;bundle-version="[3.6.0.v20090928,4.0.0)"
+Bundle-SymbolicName: org.eclipse.objectteams.runtime
+Bundle-Version: 0.7.0.qualifier
+Bundle-Vendor: Eclipse Object Teams Project
Export-Package: org.objectteams,
- org.eclipse.objectteams.otre
+ org.eclipse.objectteams.otre,
+ org.eclipse.objectteams.otre.jplis,
+ org.eclipse.objectteams.otre.util,
+ org.apache.bcel,
+ org.apache.bcel.classfile,
+ org.apache.bcel.generic,
+ org.apache.bcel.util
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: lib/BCEL.jar,
+ lib/otre.jar
diff --git a/plugins/org.eclipse.objectteams.otequinox.runtime/README.txt b/plugins/org.eclipse.objectteams.otequinox.runtime/README.txt
deleted file mode 100644
index 1ce681d48..000000000
--- a/plugins/org.eclipse.objectteams.otequinox.runtime/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Libraries used in this transformer.hook OSGI extension bundle can not be
-packaged as inner jar files (e.g. otre.jar and BCEL.jar), as OSGI does not
-know how to deal with those.
-
-See https://bugs.eclipse.org/bugs/show_bug.cgi?id=143283 \ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otequinox.runtime/build.properties b/plugins/org.eclipse.objectteams.otequinox.runtime/build.properties
index a647fe085..434d732c6 100644
--- a/plugins/org.eclipse.objectteams.otequinox.runtime/build.properties
+++ b/plugins/org.eclipse.objectteams.otequinox.runtime/build.properties
@@ -1,8 +1,7 @@
bin.includes = META-INF/,\
- de/,\
- gnu/,\
- org/
+ lib/BCEL.jar,\
+ lib/otre.jar
src.includes = build.properties,\
README.txt,\
.project,\
- .classpath
+ .classpath \ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otequinox/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otequinox/META-INF/MANIFEST.MF
index 38e210eab..fbcbac915 100644
--- a/plugins/org.eclipse.objectteams.otequinox/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otequinox/META-INF/MANIFEST.MF
@@ -7,10 +7,10 @@ Bundle-Vendor: objectteams.org
Require-Bundle: org.eclipse.equinox.common,
org.eclipse.equinox.registry,
org.eclipse.osgi;bundle-version="[3.6.0.v20090928,4.0.0)",
- org.objectweb.asm;bundle-version="[3.1.0,4.0.0)"
+ org.objectweb.asm;bundle-version="[3.1.0,4.0.0)",
+ org.eclipse.objectteams.runtime;bundle-version="[0.7.0,1.0.0)";visibility:=reexport
Import-Package: org.eclipse.core.internal.runtime;resolution:=optional,
- org.eclipse.objectteams.otequinox.hook,
- org.eclipse.objectteams.otre
+ org.eclipse.objectteams.otequinox.hook
Bundle-Activator: org.eclipse.objectteams.otequinox.TransformerPlugin
Export-Package: org.eclipse.objectteams.otequinox
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/TransformerPlugin.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/TransformerPlugin.java
index a6f819365..b41d41716 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/TransformerPlugin.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/TransformerPlugin.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -37,12 +37,14 @@ import org.eclipse.objectteams.otequinox.internal.ASMByteCodeAnalyzer;
import org.eclipse.objectteams.otequinox.internal.AspectBinding;
import org.eclipse.objectteams.otequinox.internal.AspectPermissionManager;
import org.eclipse.objectteams.otequinox.internal.MasterTeamLoader;
+import org.eclipse.objectteams.otequinox.internal.TransformerServiceDelegate;
import org.eclipse.objectteams.otequinox.hook.ClassScanner;
import org.eclipse.objectteams.otequinox.hook.HookConfigurator;
import org.eclipse.objectteams.otequinox.hook.IAspectRegistry;
import org.eclipse.objectteams.otequinox.hook.IByteCodeAnalyzer;
import org.eclipse.objectteams.otequinox.hook.ILogger;
import org.eclipse.objectteams.otequinox.hook.IOTEquinoxService;
+import org.eclipse.objectteams.otequinox.hook.IOTTransformer;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -87,7 +89,8 @@ public class TransformerPlugin implements BundleActivator, IOTEquinoxService
/** The instance that is created by the framework. */
private static TransformerPlugin instance;
- private ServiceRegistration serviceRegistration;
+ private ServiceRegistration serviceRegistration; // IOTEquinoxService
+ private ServiceRegistration serviceRegistration2; // IOTTransformer
private ILogger log;
/** instances which may have pending team classes waiting for instantiation. */
@@ -125,11 +128,13 @@ public class TransformerPlugin implements BundleActivator, IOTEquinoxService
this.permissionManager.loadAspectBindingNegotiators(context);
loadAspectBindings();
this.serviceRegistration = context.registerService(IOTEquinoxService.class.getName(), this, new Properties());
+ this.serviceRegistration2 = context.registerService(IOTTransformer.class.getName(), new TransformerServiceDelegate(), new Properties());
}
/* be a good citizen: clean up. */
public void stop(BundleContext context) throws Exception {
serviceRegistration.unregister();
+ serviceRegistration2.unregister();
}
public static TransformerPlugin getDefault() {
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/internal/TransformerServiceDelegate.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/internal/TransformerServiceDelegate.java
new file mode 100644
index 000000000..7918543d1
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/internal/TransformerServiceDelegate.java
@@ -0,0 +1,79 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2010 Stephan Herrmann
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Stephan Herrmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otequinox.internal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.instrument.ClassFileTransformer;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.objectteams.otre.jplis.ObjectTeamsTransformer;
+import org.eclipse.objectteams.otre.util.CallinBindingManager;
+
+import org.eclipse.objectteams.otequinox.hook.IOTTransformer;
+
+/**
+ * Service implementation for providing org.eclipse.objectteams.otequinox.hook with an
+ * access to the OTRE.
+ *
+ * @author stephan
+ * @since 0.7.0
+ */
+public class TransformerServiceDelegate implements IOTTransformer {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.objectteams.otequinox.hook.IOTTransformer#getNewTransformer()
+ */
+ public ClassFileTransformer getNewTransformer() {
+ return new ObjectTeamsTransformer();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.objectteams.otequinox.hook.IOTTransformer#readOTAttributes(java.io.InputStream, java.lang.String, java.lang.ClassLoader)
+ */
+ public Object readOTAttributes(InputStream openStream, String file, ClassLoader loader)
+ throws ClassFormatError, IOException
+ {
+ ObjectTeamsTransformer transformer = new ObjectTeamsTransformer();
+ transformer.readOTAttributes(openStream, file, loader);
+ return transformer;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.objectteams.otequinox.hook.IOTTransformer#fetchAdaptedBases(java.lang.Object)
+ */
+ public Collection<String> fetchAdaptedBases(Object token) {
+ try {
+ return ((ObjectTeamsTransformer)token).fetchAdaptedBases();
+ } catch (ClassCastException cce) {
+ throw new IllegalArgumentException("Provided token is not an ObjectTeamsTransformer");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.objectteams.otequinox.hook.IOTTransformer#getRolesPerTeam(java.lang.String)
+ */
+ public List<String> getRolesPerTeam(String teamClassName) {
+ return CallinBindingManager.getRolePerTeam(teamClassName);
+ }
+
+}

Back to the top