Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 121114 Details for
Bug 259525
[discovery][ui] discovery doesn't start on Eclipse 3.4.1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for Release_2_1 branch to eliminate exceptions on start
259525.patch (text/plain), 28.01 KB, created by
Scott Lewis
on 2008-12-23 03:31:56 EST
(
hide
)
Description:
patch for Release_2_1 branch to eliminate exceptions on start
Filename:
MIME Type:
Creator:
Scott Lewis
Created:
2008-12-23 03:31:56 EST
Size:
28.01 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ecf.provider.discovery >Index: src/org/eclipse/ecf/internal/provider/discovery/Activator.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.ecf/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/Activator.java,v >retrieving revision 1.4.2.1 >diff -u -r1.4.2.1 Activator.java >--- src/org/eclipse/ecf/internal/provider/discovery/Activator.java 2 Dec 2008 08:27:16 -0000 1.4.2.1 >+++ src/org/eclipse/ecf/internal/provider/discovery/Activator.java 23 Dec 2008 08:27:41 -0000 >@@ -10,21 +10,16 @@ > ******************************************************************************/ > package org.eclipse.ecf.internal.provider.discovery; > >-import java.util.*; >-import org.eclipse.ecf.core.ContainerConnectException; >-import org.eclipse.ecf.core.identity.IDCreateException; >-import org.eclipse.ecf.core.identity.IDFactory; >-import org.eclipse.ecf.core.util.Trace; >-import org.eclipse.ecf.discovery.service.IDiscoveryService; >-import org.eclipse.ecf.provider.discovery.CompositeDiscoveryContainer; >-import org.osgi.framework.*; >-import org.osgi.util.tracker.ServiceTracker; >+import org.osgi.framework.BundleActivator; >+import org.osgi.framework.BundleContext; > > public class Activator implements BundleActivator { > // The shared instance > private static Activator plugin; > public static final String PLUGIN_ID = "org.eclipse.ecf.provider.discovery"; //$NON-NLS-1$ > >+ private static BundleContext context; >+ > /** > * Returns the shared instance > * >@@ -45,89 +40,20 @@ > * (non-Javadoc) > * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) > */ >- public void start(final BundleContext context) throws Exception { >- Properties props = new Properties(); >- props.put(IDiscoveryService.CONTAINER_ID, IDFactory.getDefault().createStringID("org.eclipse.ecf.provider.discovery.CompositeDiscoveryContainer")); //$NON-NLS-1$ >- props.put(IDiscoveryService.CONTAINER_NAME, CompositeDiscoveryContainer.NAME); >- props.put(Constants.SERVICE_RANKING, new Integer(1000)); >- context.registerService(IDiscoveryService.class.getName(), new ServiceFactory() { >- >- /* (non-Javadoc) >- * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration) >- */ >- public Object getService(Bundle bundle, ServiceRegistration registration) { >- >- // get all previously registered IDS from OSGi (but not this one) >- Filter filter = null; >- try { >- String filter2 = "(&(" + Constants.OBJECTCLASS + "=" + IDiscoveryService.class.getName() + ")(!(" + IDiscoveryService.CONTAINER_NAME + "=" + CompositeDiscoveryContainer.NAME + ")))"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ >- filter = context.createFilter(filter2); >- } catch (InvalidSyntaxException e2) { >- Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e2); //$NON-NLS-1$ //$NON-NLS-2$ >- return null; >- } >- ServiceTracker tracker = new ServiceTracker(context, filter, null); >- tracker.open(); >- Object[] services = tracker.getServices(); >- tracker.close(); >- List discoveries = services == null ? new ArrayList() : new ArrayList(Arrays.asList(services)); >- >- // register the composite discovery service) >- final CompositeDiscoveryContainer cdc; >- try { >- cdc = new CompositeDiscoveryContainer(discoveries); >- } catch (IDCreateException e1) { >- Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e1); //$NON-NLS-1$ //$NON-NLS-2$ >- return null; >- } >- try { >- cdc.connect(null, null); >- } catch (ContainerConnectException e) { >- Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >- return null; >- } >- >- // add a service listener to add/remove IDS dynamically >- try { >- context.addServiceListener(new ServiceListener() { >- /* (non-Javadoc) >- * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent) >- */ >- public void serviceChanged(ServiceEvent arg0) { >- IDiscoveryService anIDS = (IDiscoveryService) context.getService(arg0.getServiceReference()); >- switch (arg0.getType()) { >- case ServiceEvent.REGISTERED : >- cdc.addContainer(anIDS); >- break; >- case ServiceEvent.UNREGISTERING : >- cdc.removeContainer(anIDS); >- break; >- default : >- break; >- } >- } >- >- }, "(" + Constants.OBJECTCLASS + "=" + IDiscoveryService.class.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- } catch (InvalidSyntaxException e) { >- // nop >- } >- return cdc; >- } >- >- /* (non-Javadoc) >- * @see org.osgi.framework.ServiceFactory#ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object) >- */ >- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) { >- // nop >- } >- }, props); >+ public void start(final BundleContext ctxt) throws Exception { >+ context = ctxt; > } > > /* > * (non-Javadoc) > * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) > */ >- public void stop(BundleContext context) throws Exception { >+ public void stop(BundleContext ctxt) throws Exception { > plugin = null; >+ context = null; >+ } >+ >+ public static BundleContext getContext() { >+ return context; > } > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.ecf/providers/bundles/org.eclipse.ecf.provider.discovery/plugin.xml,v >retrieving revision 1.2 >diff -u -r1.2 plugin.xml >--- plugin.xml 12 Jun 2008 09:29:51 -0000 1.2 >+++ plugin.xml 23 Dec 2008 08:27:41 -0000 >@@ -24,5 +24,12 @@ > name="ecf.namespace.composite"> > </namespace> > </extension> >+ <extension >+ point="org.eclipse.ecf.start"> >+ <run >+ asynchronous="false" >+ class="org.eclipse.ecf.internal.provider.discovery.ECFStart"> >+ </run> >+ </extension> > > </plugin> >Index: src/org/eclipse/ecf/internal/provider/discovery/ECFStart.java >=================================================================== >RCS file: src/org/eclipse/ecf/internal/provider/discovery/ECFStart.java >diff -N src/org/eclipse/ecf/internal/provider/discovery/ECFStart.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/internal/provider/discovery/ECFStart.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,110 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Versant Corp. >+ * 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: >+ * Markus Kuppe (mkuppe <at> versant <dot> com) - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.ecf.internal.provider.discovery; >+ >+import java.util.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.ecf.core.ContainerConnectException; >+import org.eclipse.ecf.core.identity.IDCreateException; >+import org.eclipse.ecf.core.identity.IDFactory; >+import org.eclipse.ecf.core.start.IECFStart; >+import org.eclipse.ecf.core.util.Trace; >+import org.eclipse.ecf.discovery.service.IDiscoveryService; >+import org.eclipse.ecf.provider.discovery.CompositeDiscoveryContainer; >+import org.osgi.framework.*; >+import org.osgi.util.tracker.ServiceTracker; >+ >+public class ECFStart implements IECFStart { >+ >+ public IStatus run(IProgressMonitor monitor) { >+ try { >+ Properties props = new Properties(); >+ props.put(IDiscoveryService.CONTAINER_ID, IDFactory.getDefault().createStringID("org.eclipse.ecf.provider.discovery.CompositeDiscoveryContainer")); //$NON-NLS-1$ >+ props.put(IDiscoveryService.CONTAINER_NAME, CompositeDiscoveryContainer.NAME); >+ props.put(Constants.SERVICE_RANKING, new Integer(1000)); >+ Activator.getContext().registerService(IDiscoveryService.class.getName(), new ServiceFactory() { >+ >+ /* (non-Javadoc) >+ * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration) >+ */ >+ public Object getService(Bundle bundle, ServiceRegistration registration) { >+ >+ // get all previously registered IDS from OSGi (but not this one) >+ Filter filter = null; >+ try { >+ String filter2 = "(&(" + Constants.OBJECTCLASS + "=" + IDiscoveryService.class.getName() + ")(!(" + IDiscoveryService.CONTAINER_NAME + "=" + CompositeDiscoveryContainer.NAME + ")))"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ >+ filter = Activator.getContext().createFilter(filter2); >+ } catch (InvalidSyntaxException e2) { >+ Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e2); //$NON-NLS-1$ //$NON-NLS-2$ >+ return null; >+ } >+ ServiceTracker tracker = new ServiceTracker(Activator.getContext(), filter, null); >+ tracker.open(); >+ Object[] services = tracker.getServices(); >+ tracker.close(); >+ List discoveries = services == null ? new ArrayList() : new ArrayList(Arrays.asList(services)); >+ >+ // register the composite discovery service) >+ final CompositeDiscoveryContainer cdc; >+ try { >+ cdc = new CompositeDiscoveryContainer(discoveries); >+ } catch (IDCreateException e1) { >+ Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e1); //$NON-NLS-1$ //$NON-NLS-2$ >+ return null; >+ } >+ try { >+ cdc.connect(null, null); >+ } catch (ContainerConnectException e) { >+ Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >+ return null; >+ } >+ >+ // add a service listener to add/remove IDS dynamically >+ try { >+ Activator.getContext().addServiceListener(new ServiceListener() { >+ /* (non-Javadoc) >+ * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent) >+ */ >+ public void serviceChanged(ServiceEvent arg0) { >+ IDiscoveryService anIDS = (IDiscoveryService) Activator.getContext().getService(arg0.getServiceReference()); >+ switch (arg0.getType()) { >+ case ServiceEvent.REGISTERED : >+ cdc.addContainer(anIDS); >+ break; >+ case ServiceEvent.UNREGISTERING : >+ cdc.removeContainer(anIDS); >+ break; >+ default : >+ break; >+ } >+ } >+ >+ }, "(" + Constants.OBJECTCLASS + "=" + IDiscoveryService.class.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ } catch (InvalidSyntaxException e) { >+ // nop >+ } >+ return cdc; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.osgi.framework.ServiceFactory#ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object) >+ */ >+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) { >+ // nop >+ } >+ }, props); >+ >+ return Status.OK_STATUS; >+ } catch (Exception e) { >+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Exception starting composite container", e); //$NON-NLS-1$ >+ } >+ } >+} >#P org.eclipse.ecf.provider.jmdns >Index: src/org/eclipse/ecf/internal/provider/jmdns/JMDNSPlugin.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.ecf/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/internal/provider/jmdns/JMDNSPlugin.java,v >retrieving revision 1.12.4.1 >diff -u -r1.12.4.1 JMDNSPlugin.java >--- src/org/eclipse/ecf/internal/provider/jmdns/JMDNSPlugin.java 2 Dec 2008 08:46:22 -0000 1.12.4.1 >+++ src/org/eclipse/ecf/internal/provider/jmdns/JMDNSPlugin.java 23 Dec 2008 08:27:42 -0000 >@@ -10,15 +10,9 @@ > *****************************************************************************/ > package org.eclipse.ecf.internal.provider.jmdns; > >-import java.net.InetAddress; >-import java.util.Properties; > import org.eclipse.core.runtime.IAdapterManager; >-import org.eclipse.ecf.core.ContainerConnectException; >-import org.eclipse.ecf.core.identity.IDCreateException; >-import org.eclipse.ecf.core.identity.IDFactory; >-import org.eclipse.ecf.core.util.*; >-import org.eclipse.ecf.discovery.service.IDiscoveryService; >-import org.eclipse.ecf.provider.jmdns.container.JMDNSDiscoveryContainer; >+import org.eclipse.ecf.core.util.PlatformHelper; >+import org.eclipse.ecf.core.util.SystemLogService; > import org.osgi.framework.*; > import org.osgi.service.log.LogService; > import org.osgi.util.tracker.ServiceTracker; >@@ -27,8 +21,6 @@ > * The main plugin class to be used in the desktop. > */ > public class JMDNSPlugin implements BundleActivator { >- private static final String NAME = "ecf.discovery.jmdns"; //$NON-NLS-1$ >- > // The shared instance. > private static JMDNSPlugin plugin; > >@@ -36,8 +28,6 @@ > > public static final String PLUGIN_ID = "org.eclipse.ecf.provider.jmdns"; //$NON-NLS-1$ > >- protected static InetAddress LOCALHOST = null; >- > /** > * The constructor. > */ >@@ -73,42 +63,6 @@ > */ > public void start(BundleContext ctxt) throws Exception { > this.context = ctxt; >- LOCALHOST = InetAddress.getLocalHost(); >- >- Properties props = new Properties(); >- props.put(IDiscoveryService.CONTAINER_ID, IDFactory.getDefault().createStringID("org.eclipse.ecf.provider.jmdns.container.JMDNSDiscoveryContainer")); //$NON-NLS-1$ >- props.put(IDiscoveryService.CONTAINER_NAME, NAME); >- props.put(Constants.SERVICE_RANKING, new Integer(750)); >- context.registerService(IDiscoveryService.class.getName(), new ServiceFactory() { >- private volatile JMDNSDiscoveryContainer jdc; >- >- /* (non-Javadoc) >- * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration) >- */ >- public Object getService(Bundle bundle, ServiceRegistration registration) { >- if (jdc == null) { >- try { >- jdc = new JMDNSDiscoveryContainer(LOCALHOST); >- jdc.connect(null, null); >- } catch (IDCreateException e) { >- Trace.catching(JMDNSPlugin.PLUGIN_ID, JMDNSPlugin.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >- } catch (ContainerConnectException e) { >- Trace.catching(JMDNSPlugin.PLUGIN_ID, JMDNSPlugin.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >- jdc = null; >- } >- } >- return jdc; >- } >- >- /* (non-Javadoc) >- * @see org.osgi.framework.ServiceFactory#ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object) >- */ >- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) { >- //TODO-mkuppe we later might want to dispose jSLP when the last!!! consumer ungets the service >- //Though don't forget about the (ECF) Container which might still be in use >- } >- }, props); >- > } > > protected Bundle getBundle() { >@@ -145,6 +99,10 @@ > return plugin; > } > >+ public BundleContext getContext() { >+ return context; >+ } >+ > /** > * @param string > * @param t >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.ecf/providers/bundles/org.eclipse.ecf.provider.jmdns/plugin.xml,v >retrieving revision 1.7.4.1 >diff -u -r1.7.4.1 plugin.xml >--- plugin.xml 2 Dec 2008 08:44:06 -0000 1.7.4.1 >+++ plugin.xml 23 Dec 2008 08:27:42 -0000 >@@ -17,5 +17,11 @@ > description="JMDNS Namespace" > name="ecf.namespace.jmdns"/> > </extension> >+ <extension >+ point="org.eclipse.ecf.start"> >+ <run >+ class="org.eclipse.ecf.internal.provider.jmdns.ECFStart"> >+ </run> >+ </extension> > > </plugin> >Index: src/org/eclipse/ecf/internal/provider/jmdns/ECFStart.java >=================================================================== >RCS file: src/org/eclipse/ecf/internal/provider/jmdns/ECFStart.java >diff -N src/org/eclipse/ecf/internal/provider/jmdns/ECFStart.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/internal/provider/jmdns/ECFStart.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,78 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Versant Corp. >+ * 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: >+ * Markus Kuppe (mkuppe <at> versant <dot> com) - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.ecf.internal.provider.jmdns; >+ >+import java.net.InetAddress; >+import java.util.Properties; >+import org.eclipse.core.runtime.*; >+import org.eclipse.ecf.core.ContainerConnectException; >+import org.eclipse.ecf.core.identity.IDCreateException; >+import org.eclipse.ecf.core.identity.IDFactory; >+import org.eclipse.ecf.core.start.IECFStart; >+import org.eclipse.ecf.core.util.Trace; >+import org.eclipse.ecf.discovery.service.IDiscoveryService; >+import org.eclipse.ecf.provider.jmdns.container.JMDNSDiscoveryContainer; >+import org.osgi.framework.*; >+ >+public class ECFStart implements IECFStart { >+ >+ protected static InetAddress LOCALHOST = null; >+ private static final String NAME = "ecf.discovery.jmdns"; //$NON-NLS-1$ >+ >+ public ECFStart() { >+ // >+ } >+ >+ public IStatus run(IProgressMonitor arg0) { >+ try { >+ LOCALHOST = InetAddress.getLocalHost(); >+ >+ Properties props = new Properties(); >+ props.put(IDiscoveryService.CONTAINER_ID, IDFactory.getDefault().createStringID("org.eclipse.ecf.provider.jmdns.container.JMDNSDiscoveryContainer")); //$NON-NLS-1$ >+ props.put(IDiscoveryService.CONTAINER_NAME, NAME); >+ props.put(Constants.SERVICE_RANKING, new Integer(750)); >+ JMDNSPlugin.getDefault().getContext().registerService(IDiscoveryService.class.getName(), new ServiceFactory() { >+ private volatile JMDNSDiscoveryContainer jdc; >+ >+ /* (non-Javadoc) >+ * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration) >+ */ >+ public Object getService(Bundle bundle, ServiceRegistration registration) { >+ if (jdc == null) { >+ try { >+ jdc = new JMDNSDiscoveryContainer(LOCALHOST); >+ jdc.connect(null, null); >+ } catch (IDCreateException e) { >+ Trace.catching(JMDNSPlugin.PLUGIN_ID, JMDNSPlugin.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >+ } catch (ContainerConnectException e) { >+ Trace.catching(JMDNSPlugin.PLUGIN_ID, JMDNSPlugin.PLUGIN_ID + "/debug/methods/catching", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >+ jdc = null; >+ } >+ } >+ return jdc; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.osgi.framework.ServiceFactory#ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object) >+ */ >+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) { >+ //TODO-mkuppe we later might want to dispose jSLP when the last!!! consumer ungets the service >+ //Though don't forget about the (ECF) Container which might still be in use >+ } >+ }, props); >+ >+ return Status.OK_STATUS; >+ } catch (Exception e) { >+ return new Status(IStatus.ERROR, JMDNSPlugin.PLUGIN_ID, IStatus.ERROR, "Exception starting jmdns container", e); //$NON-NLS-1$ >+ } >+ } >+ >+} >#P org.eclipse.ecf.provider.jslp >Index: src/org/eclipse/ecf/internal/provider/jslp/Activator.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.ecf/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java,v >retrieving revision 1.12.2.1 >diff -u -r1.12.2.1 Activator.java >--- src/org/eclipse/ecf/internal/provider/jslp/Activator.java 2 Dec 2008 08:31:47 -0000 1.12.2.1 >+++ src/org/eclipse/ecf/internal/provider/jslp/Activator.java 23 Dec 2008 08:27:43 -0000 >@@ -12,13 +12,6 @@ > > import ch.ethz.iks.slp.Advertiser; > import ch.ethz.iks.slp.Locator; >-import java.util.Properties; >-import org.eclipse.ecf.core.ContainerConnectException; >-import org.eclipse.ecf.core.identity.IDCreateException; >-import org.eclipse.ecf.core.identity.IDFactory; >-import org.eclipse.ecf.core.util.Trace; >-import org.eclipse.ecf.discovery.service.IDiscoveryService; >-import org.eclipse.ecf.provider.jslp.container.JSLPDiscoveryContainer; > import org.osgi.framework.*; > import org.osgi.util.tracker.ServiceTracker; > >@@ -86,41 +79,10 @@ > // initially get the advertiser and add a life cycle listener > advertiserSt = new ServiceTracker(context, Advertiser.class.getName(), null); > >- // register ourself as an OSGi service >- Properties props = new Properties(); >- props.put(IDiscoveryService.CONTAINER_ID, IDFactory.getDefault().createStringID("org.eclipse.ecf.provider.jslp.container.JSLPDiscoveryContainer")); //$NON-NLS-1$ >- props.put(IDiscoveryService.CONTAINER_NAME, JSLPDiscoveryContainer.NAME); >- props.put(Constants.SERVICE_RANKING, new Integer(500)); >- >- context.registerService(IDiscoveryService.class.getName(), new ServiceFactory() { >- private volatile JSLPDiscoveryContainer jdc; >- >- /* (non-Javadoc) >- * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration) >- */ >- public Object getService(Bundle bundle, ServiceRegistration registration) { >- if (jdc == null) { >- try { >- jdc = new JSLPDiscoveryContainer(); >- jdc.connect(null, null); >- } catch (IDCreateException e) { >- Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/tracing", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >- } catch (ContainerConnectException e) { >- Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/tracing", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >- jdc = null; >- } >- } >- return jdc; >- } >- >- /* (non-Javadoc) >- * @see org.osgi.framework.ServiceFactory#ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object) >- */ >- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) { >- //TODO-mkuppe we later might want to dispose jSLP when the last!!! consumer ungets the service >- //Though don't forget about the (ECF) Container which might still be in use >- } >- }, props); >+ } >+ >+ public BundleContext getContext() { >+ return bundleContext; > } > > /* >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.ecf/providers/bundles/org.eclipse.ecf.provider.jslp/plugin.xml,v >retrieving revision 1.1 >diff -u -r1.1 plugin.xml >--- plugin.xml 24 Jan 2008 09:30:59 -0000 1.1 >+++ plugin.xml 23 Dec 2008 08:27:43 -0000 >@@ -16,5 +16,11 @@ > description="JSLP Namespace" > name="ecf.namespace.slp"/> > </extension> >+ <extension >+ point="org.eclipse.ecf.start"> >+ <run >+ class="org.eclipse.ecf.internal.provider.jslp.ECFStart"> >+ </run> >+ </extension> > > </plugin> >Index: src/org/eclipse/ecf/internal/provider/jslp/ECFStart.java >=================================================================== >RCS file: src/org/eclipse/ecf/internal/provider/jslp/ECFStart.java >diff -N src/org/eclipse/ecf/internal/provider/jslp/ECFStart.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/internal/provider/jslp/ECFStart.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,73 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Versant Corp. >+ * 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: >+ * Markus Kuppe (mkuppe <at> versant <dot> com) - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.ecf.internal.provider.jslp; >+ >+import java.util.Properties; >+import org.eclipse.core.runtime.*; >+import org.eclipse.ecf.core.ContainerConnectException; >+import org.eclipse.ecf.core.identity.IDCreateException; >+import org.eclipse.ecf.core.identity.IDFactory; >+import org.eclipse.ecf.core.start.IECFStart; >+import org.eclipse.ecf.core.util.Trace; >+import org.eclipse.ecf.discovery.service.IDiscoveryService; >+import org.eclipse.ecf.provider.jslp.container.JSLPDiscoveryContainer; >+import org.osgi.framework.*; >+ >+public class ECFStart implements IECFStart { >+ >+ public ECFStart() { >+ // >+ } >+ >+ public IStatus run(IProgressMonitor arg0) { >+ try { >+ // register ourself as an OSGi service >+ Properties props = new Properties(); >+ props.put(IDiscoveryService.CONTAINER_ID, IDFactory.getDefault().createStringID("org.eclipse.ecf.provider.jslp.container.JSLPDiscoveryContainer")); //$NON-NLS-1$ >+ props.put(IDiscoveryService.CONTAINER_NAME, JSLPDiscoveryContainer.NAME); >+ props.put(Constants.SERVICE_RANKING, new Integer(500)); >+ >+ Activator.getDefault().getContext().registerService(IDiscoveryService.class.getName(), new ServiceFactory() { >+ private volatile JSLPDiscoveryContainer jdc; >+ >+ /* (non-Javadoc) >+ * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration) >+ */ >+ public Object getService(Bundle bundle, ServiceRegistration registration) { >+ if (jdc == null) { >+ try { >+ jdc = new JSLPDiscoveryContainer(); >+ jdc.connect(null, null); >+ } catch (IDCreateException e) { >+ Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/tracing", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >+ } catch (ContainerConnectException e) { >+ Trace.catching(Activator.PLUGIN_ID, Activator.PLUGIN_ID + "/debug/methods/tracing", this.getClass(), "getService(Bundle, ServiceRegistration)", e); //$NON-NLS-1$ //$NON-NLS-2$ >+ jdc = null; >+ } >+ } >+ return jdc; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.osgi.framework.ServiceFactory#ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object) >+ */ >+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) { >+ //TODO-mkuppe we later might want to dispose jSLP when the last!!! consumer ungets the service >+ //Though don't forget about the (ECF) Container which might still be in use >+ } >+ }, props); >+ >+ return Status.OK_STATUS; >+ } catch (Exception e) { >+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Exception starting jslp container", e); //$NON-NLS-1$ >+ } >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 259525
:
121090
|
121107
| 121114 |
121136
|
121137