private void launchAnimationLibrary(BundleContext context, String libraryId){ theLogger.info("Launching AnimationLibrary Service."); AnimationLibrary library = new DefaultAnimationLibrary(libraryId); ServiceRegistration reg = OSGiUtils.registerService(context, AnimationLibrary.class.getName(), AnimationLibrary.PROP_ANIM_PLAYER_ID, libraryId, library, null); theLogger.info("AnimationLibrary Service Launched."); }
private void launchAnimationLibrary(BundleContext context, String libraryId){ theLogger.info("Launching AnimationLibrary Service."); AnimationLibrary library = new DefaultAnimationLibrary(libraryId); ServiceRegistration reg = OSGiUtils.registerService(context, AnimationLibrary.class.getName(), AnimationLibrary.PROP_ANIM_PLAYER_ID, libraryId, library, null); theLogger.info("AnimationLibrary Service Launched."); }
/** * Registers the given service only if a service does not exist with the * given id. Returns the ServiceRegistration, or null if a service exists. * @param context * @param className * @param idPropertyName * @param idString * @param service * @param serviceProperties * @return the ServiceRegistration, or null if a service exists */ public static ServiceRegistration registerUniqueService( BundleContext context, String className, String idPropertyName, String idString, Object service, Properties serviceProperties){ if(context == null || service == null){ throw new NullPointerException(); } if(serviceExists(context, className, idPropertyName, idString, null)){ theLogger.log(Level.WARNING, "Service already exists with Id: {0}={1}", new Object[]{idPropertyName,idString}); return null; } return registerService(context, className, idPropertyName, idString, service, serviceProperties); }