diff options
author | slewis | 2007-03-14 23:10:33 +0000 |
---|---|---|
committer | slewis | 2007-03-14 23:10:33 +0000 |
commit | 0337dd8aae36f4862b279f29a29e7348b5df61d4 (patch) | |
tree | 99f3f33e0962554f8102715f3280202898d0433a /providers/bundles/org.eclipse.ecf.provider.rss | |
parent | 4ea380f7027787dbd696eb979176ee56956a3c46 (diff) | |
download | org.eclipse.ecf-0337dd8aae36f4862b279f29a29e7348b5df61d4.tar.gz org.eclipse.ecf-0337dd8aae36f4862b279f29a29e7348b5df61d4.tar.xz org.eclipse.ecf-0337dd8aae36f4862b279f29a29e7348b5df61d4.zip |
Changes to remove references to Plugin class.
Diffstat (limited to 'providers/bundles/org.eclipse.ecf.provider.rss')
3 files changed, 42 insertions, 15 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.rss/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.rss/META-INF/MANIFEST.MF index 64ee6c0e0..2f7628168 100644 --- a/providers/bundles/org.eclipse.ecf.provider.rss/META-INF/MANIFEST.MF +++ b/providers/bundles/org.eclipse.ecf.provider.rss/META-INF/MANIFEST.MF @@ -8,7 +8,8 @@ Bundle-Localization: plugin Require-Bundle: org.eclipse.ecf, org.eclipse.ecf.provider, org.eclipse.ecf.datashare, - org.eclipse.ecf.sharedobject + org.eclipse.ecf.sharedobject, + org.eclipse.equinox.common Eclipse-AutoStart: true Bundle-Vendor: Eclipse.org Export-Package: org.eclipse.ecf.internal.provider.rss;x-internal:=true, @@ -16,5 +17,6 @@ Export-Package: org.eclipse.ecf.internal.provider.rss;x-internal:=true, org.eclipse.ecf.internal.provider.rss.http;x-internal:=true Bundle-ClassPath: ., lib/rss-sse.jar -Import-Package: org.eclipse.core.runtime, - org.osgi.framework;version="1.3.0" +Import-Package: org.osgi.framework;version="1.3.0", + org.osgi.service.log;version="1.3.0", + org.osgi.util.tracker;version="1.3.2" diff --git a/providers/bundles/org.eclipse.ecf.provider.rss/build.properties b/providers/bundles/org.eclipse.ecf.provider.rss/build.properties index 82a1f0895..d2a86d92e 100644 --- a/providers/bundles/org.eclipse.ecf.provider.rss/build.properties +++ b/providers/bundles/org.eclipse.ecf.provider.rss/build.properties @@ -5,11 +5,9 @@ bin.includes = plugin.xml,\ .,\ lib/,\ about.html,\ - doc/,\ lib/rss-sse.jar src.includes = src/,\ plugin.xml,\ lib/,\ about.html,\ - doc/,\ META-INF/ diff --git a/providers/bundles/org.eclipse.ecf.provider.rss/src/org/eclipse/ecf/internal/provider/rss/RssPlugin.java b/providers/bundles/org.eclipse.ecf.provider.rss/src/org/eclipse/ecf/internal/provider/rss/RssPlugin.java index 77cddfa0a..eb02ecef9 100644 --- a/providers/bundles/org.eclipse.ecf.provider.rss/src/org/eclipse/ecf/internal/provider/rss/RssPlugin.java +++ b/providers/bundles/org.eclipse.ecf.provider.rss/src/org/eclipse/ecf/internal/provider/rss/RssPlugin.java @@ -12,16 +12,20 @@ package org.eclipse.ecf.internal.provider.rss; import java.util.MissingResourceException; import java.util.ResourceBundle; + import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Status; +import org.eclipse.ecf.core.util.LogHelper; +import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; +import org.osgi.service.log.LogService; +import org.osgi.util.tracker.ServiceTracker; /** * The main plugin class to be used in the desktop. * */ -public class RssPlugin extends Plugin { +public class RssPlugin implements BundleActivator { // public static final String NAMESPACE_IDENTIFIER = "ecf.rss"; public static final String PLUGIN_ID = "org.eclipse.ecf.internal.provider.rss"; @@ -29,9 +33,13 @@ public class RssPlugin extends Plugin { // The shared instance. private static RssPlugin plugin; + private BundleContext context = null; + // Resource bundle. private ResourceBundle resourceBundle; + private ServiceTracker logServiceTracker = null; + /** * Logs the given message. * @@ -39,9 +47,8 @@ public class RssPlugin extends Plugin { * a human-readable message, localized to the current locale. */ public static void log(String message) { - getDefault().getLog().log( - new Status(IStatus.OK, getDefault().getBundle() - .getSymbolicName(), IStatus.OK, message, null)); + getDefault().log( + new Status(IStatus.OK, getDefault().PLUGIN_ID, IStatus.OK, message, null)); } /** @@ -54,9 +61,8 @@ public class RssPlugin extends Plugin { * applicable. */ public static void log(String message, Throwable e) { - getDefault().getLog().log( - new Status(IStatus.ERROR, RssPlugin.getDefault().getBundle() - .getSymbolicName(), IStatus.OK, "Caught exception", e)); + getDefault().log( + new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, "Caught exception", e)); } /** @@ -73,13 +79,30 @@ public class RssPlugin extends Plugin { } } + protected LogService getLogService() { + if (logServiceTracker == null) { + logServiceTracker = new ServiceTracker(this.context, + LogService.class.getName(), null); + logServiceTracker.open(); + } + return (LogService) logServiceTracker.getService(); + } + + public void log(IStatus status) { + LogService logService = getLogService(); + if (logService != null) { + logService.log(LogHelper.getLogCode(status), LogHelper + .getLogMessage(status), status.getException()); + } + } + /* * (non-Javadoc) * * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { - super.start(context); + this.context = context; } /* @@ -88,7 +111,11 @@ public class RssPlugin extends Plugin { * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { - super.stop(context); + if (logServiceTracker != null) { + logServiceTracker.close(); + logServiceTracker = null; + } + this.context = null; plugin = null; } |