summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-11-16 09:30:58 (EST)
committer pelder2006-11-16 09:30:58 (EST)
commitde549146ff9d4fc36410f6f8baf31b773e4375a2 (patch)
treea160965eee2aa600b9d0e85c9dc10830b7f0960c
parent4dc438510247e076502822b6ad3b1617c4fd2f37 (diff)
downloadorg.eclipse.jet-de549146ff9d4fc36410f6f8baf31b773e4375a2.zip
org.eclipse.jet-de549146ff9d4fc36410f6f8baf31b773e4375a2.tar.gz
org.eclipse.jet-de549146ff9d4fc36410f6f8baf31b773e4375a2.tar.bz2
[164157] Distinguish between bundle/plug-in projects and those that merely have MANIFEST.MF files.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/BundleManifest.java5
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java4
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManifest.java3
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/NotABundleException.java49
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java4
7 files changed, 74 insertions, 3 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java
index 40787bd..e5461aa 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java
@@ -43,6 +43,7 @@ import org.eclipse.jet.internal.InternalJET2Platform;
import org.eclipse.jet.internal.JETActivatorWrapper;
import org.eclipse.jet.internal.runtime.BundleManifest;
import org.eclipse.jet.internal.runtime.JETBundleManager;
+import org.eclipse.jet.internal.runtime.NotABundleException;
/**
* Monitor plugin projects in the workspace for changes in extension point definitions
@@ -232,6 +233,11 @@ public class PluginProjectMonitor implements IResourceChangeListener
{
JETActivatorWrapper.INSTANCE.log(e);
}
+ catch (NotABundleException e)
+ {
+ // arises when we find MANIFEST.MF that is not a OSGi bundle. In this case, we'll
+ // just assume the plug-in does not contain JET tags
+ }
}
public void shutdown()
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/BundleManifest.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/BundleManifest.java
index 61e22b3..da00e4d 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/BundleManifest.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/BundleManifest.java
@@ -27,8 +27,11 @@ public class BundleManifest
{
protected final Dictionary manifest;
- public BundleManifest(Dictionary manifest)
+ public BundleManifest(Dictionary manifest) throws NotABundleException
{
+ if(manifest.get(Constants.BUNDLE_SYMBOLICNAME) == null) {
+ throw new NotABundleException(manifest);
+ }
this.manifest = manifest;
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java
index b5127f2..889a948 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/InstalledJETBundleProvider.java
@@ -165,6 +165,10 @@ public final class InstalledJETBundleProvider implements IRegistryChangeListener
{
e.printStackTrace();
}
+ catch (NotABundleException e)
+ {
+ e.printStackTrace();
+ }
}
public void removeJETPlugin(String id)
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java
index abc812c..70a21df 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManager.java
@@ -113,7 +113,7 @@ public class JETBundleManager implements IJETBundleManager
}
}
- public static JETBundleManifest loadManifest(URL pluginURL) throws IOException
+ public static JETBundleManifest loadManifest(URL pluginURL) throws IOException, NotABundleException
{
URL manifestURL = new URL(pluginURL, JarFile.MANIFEST_NAME);
@@ -157,6 +157,10 @@ public class JETBundleManager implements IJETBundleManager
{
// can't read. Assume it's not a JET bundle.
}
+ catch (NotABundleException e)
+ {
+ // MANIFEST.MF is not an OSGi bundle, so it's not a JET bundle.
+ }
return descriptor;
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManifest.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManifest.java
index ccef69f..a38bbbb 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManifest.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/JETBundleManifest.java
@@ -27,9 +27,10 @@ public class JETBundleManifest extends BundleManifest
public static final String JET2_TRANSFORM_LOADER_ATTRIBUTE = "JET2-TransformClass"; //$NON-NLS-1$
/**
+ * @throws NotABundleException
*
*/
- public JETBundleManifest(Dictionary manifest)
+ public JETBundleManifest(Dictionary manifest) throws NotABundleException
{
super(manifest);
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/NotABundleException.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/NotABundleException.java
new file mode 100644
index 0000000..51314b2
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/NotABundleException.java
@@ -0,0 +1,49 @@
+/**
+ * <copyright>
+ *
+ * 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 - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.jet.internal.runtime;
+
+import java.util.Dictionary;
+
+/**
+ * Exception thrown when a {@link BundleManifest} is constructed against
+ * a manifest that is not an Eclipse Bundle.
+ */
+public class NotABundleException extends Exception
+{
+
+ private final Dictionary manifest;
+
+ public NotABundleException(Dictionary manifest)
+ {
+ this.manifest = manifest;
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -344501343498059244L;
+
+ /**
+ * A dictionary of Manifest values passed to {@link BundleManifest#BundleManifest(Dictionary)}.
+ * @return Returns the manifest.
+ */
+ public final Dictionary getManifest()
+ {
+ return manifest;
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java
index 87551ce..a06f78c 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/ProjectJETBundleProvider.java
@@ -227,6 +227,10 @@ public class ProjectJETBundleProvider implements IResourceChangeListener, IJETBu
{
e.printStackTrace();
}
+ catch (NotABundleException e)
+ {
+ // not an OSGi bundle, so it cannot be a JET bundle
+ }
}
public IJETBundleDescriptor getDescriptorForProject(String name)