1 package org.apache.fulcrum.yaafi.service.servicemanager; 2 3 19 20 import org.apache.avalon.framework.activity.Disposable; 21 import org.apache.avalon.framework.logger.AbstractLogEnabled; 22 import org.apache.avalon.framework.service.ServiceException; 23 import org.apache.avalon.framework.service.ServiceManager; 24 import org.apache.avalon.framework.service.Serviceable; 25 26 27 32 33 public class ServiceManagerService 34 extends AbstractLogEnabled 35 implements ServiceManager, Serviceable, Disposable 36 { 37 38 private static ServiceManager serviceManager; 39 40 43 public ServiceManagerService() 44 { 45 } 46 47 public static ServiceManager getServiceManager() 48 { 49 return ServiceManagerService.serviceManager; 50 } 51 52 56 59 public void service(ServiceManager serviceManager) throws ServiceException 60 { 61 this.getLogger().debug( "Storing the ServiceContainer instance" ); 62 ServiceManagerService.serviceManager = serviceManager; 63 } 64 65 68 public void dispose() 69 { 70 this.getLogger().debug( "Removing the ServiceContainer instance" ); 71 ServiceManagerService.serviceManager = null; 72 } 73 74 78 81 public boolean hasService(String name) 82 { 83 return ServiceManagerService.serviceManager.hasService(name); 84 } 85 86 89 public Object lookup(String name) throws ServiceException 90 { 91 return ServiceManagerService.serviceManager.lookup(name); 92 } 93 94 97 public void release(Object object) 98 { 99 ServiceManagerService.serviceManager.release(object); 100 } 101 } 102 | Popular Tags |