Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.publisher/src/org')
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java36
3 files changed, 34 insertions, 13 deletions
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 af8eeb7b3..45342b967 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,10 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 2011 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
*
- * Contributors: IBM Corporation - initial API and implementation
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * SAP AG - ongoing development
******************************************************************************/
package org.eclipse.equinox.internal.p2.publisher;
@@ -27,6 +29,7 @@ public class Messages extends NLS {
public static String exception_invalidSiteReferenceInFeature;
public static String exception_repoMustBeURL;
public static String exception_sourcePath;
+ public static String exception_nonExistingJreLocationFile;
public static String message_generatingMetadata;
public static String message_generationCompleted;
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 0b7a16934..2cc00ea2d 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, 2010 IBM Corporation and others.
+# Copyright (c) 2007, 2011 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
@@ -7,6 +7,7 @@
#
# Contributors:
# 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}.
@@ -21,6 +22,7 @@ exception_invalidSiteReference=Invalid site reference: {0}
exception_invalidSiteReferenceInFeature=Invalid site reference {0} in feature {1}.
exception_repoMustBeURL=Repository location ({0}) must be a URL.
exception_sourcePath=Source location ({0}) must be a valid file-system path.
+exception_nonExistingJreLocationFile=Provided location to JRE \"{0}\" does not exist on the file system.
message_generatingMetadata = Generating metadata for {0}.
message_generationCompleted = Generation completed with success [{0} seconds].
message_noSimpleconfigurator = Could not find simpleconfigurator bundle.
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
index 44e08cf27..b0436475c 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
@@ -7,6 +7,7 @@
* Contributors:
* Code 9 - initial API and implementation
* IBM - ongoing development
+ * SAP AG - ongoing development
******************************************************************************/
package org.eclipse.equinox.p2.publisher.actions;
@@ -18,6 +19,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.p2.publisher.Activator;
+import org.eclipse.equinox.internal.p2.publisher.Messages;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription;
@@ -25,6 +27,7 @@ import org.eclipse.equinox.p2.publisher.*;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.spi.p2.publisher.PublisherHelper;
import org.eclipse.osgi.util.ManifestElement;
+import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleException;
public class JREAction extends AbstractPublisherAction {
@@ -82,7 +85,7 @@ public class JREAction extends AbstractPublisherAction {
cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
Map<String, String> touchpointData = new HashMap<String, String>();
- if (jreLocation == null || !jreLocation.exists()) {
+ if (jreLocation == null || !jreLocation.isDirectory()) {
touchpointData.put("install", ""); //$NON-NLS-1$ //$NON-NLS-2$
cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
results.addIU(MetadataFactory.createInstallableUnit(iu), IPublisherResult.ROOT);
@@ -120,7 +123,9 @@ public class JREAction extends AbstractPublisherAction {
IProvidedCapability[] exportedPackageAsCapabilities = new IProvidedCapability[jrePackages.length + 1];
exportedPackageAsCapabilities[0] = PublisherHelper.createSelfCapability(id, version);
for (int i = 1; i <= jrePackages.length; i++) {
- exportedPackageAsCapabilities[i] = MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, jrePackages[i - 1].getValue(), null);
+ String packageName = jrePackages[i - 1].getValue();
+ Version packageVersion = Version.create(jrePackages[i - 1].getAttribute("version")); //$NON-NLS-1$
+ exportedPackageAsCapabilities[i] = MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, packageName, packageVersion);
}
return exportedPackageAsCapabilities;
} catch (BundleException e) {
@@ -176,15 +181,26 @@ public class JREAction extends AbstractPublisherAction {
this.info = publisherInfo;
if (jreLocation != null) {
- //Look for a JRE profile file to set version and capabilities
- File[] profiles = jreLocation.listFiles(new FileFilter() {
- public boolean accept(File pathname) {
- return pathname.getAbsolutePath().endsWith(".profile"); //$NON-NLS-1$
+
+ File javaProfile = null;
+
+ if (jreLocation.isDirectory()) {
+ //Look for a JRE profile file to set version and capabilities
+ File[] profiles = jreLocation.listFiles(new FileFilter() {
+ public boolean accept(File pathname) {
+ return pathname.getAbsolutePath().endsWith(".profile"); //$NON-NLS-1$
+ }
+ });
+ if (profiles != null && profiles.length > 0) {
+ javaProfile = profiles[0];
}
- });
- if (profiles != null && profiles.length > 0) {
- profileProperties = loadProfile(profiles[0]);
- }
+ } else if (jreLocation.isFile())
+ javaProfile = jreLocation;
+ else
+ // jreLocation file does not exist
+ throw new IllegalArgumentException(NLS.bind(Messages.exception_nonExistingJreLocationFile, jreLocation.getAbsolutePath()));
+
+ profileProperties = loadProfile(javaProfile);
}
if (profileProperties == null) {
String entry = environment != null ? "/profiles/" + environment.replace('/', '_') + ".profile" : DEFAULT_PROFILE; //$NON-NLS-1$ //$NON-NLS-2$

Back to the top