private void handleAllDependencies(Map<String,Object> requiredServices){ if(!ServiceLifecycleProvider.Validator.validateServices( myLifecycleProvider.getDependencyDescriptors(), requiredServices)){ throw new IllegalArgumentException( "Invalid dependency set for service."); } myLifecycleProvider.start(requiredServices); myService = myLifecycleProvider.getService(); if(myService == null){ getLogger().warn("The lifecycle failed to create a service."); }else{ getLogger().info( "Service created of type(s): {}", Arrays.toString( myLifecycleProvider.getServiceClassNames())); register(); } myLifecycleListener.flush(); }
private void checkForModification(){ T service = myLifecycleProvider.getService(); if(myService == null && service == null){ return; } if(service == null && myService != null){ getLogger().info("Required Service change stopped this service. " + "Service is being unregistered."); unregister(); myService = null; }else if(service != null && myService == null){ getLogger().info( "Required Service change has started this service."); if(myServiceRegistration != null){ unregister(); } myService = service; register(); }else if(service != myService){ getLogger().info( "Required Service change has changed this service."); ServiceRegistration oldReg = myServiceRegistration; myService = service; register(); if(oldReg != null){ oldReg.unregister(); } } }