Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2006-11-24 01:02:23 +0000
committerDJ Houghton2006-11-24 01:02:23 +0000
commit9e8cff5b77d3b4e8a78af8ea46e30db85572ac14 (patch)
tree19b6b5da8bf7748a49f5d1398ff413ee0048d9ff /bundles/org.eclipse.osgi/supplement
parentbd62752dbe77c7045007f092ed58d195f6720741 (diff)
downloadrt.equinox.framework-9e8cff5b77d3b4e8a78af8ea46e30db85572ac14.tar.gz
rt.equinox.framework-9e8cff5b77d3b4e8a78af8ea46e30db85572ac14.tar.xz
rt.equinox.framework-9e8cff5b77d3b4e8a78af8ea46e30db85572ac14.zip
Refactor supplement bundle to be nested within OSGI.zz20061127v20061127
Diffstat (limited to 'bundles/org.eclipse.osgi/supplement')
-rw-r--r--bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.osgi/supplement/build.properties1
-rw-r--r--bundles/org.eclipse.osgi/supplement/osgi/osgi.jarbin0 -> 42308 bytes
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/BasicLocation.java3
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMsg.java36
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/LocationHelper.java56
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java3
7 files changed, 65 insertions, 42 deletions
diff --git a/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF
index feb15801c..bf6f0563f 100644
--- a/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF
@@ -10,13 +10,17 @@ Export-Package: org.eclipse.core.runtime.internal.adaptor;x-internal:=true,
org.eclipse.osgi.framework.internal.core;x-internal:=true,
org.eclipse.osgi.framework.internal.reliablefile;x-internal:=true,
org.eclipse.osgi.framework.log,
+ org.eclipse.osgi.framework.util,
org.eclipse.osgi.service.datalocation,
org.eclipse.osgi.service.debug,
org.eclipse.osgi.service.localization,
org.eclipse.osgi.service.urlconversion,
org.eclipse.osgi.storagemanager,
- org.eclipse.osgi.util
+ org.eclipse.osgi.util,
+ org.osgi.framework,
+ org.osgi.util.tracker
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
CDC-1.0/Foundation-1.0,
J2SE-1.3
-Import-Package: org.osgi.framework
+Import-Package: org.osgi.framework,
+ org.osgi.util.tracker
diff --git a/bundles/org.eclipse.osgi/supplement/build.properties b/bundles/org.eclipse.osgi/supplement/build.properties
index fd3fff9c2..d1f3b19ac 100644
--- a/bundles/org.eclipse.osgi/supplement/build.properties
+++ b/bundles/org.eclipse.osgi/supplement/build.properties
@@ -17,3 +17,4 @@ bin.includes = META-INF/,\
about.html
src.includes = about.html
jre.compilation.profile = J2SE-1.4
+jars.extra.classpath = osgi/osgi.jar
diff --git a/bundles/org.eclipse.osgi/supplement/osgi/osgi.jar b/bundles/org.eclipse.osgi/supplement/osgi/osgi.jar
new file mode 100644
index 000000000..f25df407c
--- /dev/null
+++ b/bundles/org.eclipse.osgi/supplement/osgi/osgi.jar
Binary files differ
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/BasicLocation.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/BasicLocation.java
index 2eb36a2dc..7fc18ccc7 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/BasicLocation.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/BasicLocation.java
@@ -13,7 +13,6 @@ package org.eclipse.core.runtime.internal.adaptor;
import java.io.File;
import java.io.IOException;
import java.net.URL;
-import org.eclipse.core.runtime.adaptor.*;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.service.datalocation.Location;
@@ -136,7 +135,7 @@ public class BasicLocation implements Location {
}
}
lockFile = file;
- location = LocationManager.buildURL(value.toExternalForm(), true);
+ location = LocationHelper.buildURL(value.toExternalForm(), true);
if (property != null)
FrameworkProperties.setProperty(property, location.toExternalForm());
return lock;
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMsg.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMsg.java
index e65c871c4..077b3aaf8 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMsg.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMsg.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.core.runtime.internal.adaptor;
-import java.util.Date;
-import org.eclipse.osgi.service.resolver.*;
import org.eclipse.osgi.util.NLS;
public class EclipseAdaptorMsg extends NLS {
@@ -101,38 +99,4 @@ public class EclipseAdaptorMsg extends NLS {
NLS.initializeMessages(BUNDLE_NAME, EclipseAdaptorMsg.class);
}
- public static String getResolutionFailureMessage(VersionConstraint unsatisfied) {
- if (unsatisfied.isResolved())
- throw new IllegalArgumentException();
- if (unsatisfied instanceof ImportPackageSpecification)
- return NLS.bind(ECLIPSE_MISSING_IMPORTED_PACKAGE, toString(unsatisfied));
- else if (unsatisfied instanceof BundleSpecification)
- if (((BundleSpecification) unsatisfied).isOptional())
- return NLS.bind(ECLIPSE_MISSING_OPTIONAL_REQUIRED_BUNDLE, toString(unsatisfied));
- else
- return NLS.bind(ECLIPSE_MISSING_REQUIRED_BUNDLE, toString(unsatisfied));
- else
- return NLS.bind(ECLIPSE_MISSING_HOST, toString(unsatisfied));
- }
-
- /**
- * Print a debug message to the console.
- * Pre-pend the message with the current date and the name of the current thread.
- */
- public static void debug(String message) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(new Date(System.currentTimeMillis()));
- buffer.append(" - ["); //$NON-NLS-1$
- buffer.append(Thread.currentThread().getName());
- buffer.append("] "); //$NON-NLS-1$
- buffer.append(message);
- System.out.println(buffer.toString());
- }
-
- private static String toString(VersionConstraint constraint) {
- org.eclipse.osgi.service.resolver.VersionRange versionRange = constraint.getVersionRange();
- if (versionRange == null)
- return constraint.getName();
- return constraint.getName() + '_' + versionRange;
- }
}
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/LocationHelper.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/LocationHelper.java
new file mode 100644
index 000000000..3018e6039
--- /dev/null
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/LocationHelper.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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
+ *******************************************************************************/
+package org.eclipse.core.runtime.internal.adaptor;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * @since 3.3
+ */
+public class LocationHelper {
+ /**
+ * Builds a URL with the given specification
+ * @param spec the URL specification
+ * @param trailingSlash flag to indicate a trailing slash on the spec
+ * @return a URL
+ */
+ public static URL buildURL(String spec, boolean trailingSlash) {
+ if (spec == null)
+ return null;
+ boolean isFile = spec.startsWith("file:"); //$NON-NLS-1$
+ try {
+ if (isFile)
+ return adjustTrailingSlash(new File(spec.substring(5)).toURL(), trailingSlash);
+ return new URL(spec);
+ } catch (MalformedURLException e) {
+ // if we failed and it is a file spec, there is nothing more we can do
+ // otherwise, try to make the spec into a file URL.
+ if (isFile)
+ return null;
+ try {
+ return adjustTrailingSlash(new File(spec).toURL(), trailingSlash);
+ } catch (MalformedURLException e1) {
+ return null;
+ }
+ }
+ }
+
+ private static URL adjustTrailingSlash(URL url, boolean trailingSlash) throws MalformedURLException {
+ String file = url.getFile();
+ if (trailingSlash == (file.endsWith("/"))) //$NON-NLS-1$
+ return url;
+ file = trailingSlash ? file + "/" : file.substring(0, file.length() - 1); //$NON-NLS-1$
+ return new URL(url.getProtocol(), url.getHost(), file);
+ }
+
+}
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
index ad9ed1c6d..106d783d1 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
@@ -16,7 +16,6 @@ import java.net.*;
import java.security.*;
import java.util.Properties;
import java.util.zip.ZipFile;
-import org.eclipse.osgi.framework.internal.core.AbstractBundle;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
@@ -396,7 +395,7 @@ public class SecureAction {
* @param options the start options
* @throws BundleException
*/
- public void start(final AbstractBundle bundle, final int options) throws BundleException {
+ public void start(final Bundle bundle, final int options) throws BundleException {
if (System.getSecurityManager() == null) {
bundle.start(options);
return;

Back to the top