From: <mwl...@us...> - 2009-01-22 19:47:43
|
Revision: 852 http://cishell.svn.sourceforge.net/cishell/?rev=852&view=rev Author: mwlinnem Date: 2009-01-22 19:47:33 +0000 (Thu, 22 Jan 2009) Log Message: ----------- Altered CIShellContext contract so that it attempts to find a requested service, even if it is not one of the standard services. Modified Paths: -------------- trunk/core/org.cishell.framework/src/org/cishell/framework/CIShellContext.java trunk/core/org.cishell.framework/src/org/cishell/framework/LocalCIShellContext.java Modified: trunk/core/org.cishell.framework/src/org/cishell/framework/CIShellContext.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/CIShellContext.java 2009-01-22 18:10:47 UTC (rev 851) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/CIShellContext.java 2009-01-22 19:47:33 UTC (rev 852) @@ -41,8 +41,10 @@ GUIBuilderService.class.getName()}; /** - * Locates and returns a standard service given the service name. The + * Locates and returns a service given the service name. The * service name is generally the full class name of the service interface. + * Standard CIShell services are guaranteed to be returned, but requests + * for non-standard services may return null. * For example, <code>LogService</code>'s string is * <code>org.osgi.service.log.LogService</code>. * Modified: trunk/core/org.cishell.framework/src/org/cishell/framework/LocalCIShellContext.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/LocalCIShellContext.java 2009-01-22 18:10:47 UTC (rev 851) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/LocalCIShellContext.java 2009-01-22 19:47:33 UTC (rev 852) @@ -61,6 +61,7 @@ * @see org.cishell.framework.CIShellContext#getService(java.lang.String) */ public Object getService(String service) { + //check if the requested service is a standard service for (int i=0; i < standardServices.length; i++) { if (standardServices[i].equals(service)) { ServiceReference ref = bContext.getServiceReference(service); @@ -73,6 +74,12 @@ } } - return null; + /* + * if it is not a standard service, we try to retrieve it anyway, + * but make no guarantees as to its availability + */ + + ServiceReference ref = bContext.getServiceReference(service); + return bContext.getService(ref); //may be null } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |