Author: rozagh
Date: 2012-03-19 13:11:06 -0700 (Mon, 19 Mar 2012)
New Revision: 28580

Added:
   
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
   
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/ServiceUtil.java
Removed:
   
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
Modified:
   
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/AbstractCyActivator.java
   
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/CyServiceRegistrar.java
   
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyActivator.java
   
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/actions/RecentSessionManager.java
Log:
fixes #792 AbstractCyActivator and CyServiceRegistrar are unified. All of the 
shared functionalities implemented in ServiceUtil in 
org.cytoscape.service.util.internal. Change of method parameter from Dictionary 
to Properties resulted modifications in swing-application-impl . 

Modified: 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/AbstractCyActivator.java
===================================================================
--- 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/AbstractCyActivator.java
       2012-03-19 20:05:56 UTC (rev 28579)
+++ 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/AbstractCyActivator.java
       2012-03-19 20:11:06 UTC (rev 28580)
@@ -14,6 +14,7 @@
 import org.slf4j.LoggerFactory;
 import org.cytoscape.service.util.internal.CyServiceListener;
 import org.cytoscape.service.util.internal.RegisterUtil;
+import org.cytoscape.service.util.internal.ServiceUtil;
 
 /**
  * A simple BundleActivator with convenience methods for registering
@@ -79,16 +80,8 @@
         * @throws RuntimeException If the requested service can't be found.
         */
        protected final <S> S getService(BundleContext bc, Class<S> 
serviceClass) {
-               try {
-                       ServiceReference ref = 
bc.getServiceReference(serviceClass.getName());
-                       if ( ref == null ) 
-                               throw new 
NullPointerException("ServiceReference is null for: " + serviceClass.getName());
-                       gottenServices.add(ref);        
-                       return serviceClass.cast( bc.getService(ref) );
-
-               } catch (Exception e) {
-                       throw new RuntimeException("Couldn't find service: " + 
serviceClass.getName(),e);
-               }
+               
+               return ServiceUtil.getService(bc, serviceClass, gottenServices);
        }
 
        /**
@@ -104,16 +97,8 @@
         * @throws RuntimeException If the requested service can't be found.
         */
        protected final <S> S getService(BundleContext bc, Class<S> 
serviceClass, String filter) {
-               try { 
-                       ServiceReference[] refs = 
bc.getServiceReferences(serviceClass.getName(),filter);
-                       if ( refs == null ) 
-                               throw new 
NullPointerException("ServiceReference is null for: " + serviceClass.getName() 
+ " with filter: " + filter);
-
-                       gottenServices.add(refs[0]);    
-                       return serviceClass.cast( bc.getService(refs[0]) );
-               } catch (Exception e) {
-                       throw new RuntimeException("Couldn't find service: " + 
serviceClass.getName() + " with filter: " + filter, e);
-               }
+               
+               return ServiceUtil.getService(bc, serviceClass, filter, 
gottenServices);
        }
 
        /**
@@ -131,13 +116,8 @@
         * @param additionalFilter An additional filter to be applied to the 
OSGi services 
         */
        protected final void registerServiceListener(final BundleContext bc, 
final Object listener, final String registerMethodName, final String 
unregisterMethodName, final Class<?> serviceClass, final Class<?> methodClass, 
final String additionalFilter) {
-               try {
-                       CyServiceListener serviceListener = new 
CyServiceListener(bc, listener, registerMethodName, unregisterMethodName, 
serviceClass, methodClass, additionalFilter);
-                       serviceListener.open();
-                       serviceListeners.add( serviceListener );
-               } catch (Exception e) {
-                       throw new RuntimeException("Could not listen to 
services for object: " + listener + " with methods: " + registerMethodName + ", 
" + unregisterMethodName + ", service type: " + serviceClass + ", and 
additional filter: " + additionalFilter, e); 
-               }
+       
+               ServiceUtil.registerServiceListener(bc, listener, 
registerMethodName, unregisterMethodName, serviceClass, methodClass, 
additionalFilter, serviceListeners);
        }
 
        /**
@@ -215,24 +195,8 @@
         * @param props The service properties to be registered with each 
service. 
         */
        protected final void registerService(final BundleContext bc, final 
Object service, final Class<?> serviceClass, final Properties props) {
-               if ( service == null )
-                       throw new NullPointerException( "service object is 
null" );
-               if ( serviceClass == null )
-                       throw new NullPointerException( "class is null" );
-               if ( props == null )
-                       throw new NullPointerException( "props are null" );
-               if ( bc == null )
-                       throw new IllegalStateException( "BundleContext is 
null" );
-
-               logger.debug("attempting to register service: " + 
service.toString() + " of type " + serviceClass.getName());
-               ServiceRegistration s = bc.registerService( 
serviceClass.getName(), service, props );
-
-               Map<Object, ServiceRegistration> registrations = 
serviceRegistrations.get(serviceClass);
-               if ( registrations == null ) {
-                       registrations = new 
HashMap<Object,ServiceRegistration>();
-                       serviceRegistrations.put(serviceClass, registrations );
-               }
-
-               registrations.put(service,s);
+               
+               ServiceUtil.registerService(bc, service, serviceClass, props, 
serviceRegistrations); 
        }
+       
 }

Modified: 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/CyServiceRegistrar.java
===================================================================
--- 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/CyServiceRegistrar.java
        2012-03-19 20:05:56 UTC (rev 28579)
+++ 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/CyServiceRegistrar.java
        2012-03-19 20:11:06 UTC (rev 28580)
@@ -1,8 +1,10 @@
 
 package org.cytoscape.service.util;
 
-import java.util.Dictionary;
+import java.util.Properties;
 
+import org.osgi.framework.BundleContext;
+
 /** 
  * An interface to hide the OSGi dependencies needed to register 
  * services dynamically at runtime.  You should only use this interface
@@ -12,22 +14,98 @@
  */
 public interface CyServiceRegistrar {
 
+
        /**
+        * A method that attempts to get a service of the specified type. If an 
+        * appropriate service is not found, an exception will be thrown.
+        * @param <S> The generic type of the class defining the type of 
service desired.
+        * @param serviceClass The class defining the type of service desired.
+        * @return A reference to a service of type serviceClass.
+        * @throws RuntimeException If the requested service can't be found.
+        */
+        <S> S getService( Class<S> serviceClass);
+        
+        /**
+                * A method that attempts to get a service of the specified 
type and that
+                * passes the specified filter. If an appropriate service is 
not found, an 
+                * exception will be thrown.
+                * @param <S> The generic type of the class defining the type 
of service desired.
+                * @param serviceClass The class defining the type of service 
desired.
+                * @param filter The string defining the filter the service 
must pass.  See OSGi's 
+                * service filtering syntax for more detail.
+                * @return A reference to a service of type serviceClass that 
passes the specified filter.
+                * @throws RuntimeException If the requested service can't be 
found.
+                */
+       <S> S getService( Class<S> serviceClass, String filter);
+
+       /**
+        * A method that will cause the specified register/unregister methods 
on the listener
+        * object to be called any time that a service of the specified type is 
registered or
+        * unregistered. 
+        * @param listener Your object listening for service registrations.
+        * @param registerMethodName The name of the method to be called when a 
service is registered.
+        * @param unregisterMethodName The name of the method to be called when 
a service is unregistered.
+        * @param serviceClass The class defining the type of service desired.
+        * @param methodClass There are situations where, because of the use of 
generics and type
+        * erasure that the serviceClass is a subclass of the class used by the 
registration method,
+        * in which case, this extra argument allows that class to be 
specified. 
+        * @param additionalFilter An additional filter to be applied to the 
OSGi services 
+        */
+       void registerServiceListener( final Object listener, final String 
registerMethodName, final String unregisterMethodName, final Class<?> 
serviceClass, final Class<?> methodClass, final String additionalFilter);
+
+       /**
+        * A method that will cause the specified register/unregister methods 
on the listener
+        * object to be called any time that a service of the specified type is 
registered or
+        * unregistered. 
+        * @param listener Your object listening for service registrations.
+        * @param registerMethodName The name of the method to be called when a 
service is registered.
+        * @param unregisterMethodName The name of the method to be called when 
a service is unregistered.
+        * @param serviceClass The class defining the type of service desired.
+        */
+       void registerServiceListener( final Object listener, final String 
registerMethodName, final String unregisterMethodName, final Class<?> 
serviceClass);
+       
+       /**
+        * A method that will cause the specified register/unregister methods 
on the listener
+        * object to be called any time that a service of the specified type is 
registered or
+        * unregistered. 
+        * @param listener Your object listening for service registrations.
+        * @param registerMethodName The name of the method to be called when a 
service is registered.
+        * @param unregisterMethodName The name of the method to be called when 
a service is unregistered.
+        * @param serviceClass The class defining the type of service desired.
+        * @param additionalFilter An additional filter to be applied to the 
OSGi services 
+        */
+       void registerServiceListener( final Object listener, final String 
registerMethodName, final String unregisterMethodName, final Class<?> 
serviceClass, final String additionalFilter);
+       
+       /**
+        * A method that will cause the specified register/unregister methods 
on the listener
+        * object to be called any time that a service of the specified type is 
registered or
+        * unregistered. 
+        * @param listener Your object listening for service registrations.
+        * @param registerMethodName The name of the method to be called when a 
service is registered.
+        * @param unregisterMethodName The name of the method to be called when 
a service is unregistered.
+        * @param serviceClass The class defining the type of service desired.
+        * @param methodClass There are situations where, because of the use of 
generics and type
+        * erasure that the serviceClass is a subclass of the class used by the 
registration method,
+        * in which case, this extra argument allows that class to be 
specified. 
+        */
+       void registerServiceListener(final Object listener, final String 
registerMethodName, final String unregisterMethodName, final Class<?> 
serviceClass, final Class<?> methodClass);
+       
+       /**
         * This method registers an object as an OSGi service
         * with the specified service interface and properties.
-        * @param o The object to be registered as a service.
-        * @param c The service interface the object should be registered as. 
+        * @param service The object to be registered as a service.
+        * @param serviceClass The service interface the object should be 
registered as. 
         * @param props The service properties. 
         */
-       void registerService(Object o, Class c, Dictionary props);
+       void registerService(Object service, Class<?> serviceClass, Properties 
props);
 
        /**
         * This method unregisters an object as an OSGi service
         * for the specified service interface. 
-        * @param o The object to be unregistered as a service.
-        * @param c The service interface the object should be unregistered as. 
+        * @param service The object to be unregistered as a service.
+        * @param serviceClass The service interface the object should be 
unregistered as. 
         */
-       void unregisterService(Object o, Class c);
+       void unregisterService(Object service, Class serviceClass);
 
        /**
         * This method registers an object as an OSGi service
@@ -36,16 +114,16 @@
         * will NOT register services for any packages with names that
         * begin with "java", which is an effort to avoid registering
         * meaningless services for core Java APIs.
-        * @param o The object to be registered as a service for all
+        * @param service The object to be registered as a service for all
         * interfaces that the object implements.
         * @param props The service properties. 
         */
-       void registerAllServices(Object o, Dictionary props);
+       void registerAllServices(Object service,  Properties props);
 
        /**
         * This method unregisters an object as all OSGi service
         * interfaces that the object implements.
-        * @param o The object to be unregistered for services it provides.
+        * @param service The object to be unregistered for services it 
provides.
         */
-       void unregisterAllServices(Object o);
+       void unregisterAllServices(Object service);
 }

Modified: 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyActivator.java
===================================================================
--- 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyActivator.java
      2012-03-19 20:05:56 UTC (rev 28579)
+++ 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyActivator.java
      2012-03-19 20:11:06 UTC (rev 28580)
@@ -3,7 +3,6 @@
 package org.cytoscape.service.util.internal;
 
 
-import org.cytoscape.service.util.internal.CyServiceRegistrarImpl;
 import org.cytoscape.service.util.CyServiceRegistrar;
 import org.osgi.framework.BundleContext;
 import org.cytoscape.service.util.AbstractCyActivator;

Deleted: 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
===================================================================
--- 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
   2012-03-19 20:05:56 UTC (rev 28579)
+++ 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
   2012-03-19 20:11:06 UTC (rev 28580)
@@ -1,84 +0,0 @@
-
-package org.cytoscape.service.util.internal;
-
-import org.cytoscape.service.util.CyServiceRegistrar;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Dictionary;
-import org.osgi.framework.BundleContext; 
-import org.osgi.framework.ServiceRegistration; 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CyServiceRegistrarImpl implements CyServiceRegistrar {
-       
-       private static final Logger logger = 
LoggerFactory.getLogger(CyServiceRegistrarImpl.class);
-       
-       private final BundleContext bc;
-       private Map<Class,Map<Object,ServiceRegistration>> refs;
-       
-       public CyServiceRegistrarImpl(BundleContext bc) {
-               this.bc = bc;
-               refs = new HashMap<Class,Map<Object,ServiceRegistration>>();
-       }
-
-       public void registerAllServices(Object o, Dictionary props) {
-               for ( Class c : RegisterUtil.getAllInterfaces(o.getClass()) ) {
-                       if ( !c.getName().startsWith("java") ) 
-                               registerService(o,c,props);
-               }
-       }
-
-       public void registerService(Object o, Class c, Dictionary props) {
-               if ( o == null )
-                       throw new NullPointerException( "service object is 
null" );
-               if ( c == null )
-                       throw new NullPointerException( "class is null" );
-               if ( props == null )
-                       throw new NullPointerException( "props are null" );
-               if ( bc == null )
-                       throw new IllegalStateException( "BundleContext is 
null" );
-
-               //logger.debug("attempting to register service: " + 
o.toString() + " of type " + c.getName());
-               ServiceRegistration s = bc.registerService( c.getName(), o, 
props );
-
-               Map<Object, ServiceRegistration> registrations = refs.get(c);
-               if ( registrations == null ) {
-                       registrations = new 
HashMap<Object,ServiceRegistration>();
-                       refs.put(c, registrations );
-               }
-               registrations.put(o,s);
-       }
-
-
-       public void unregisterAllServices(Object o) {
-               for ( Class c : RegisterUtil.getAllInterfaces(o.getClass()) ) {
-                       if ( !c.getName().startsWith("java") ) { 
-                               unregisterService(o,c);
-                       }
-               }
-       }
-
-
-       public void unregisterService(Object o, Class c) {
-               if ( o == null )
-                       throw new NullPointerException( "service object is 
null" );
-               if ( c == null )
-                       throw new NullPointerException( "class is null" );
-
-               //logger.debug("attempting to UNregister service: " + 
o.toString() + " of type " + c.getName());
-
-               Map<Object, ServiceRegistration> registrations = refs.get(c);
-               if ( registrations == null )
-                       return;
-               
-               ServiceRegistration s = registrations.get(o);
-
-               if ( s == null )
-                       return;
-
-               s.unregister();
-
-               refs.get(c).remove(o);
-       }
-}

Copied: 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
 (from rev 28548, 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java)
===================================================================
--- 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
                           (rev 0)
+++ 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/CyServiceRegistrarImpl.java
   2012-03-19 20:11:06 UTC (rev 28580)
@@ -0,0 +1,126 @@
+
+package org.cytoscape.service.util.internal;
+
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.osgi.framework.BundleContext; 
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration; 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.cytoscape.service.util.AbstractCyActivator;
+import org.cytoscape.service.util.CyServiceRegistrar;
+
+public class CyServiceRegistrarImpl  implements CyServiceRegistrar{
+       
+       //private static final Logger logger = 
LoggerFactory.getLogger(CyServiceRegistrarImpl.class);
+       
+       private final BundleContext bc;
+       private Map<Class,Map<Object,ServiceRegistration>> serviceRegistrations;
+       
+       public CyServiceRegistrarImpl(BundleContext bc) {
+               this.bc = bc;
+               serviceRegistrations = new 
HashMap<Class,Map<Object,ServiceRegistration>>();
+       }
+
+       public void registerAllServices(Object o, Properties props) {
+               for ( Class c : RegisterUtil.getAllInterfaces(o.getClass()) ) {
+                       if ( !c.getName().startsWith("java") ) 
+                               registerService(o,c,props);
+               }
+       }
+
+       public void registerService(Object service, Class serviceClass, 
Properties props) {
+               
+               ServiceUtil.registerService(bc, service, serviceClass, props, 
serviceRegistrations);
+               
+       }
+
+
+       public void unregisterAllServices(Object o) {
+               for ( Class c : RegisterUtil.getAllInterfaces(o.getClass()) ) {
+                       if ( !c.getName().startsWith("java") ) { 
+                               unregisterService(o,c);
+                       }
+               }
+       }
+
+
+       public void unregisterService(Object o, Class c) {
+               if ( o == null )
+                       throw new NullPointerException( "service object is 
null" );
+               if ( c == null )
+                       throw new NullPointerException( "class is null" );
+
+               //logger.debug("attempting to UNregister service: " + 
o.toString() + " of type " + c.getName());
+
+               Map<Object, ServiceRegistration> registrations = 
serviceRegistrations.get(c);
+               if ( registrations == null )
+                       return;
+               
+               ServiceRegistration s = registrations.get(o);
+
+               if ( s == null )
+                       return;
+
+               s.unregister();
+
+               serviceRegistrations.get(c).remove(o);
+       }
+
+       @Override
+       public <S> S getService(Class<S> serviceClass) {
+               
+               return ServiceUtil.getService(bc, serviceClass, null);
+               
+       }
+
+
+       @Override
+       public <S> S getService(Class<S> serviceClass, String filter) {
+       
+               
+               return ServiceUtil.getService(bc, serviceClass, filter, null);
+       }
+
+       @Override
+       public void registerServiceListener(Object listener,
+               String registerMethodName, String unregisterMethodName,
+                       Class<?> serviceClass, Class<?> methodClass, String 
additionalFilter) {
+       
+               ServiceUtil.registerServiceListener(bc, listener, 
registerMethodName, unregisterMethodName, serviceClass, methodClass, 
additionalFilter, null);
+       }
+
+       @Override
+       public void registerServiceListener(Object listener,
+                       String registerMethodName, String unregisterMethodName,
+                       Class<?> serviceClass) {
+               
registerServiceListener(listener,registerMethodName,unregisterMethodName,serviceClass,serviceClass,null);
+               
+       }
+
+       @Override
+       public void registerServiceListener(Object listener,
+                       String registerMethodName, String unregisterMethodName,
+                       Class<?> serviceClass, String additionalFilter) {
+               
registerServiceListener(listener,registerMethodName,unregisterMethodName,serviceClass,serviceClass,
 additionalFilter);
+               
+       }
+
+       @Override
+       public void registerServiceListener(Object listener,
+                       String registerMethodName, String unregisterMethodName,
+                       Class<?> serviceClass, Class<?> methodClass) {
+               
registerServiceListener(listener,registerMethodName,unregisterMethodName,serviceClass,methodClass,null);
+               
+       }
+
+       
+
+
+}

Added: 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/ServiceUtil.java
===================================================================
--- 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/ServiceUtil.java
                              (rev 0)
+++ 
core3/api/trunk/service-api/src/main/java/org/cytoscape/service/util/internal/ServiceUtil.java
      2012-03-19 20:11:06 UTC (rev 28580)
@@ -0,0 +1,82 @@
+package org.cytoscape.service.util.internal;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+public final class ServiceUtil {
+       
+       private ServiceUtil(){
+               
+       }
+
+       static public <S> S getService(BundleContext bc, Class<S> serviceClass, 
List<ServiceReference> gottenServices) {
+               try {
+                       ServiceReference ref = 
bc.getServiceReference(serviceClass.getName());
+                       if ( ref == null ) 
+                               throw new 
NullPointerException("ServiceReference is null for: " + serviceClass.getName());
+                       if (gottenServices != null)
+                               gottenServices.add(ref);        
+                       return serviceClass.cast( bc.getService(ref) );
+
+               } catch (Exception e) {
+                       throw new RuntimeException("Couldn't find service: " + 
serviceClass.getName(),e);
+               }
+       }
+
+       static public <S> S getService(BundleContext bc, Class<S> serviceClass, 
String filter, List<ServiceReference> gottenServices) {
+               try { 
+                       ServiceReference[] refs = 
bc.getServiceReferences(serviceClass.getName(),filter);
+                       if ( refs == null ) 
+                               throw new 
NullPointerException("ServiceReference is null for: " + serviceClass.getName() 
+ " with filter: " + filter);
+                       if (gottenServices != null)
+                               gottenServices.add(refs[0]);    
+                       return serviceClass.cast( bc.getService(refs[0]) );
+               } catch (Exception e) {
+                       throw new RuntimeException("Couldn't find service: " + 
serviceClass.getName() + " with filter: " + filter, e);
+               }
+       }
+       
+       static public void registerServiceListener(final BundleContext bc, 
final Object listener, final String registerMethodName, 
+                       final String unregisterMethodName, final Class<?> 
serviceClass, final Class<?> methodClass, final String additionalFilter , 
+                       List<CyServiceListener> serviceListeners) {
+               try {
+                       CyServiceListener serviceListener = new 
CyServiceListener(bc, listener, registerMethodName, unregisterMethodName, 
serviceClass, methodClass, additionalFilter);
+                       serviceListener.open();
+                       if (serviceListeners != null)
+                               serviceListeners.add( serviceListener );
+               } catch (Exception e) {
+                       throw new RuntimeException("Could not listen to 
services for object: " + listener + " with methods: " + registerMethodName + ", 
" + unregisterMethodName + ", service type: " + serviceClass + ", and 
additional filter: " + additionalFilter, e); 
+               }
+       }
+       
+       static public void registerService(final BundleContext bc, final Object 
service, final Class<?> serviceClass, final Properties props, 
+                       Map<Class,Map<Object,ServiceRegistration>> 
serviceRegistrations) {
+               
+               if ( service == null )
+                       throw new NullPointerException( "service object is 
null" );
+               if ( serviceClass == null )
+                       throw new NullPointerException( "class is null" );
+               if ( props == null )
+                       throw new NullPointerException( "props are null" );
+               if ( bc == null )
+                       throw new IllegalStateException( "BundleContext is 
null" );
+
+               //logger.debug("attempting to register service: " + 
service.toString() + " of type " + serviceClass.getName());
+               ServiceRegistration s = bc.registerService( 
serviceClass.getName(), service, props );
+
+               Map<Object, ServiceRegistration> registrations = 
serviceRegistrations.get(serviceClass);
+               if ( registrations == null ) {
+                       registrations = new 
HashMap<Object,ServiceRegistration>();
+                       serviceRegistrations.put(serviceClass, registrations );
+               }
+
+               registrations.put(service,s);
+       }
+
+}

Modified: 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/actions/RecentSessionManager.java
===================================================================
--- 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/actions/RecentSessionManager.java
      2012-03-19 20:05:56 UTC (rev 28579)
+++ 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/actions/RecentSessionManager.java
      2012-03-19 20:11:06 UTC (rev 28580)
@@ -7,6 +7,7 @@
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
+import java.util.Properties;
 import java.util.Set;
 
 import org.cytoscape.application.CyApplicationManager;
@@ -66,7 +67,7 @@
                
                // If there is no recent items, add dummy menu.
                if(tracker.getRecentlyOpenedURLs().size() == 0) {
-                       registrar.registerService(factory, CyAction.class, new 
Hashtable<String, String>());
+                       registrar.registerService(factory, CyAction.class, new 
Properties());
                        return;
                }
                        
@@ -80,12 +81,12 @@
                final List<URL> urls = tracker.getRecentlyOpenedURLs();
 
                for (final URL url : urls) {
-                       final Dictionary<String, String> dict = new 
Hashtable<String, String>();
-                       dict.put("preferredMenu", MENU_CATEGORY);
-                       dict.put("title", url.getFile());
-                       dict.put("menuGravity", "6.0");
+                       final Properties prop = new Properties();
+                       prop.put("preferredMenu", MENU_CATEGORY);
+                       prop.put("title", url.getFile());
+                       prop.put("menuGravity", "6.0");
                        final OpenRecentSessionTaskFactory factory = new 
OpenRecentSessionTaskFactory(sessionManager, readerManager, appManager, 
tracker, url);
-                       registrar.registerService(factory, TaskFactory.class, 
dict);
+                       registrar.registerService(factory, TaskFactory.class, 
prop);
 
                        this.currentMenuItems.add(factory);
                }

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to