From 3c485f8b461f0fee1655d432cb1ce1284139fbe7 Mon Sep 17 00:00:00 2001 From: Igor Fedorenko Date: Thu, 12 Jun 2014 20:12:37 -0400 Subject: 437318 removed kepler support Change-Id: I690792c75f8e9b1cf08e739af71f041438d81fea Signed-off-by: Igor Fedorenko --- org.eclipse.m2e.core/META-INF/MANIFEST.MF | 3 +- .../m2e/core/internal/e44/DevClassPathHelper.java | 61 --------------- .../m2e/core/internal/e44/EquinoxLocker.java | 86 ---------------------- .../core/internal/equinox/DevClassPathHelper.java | 29 ++++++++ .../m2e/core/internal/equinox/EquinoxLocker.java | 46 ++++++++++++ .../internal/index/nexus/NexusIndexManager.java | 2 +- .../core/internal/launch/MavenEmbeddedRuntime.java | 2 +- 7 files changed, 79 insertions(+), 150 deletions(-) delete mode 100644 org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/e44/DevClassPathHelper.java delete mode 100644 org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/e44/EquinoxLocker.java create mode 100644 org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/equinox/DevClassPathHelper.java create mode 100644 org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/equinox/EquinoxLocker.java (limited to 'org.eclipse.m2e.core') diff --git a/org.eclipse.m2e.core/META-INF/MANIFEST.MF b/org.eclipse.m2e.core/META-INF/MANIFEST.MF index e8bd71f1..266cd922 100644 --- a/org.eclipse.m2e.core/META-INF/MANIFEST.MF +++ b/org.eclipse.m2e.core/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 1.6.0.qualifier Bundle-Activator: org.eclipse.m2e.core.internal.MavenPluginActivator Bundle-Vendor: %Bundle-Vendor Bundle-Localization: plugin -Require-Bundle: +Require-Bundle: org.eclipse.osgi;bundle-version="3.10.0", org.eclipse.core.runtime;bundle-version="3.7.0", org.eclipse.core.resources;bundle-version="3.9.0", org.eclipse.m2e.maven.runtime;bundle-version="[1.6.0,1.7.0)", @@ -27,6 +27,7 @@ Export-Package: org.eclipse.m2e.core, org.eclipse.m2e.core.internal.builder.plexusbuildapi;x-internal:=true, org.eclipse.m2e.core.internal.content;x-internal:=true, org.eclipse.m2e.core.internal.embedder;x-internal:=true, + org.eclipse.m2e.core.internal.equinox;x-internal:=true, org.eclipse.m2e.core.internal.index;x-internal:=true, org.eclipse.m2e.core.internal.index.filter;x-internal:=true, org.eclipse.m2e.core.internal.index.nexus;x-internal:=true, diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/e44/DevClassPathHelper.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/e44/DevClassPathHelper.java deleted file mode 100644 index 371d2bb4..00000000 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/e44/DevClassPathHelper.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Igor Fedorenko - * 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 - * - * Contributors: - * Igor Fedorenko - initial API and implementation - *******************************************************************************/ - -package org.eclipse.m2e.core.internal.e44; - -import java.lang.reflect.Method; - - -/** - * Reflection based adaptor that provides Equinox development classpath information and is meant to compensate for - * implementation changes between Equinox 3.9 and 3.10. - * - * @see http://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg09424.html - * @since 1.5 - */ -public class DevClassPathHelper { - - private static final String E43 = "org.eclipse.osgi.internal.baseadaptor.DevClassPathHelper"; - - private static final String E44 = "org.eclipse.core.internal.runtime.DevClassPathHelper"; - - @SuppressWarnings("unchecked") - private static T invoke(String methodName, Class returnType, Object... params) { - try { - ClassLoader cl = DevClassPathHelper.class.getClassLoader(); - Class helper; - try { - helper = cl.loadClass(E44); - } catch(ClassNotFoundException ex) { - helper = cl.loadClass(E43); - } - Class[] paramTypes = null; - if(params != null) { - paramTypes = new Class[params.length]; - for(int i = 0; i < params.length; i++ ) { - paramTypes[i] = params[i].getClass(); - } - } - Method method = helper.getMethod(methodName, paramTypes); - return (T) method.invoke(null, params); - } catch(Exception e) { - throw new RuntimeException(e); - } - } - - public static String[] getDevClassPath(String bundleSymbolicName) { - return invoke("getDevClassPath", String[].class, bundleSymbolicName); - } - - public static boolean inDevelopmentMode() { - return invoke("inDevelopmentMode", boolean.class); - } -} diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/e44/EquinoxLocker.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/e44/EquinoxLocker.java deleted file mode 100644 index b6f3b63d..00000000 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/e44/EquinoxLocker.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Igor Fedorenko - * 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 - * - * Contributors: - * Igor Fedorenko - initial API and implementation - *******************************************************************************/ - -package org.eclipse.m2e.core.internal.e44; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.apache.maven.index.fs.Lock; -import org.apache.maven.index.fs.Locker; - - -/** - * This class provides reflection-based adaptor for Equinox internal file Locker implementation and is meant to - * compensate for changes between Equinox 3.9 and 3.10. - * - * @see http://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg09424.html - * @since 1.5 - */ -public class EquinoxLocker implements Locker { - - private static final String E43_LOCATION_HELPER = "org.eclipse.core.runtime.internal.adaptor.BasicLocation"; - - private static final String E44_LOCATION_HELPER = "org.eclipse.osgi.internal.location.LocationHelper"; - - private static class EquinoxLock implements Lock { - - private Object locker; - - public EquinoxLock(Object locker) { - this.locker = locker; - } - - public void release() { - try { - Method releaseMethod = locker.getClass().getMethod("release", (Class[]) null); - releaseMethod.invoke(locker, (Object[]) null); - } catch(Exception e) { - throw new RuntimeException(e); - } - } - } - - @Override - public Lock lock(File directory) throws IOException { - File lockFile = new File(directory, LOCK_FILE); - - ClassLoader cl = EquinoxLocker.class.getClassLoader(); - - try { - Object locker; - try { - Class locationHelper = cl.loadClass(E44_LOCATION_HELPER); - Method createLockerMethod = locationHelper.getMethod("createLocker", File.class, String.class, boolean.class); - - locker = createLockerMethod.invoke(null, lockFile, null /*lockMode*/, false /*debug*/); - } catch(ClassNotFoundException ex) { - Class locationHelper = cl.loadClass(E43_LOCATION_HELPER); - Method createLockerMethod = locationHelper.getMethod("createLocker", File.class, String.class); - locker = createLockerMethod.invoke(null, lockFile, null /*lockMode*/); - } - - Method lockMethod = locker.getClass().getMethod("lock", (Class[]) null); - lockMethod.invoke(locker, (Object[]) null); - - return new EquinoxLock(locker); - } catch(InvocationTargetException e) { - if(e.getCause() instanceof IOException) { - throw (IOException) e.getCause(); - } - throw new RuntimeException(e); - } catch(Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/equinox/DevClassPathHelper.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/equinox/DevClassPathHelper.java new file mode 100644 index 00000000..982aa6b4 --- /dev/null +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/equinox/DevClassPathHelper.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2013 Igor Fedorenko + * 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 + * + * Contributors: + * Igor Fedorenko - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.core.internal.equinox; + +/** + * Facade that provides Equinox development classpath information. + * + * @since 1.5 + */ +@SuppressWarnings("restriction") +public class DevClassPathHelper { + + public static String[] getDevClassPath(String bundleSymbolicName) { + return org.eclipse.core.internal.runtime.DevClassPathHelper.getDevClassPath(bundleSymbolicName); + } + + public static boolean inDevelopmentMode() { + return org.eclipse.core.internal.runtime.DevClassPathHelper.inDevelopmentMode(); + } +} diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/equinox/EquinoxLocker.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/equinox/EquinoxLocker.java new file mode 100644 index 00000000..5d6b2116 --- /dev/null +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/equinox/EquinoxLocker.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2013 Igor Fedorenko + * 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 + * + * Contributors: + * Igor Fedorenko - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.core.internal.equinox; + +import java.io.File; + +import org.eclipse.osgi.internal.location.LocationHelper; +import org.eclipse.osgi.internal.location.Locker; + + +/** + * Adaptor for Equinox internal file Locker implementation + * + * @since 1.5 + */ +@SuppressWarnings("restriction") +public class EquinoxLocker implements org.apache.maven.index.fs.Locker { + + private static class EquinoxLock implements org.apache.maven.index.fs.Lock { + + private Locker locker; + + public EquinoxLock(Locker locker) { + this.locker = locker; + } + + public void release() { + locker.release(); + } + } + + @Override + public org.apache.maven.index.fs.Lock lock(File directory) { + File lock = new File(directory, LOCK_FILE); + return new EquinoxLock(LocationHelper.createLocker(lock, null /*lockMode*/, false /*debug*/)); + } +} diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java index 1cd90ea4..96863151 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java @@ -92,7 +92,7 @@ import org.eclipse.m2e.core.internal.IMavenConstants; import org.eclipse.m2e.core.internal.MavenPluginActivator; import org.eclipse.m2e.core.internal.Messages; import org.eclipse.m2e.core.internal.NoSuchComponentException; -import org.eclipse.m2e.core.internal.e44.EquinoxLocker; +import org.eclipse.m2e.core.internal.equinox.EquinoxLocker; import org.eclipse.m2e.core.internal.index.IIndex; import org.eclipse.m2e.core.internal.index.IndexListener; import org.eclipse.m2e.core.internal.index.IndexManager; diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenEmbeddedRuntime.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenEmbeddedRuntime.java index 4eae036c..505dba81 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenEmbeddedRuntime.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenEmbeddedRuntime.java @@ -43,7 +43,7 @@ import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration; import org.eclipse.m2e.core.internal.Bundles; import org.eclipse.m2e.core.internal.MavenPluginActivator; import org.eclipse.m2e.core.internal.Messages; -import org.eclipse.m2e.core.internal.e44.DevClassPathHelper; +import org.eclipse.m2e.core.internal.equinox.DevClassPathHelper; /** -- cgit v1.2.3