diff options
5 files changed, 9 insertions, 114 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Activator.java b/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Activator.java index 1691d7427..0d2ea4fc0 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Activator.java +++ b/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Activator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * 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 @@ -11,8 +11,8 @@ *******************************************************************************/ package org.eclipse.equinox.internal.frameworkadmin.utils; -import org.eclipse.osgi.service.pluginconversion.PluginConverter; -import org.osgi.framework.*; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; /** * @since 1.0 @@ -35,18 +35,4 @@ public class Activator implements BundleActivator { bundleContext = null; } - /* - * Acquire the plug-in conversion service or return <code>null</code> if it is not available. - */ - public static PluginConverter acquirePluginConverter() { - if (bundleContext == null) - return null; - ServiceReference<PluginConverter> reference = bundleContext.getServiceReference(PluginConverter.class); - if (reference == null) - return null; - PluginConverter result = bundleContext.getService(reference); - bundleContext.ungetService(reference); - return result; - } - } diff --git a/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Utils.java b/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Utils.java index 736d71b61..7af5663c7 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Utils.java +++ b/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Utils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * 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 @@ -17,20 +17,15 @@ import java.util.*; import java.util.jar.JarFile; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.URIUtil; import org.eclipse.equinox.frameworkadmin.BundleInfo; -import org.eclipse.osgi.service.pluginconversion.PluginConversionException; -import org.eclipse.osgi.service.pluginconversion.PluginConverter; import org.eclipse.osgi.util.ManifestElement; import org.osgi.framework.BundleException; import org.osgi.framework.Constants; public class Utils { - private static final String FEATURE_MANIFEST = "feature.xml"; //$NON-NLS-1$ private static final String FILE_SCHEME = "file"; //$NON-NLS-1$ - private static final String FRAGMENT_MANIFEST = "fragment.xml"; //$NON-NLS-1$ private static final String PATH_SEP = "/"; //$NON-NLS-1$ - private static final String PLUGIN_MANIFEST = "plugin.xml"; //$NON-NLS-1$ /** * Overwrite all properties of from to the properties of to. Return the result of to. @@ -79,13 +74,13 @@ public class Utils { } // we were unable to get an OSGi manifest file so try and convert an old-style manifest if (manifestStream == null) - return convertPluginManifest(bundleLocation, true); + return null; try { Map<String, String> manifest = ManifestElement.parseBundleManifest(manifestStream, null); // add this check to handle the case were we read a non-OSGi manifest if (manifest.get(Constants.BUNDLE_SYMBOLICNAME) == null) - return convertPluginManifest(bundleLocation, true); + return null; return manifestToProperties(manifest); } catch (IOException ioe) { return null; @@ -143,33 +138,6 @@ public class Utils { } } - /* - * Copied from BundleDescriptionFactory in the metadata generator. - */ - private static Dictionary<String, String> convertPluginManifest(File bundleLocation, boolean logConversionException) { - PluginConverter converter; - try { - converter = org.eclipse.equinox.internal.frameworkadmin.utils.Activator.acquirePluginConverter(); - if (converter == null) { - new RuntimeException("Unable to aquire PluginConverter service during generation for: " + bundleLocation).printStackTrace(); //$NON-NLS-1$ - return null; - } - return converter.convertManifest(bundleLocation, false, null, true, null); - } catch (PluginConversionException convertException) { - // only log the exception if we had a plugin.xml or fragment.xml and we failed conversion - if (bundleLocation.getName().equals(FEATURE_MANIFEST)) - return null; - if (!new File(bundleLocation, PLUGIN_MANIFEST).exists() && !new File(bundleLocation, FRAGMENT_MANIFEST).exists()) - return null; - if (logConversionException) { - IStatus status = new Status(IStatus.WARNING, "org.eclipse.equinox.frameworkadmin", 0, "Error converting bundle manifest.", convertException); //$NON-NLS-1$ //$NON-NLS-2$ - System.out.println(status); - //TODO Need to find a way to get a logging service to log - } - return null; - } - } - public static boolean createParentDir(File file) { File parent = file.getParentFile(); if (parent == null) @@ -230,11 +198,6 @@ public class Utils { // if we have a JAR'd bundle that has a non-OSGi manifest file (like // the ones produced by Ant, then try and convert the plugin.xml if (manifest.get(Constants.BUNDLE_SYMBOLICNAME) == null) { - String jarName = jar.getName(); - File file = jarName != null ? new File(jarName) : null; - if (file != null && file.exists()) { - return convertPluginManifest(file, true); - } return null; } return manifestToProperties(manifest); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java index 578f88961..3c3db9e5d 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java @@ -21,7 +21,6 @@ import java.util.zip.ZipFile; import org.eclipse.core.runtime.*; import org.eclipse.equinox.frameworkadmin.BundleInfo; import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; -import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; import org.eclipse.equinox.internal.p2.publisher.Messages; import org.eclipse.equinox.internal.p2.publisher.eclipse.GeneratorBundleInfo; @@ -38,8 +37,6 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.spi.p2.publisher.LocalizationHelper; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.eclipse.osgi.framework.util.Headers; -import org.eclipse.osgi.service.pluginconversion.PluginConversionException; -import org.eclipse.osgi.service.pluginconversion.PluginConverter; import org.eclipse.osgi.service.resolver.*; import org.eclipse.osgi.util.ManifestElement; import org.eclipse.osgi.util.NLS; @@ -91,9 +88,6 @@ public class BundlesAction extends AbstractPublisherAction { public static final int BUNDLE_LOCALIZATION_INDEX = PublisherHelper.BUNDLE_LOCALIZED_PROPERTIES.length - 1; public static final String DIR = "dir"; //$NON-NLS-1$ public static final String JAR = "jar"; //$NON-NLS-1$ - private static final String FEATURE_FILENAME_DESCRIPTOR = "feature.xml"; //$NON-NLS-1$ - private static final String PLUGIN_FILENAME_DESCRIPTOR = "plugin.xml"; //$NON-NLS-1$ - private static final String FRAGMENT_FILENAME_DESCRIPTOR = "fragment.xml"; //$NON-NLS-1$ public static final String BUNDLE_SHAPE = "Eclipse-BundleShape"; //$NON-NLS-1$ /** @@ -510,34 +504,6 @@ public class BundlesAction extends AbstractPublisherAction { return localizations; } - private static PluginConverter acquirePluginConverter() { - return ServiceHelper.getService(Activator.getContext(), PluginConverter.class); - } - - private static Dictionary<String, String> convertPluginManifest(File bundleLocation, boolean logConversionException) { - PluginConverter converter; - try { - converter = acquirePluginConverter(); - if (converter == null) { - String message = NLS.bind(Messages.exception_noPluginConverter, bundleLocation); - LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message)); - return null; - } - return converter.convertManifest(bundleLocation, false, null, true, null); - } catch (PluginConversionException convertException) { - // only log the exception if we had a plugin.xml or fragment.xml and we failed conversion - if (bundleLocation.getName().equals(FEATURE_FILENAME_DESCRIPTOR)) - return null; - if (!new File(bundleLocation, PLUGIN_FILENAME_DESCRIPTOR).exists() && !new File(bundleLocation, FRAGMENT_FILENAME_DESCRIPTOR).exists()) - return null; - if (logConversionException) { - IStatus status = new Status(IStatus.WARNING, Activator.ID, 0, NLS.bind(Messages.exception_errorConverting, bundleLocation.getAbsolutePath()), convertException); - LogHelper.log(status); - } - return null; - } - } - public static BundleDescription createBundleDescription(Dictionary<String, String> enhancedManifest, File bundleLocation) { try { BundleDescription descriptor = StateObjectFactory.defaultFactory.createBundleDescription(null, enhancedManifest, bundleLocation == null ? null : bundleLocation.getAbsolutePath(), 1); //TODO Do we need to have a real bundle id @@ -640,16 +606,6 @@ public class BundlesAction extends AbstractPublisherAction { try { if (manifestStream != null) { manifest = parseBundleManifestIntoModifyableDictionaryWithCaseInsensitiveKeys(manifestStream); - } else { - // Bug 437466 - erroneous PluginConverter message caused by a directory in "dropins" - // We might need the Eclipse 2.0 converter, if and only if - // there is a 'plugin.xml' file or "fragment.xml" file at bundle - // location. If there is none, it is probably "just a directory", - // perhaps with other bundles under it (but, drilling down in the - // directory is handled elsewhere, if we return null manifest here. - if (bundleLocation.isDirectory() && (new File(bundleLocation, PLUGIN_FILENAME_DESCRIPTOR).exists() || new File(bundleLocation, FRAGMENT_FILENAME_DESCRIPTOR).exists())) { - manifest = convertPluginManifest(bundleLocation, true); - } } } finally { try { @@ -660,12 +616,6 @@ public class BundlesAction extends AbstractPublisherAction { } } - if (manifest == null) - return null; - - //Deal with the pre-3.0 plug-in shape who have a default jar manifest.mf - if (manifest.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME) == null) - manifest = convertPluginManifest(bundleLocation, true); return manifest; } diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java index a6623af38..bc13927d1 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2007, 2017 IBM Corporation and others. 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 @@ -15,13 +15,11 @@ import org.eclipse.osgi.util.NLS; public class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.publisher.messages";//$NON-NLS-1$ - public static String exception_errorConverting; public static String exception_stateAddition; public static String exception_errorReadingManifest; public static String exception_errorLoadingManifest; public static String exception_errorPublishingBundle; public static String exception_errorLoadingProductFile; - public static String exception_noPluginConverter; public static String exception_noArtifactRepo; public static String exception_noMetadataRepo; public static String exception_noBundlesOrLocations; diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties index aa28ffe16..3641a9be4 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2007, 2012 IBM Corporation and others. +# Copyright (c) 2007, 2017 IBM Corporation and others. # 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 @@ -9,14 +9,12 @@ # IBM Corporation - initial API and implementation # SAP AG - ongoing development ############################################################################### -exception_errorConverting = An error occurred while generating manifest for {0}. exception_stateAddition = An error has occurred while adding the bundle {0}. exception_errorReadingManifest = An error occurred while parsing the bundle manifest {0}: {1}. exception_errorLoadingManifest = An error occurred while loading the manifest {0}. exception_errorPublishingBundle = An error occurred while publishing bundle {0}: {1} exception_noBundlesOrLocations=No bundles or locations provided. exception_noFeaturesOrLocations=No features or locations provided. -exception_noPluginConverter=Unable to acquire PluginConverter service during generation for: {0}. exception_noArtifactRepo=An artifact repository must be specified in order to publish artifacts. exception_noMetadataRepo=A metadata repository must be specified. exception_invalidSiteReference=Invalid site reference: {0} |