1 package nl.hippo.componentcontainers; 2 3 import org.apache.avalon.framework.logger.AbstractLogEnabled; 4 import org.apache.avalon.framework.logger.Logger; 5 import org.apache.avalon.framework.service.ServiceException; 6 import org.apache.avalon.framework.service.ServiceManager; 7 8 public class ServiceManagerProxyImpl extends AbstractLogEnabled implements ServiceManager, ServiceManagerProxy, Logger 9 { 10 private ServiceManager m_serviceManager; 11 12 public ServiceManagerProxyImpl() 13 { 14 super(); 15 } 16 17 public Object lookup(String role) throws ServiceException 18 { 19 if (m_serviceManager == null) 20 { 21 throw new ServiceException(role, "Component with requested role does not exist"); 22 } 23 return m_serviceManager.lookup(role); 24 } 25 26 public boolean hasService(String role) 27 { 28 boolean result; 29 if (m_serviceManager == null) 30 { 31 result = false; 32 } 33 else 34 { 35 result = m_serviceManager.hasService(role); 36 } 37 return result; 38 } 39 40 public void release(Object component) 41 { 42 if (m_serviceManager != null) 43 { 44 m_serviceManager.release(component); 45 } 46 } 47 48 public void setServiceManager(ServiceManager serviceManager) 49 { 50 m_serviceManager = serviceManager; 51 } 52 53 public void debug(String message) 54 { 55 getLogger().debug(message); 56 } 57 58 public void debug(String message, Throwable throwable) 59 { 60 getLogger().debug(message, throwable); 61 } 62 63 public boolean isDebugEnabled() 64 { 65 return getLogger().isDebugEnabled(); 66 } 67 68 public void info(String message) 69 { 70 getLogger().info(message); 71 } 72 73 public void info(String message, Throwable throwable) 74 { 75 getLogger().info(message, throwable); 76 } 77 78 public boolean isInfoEnabled() 79 { 80 return getLogger().isInfoEnabled(); 81 } 82 83 public void warn(String message) 84 { 85 getLogger().warn(message); 86 } 87 88 public void warn(String message, Throwable throwable) 89 { 90 getLogger().warn(message, throwable); 91 } 92 93 public boolean isWarnEnabled() 94 { 95 return getLogger().isWarnEnabled(); 96 } 97 98 public void error(String message) 99 { 100 getLogger().error(message); 101 } 102 103 public void error(String message, Throwable throwable) 104 { 105 getLogger().error(message, throwable); 106 } 107 108 public boolean isErrorEnabled() 109 { 110 return getLogger().isErrorEnabled(); 111 } 112 113 public void fatalError(String message) 114 { 115 getLogger().fatalError(message); 116 } 117 118 public void fatalError(String message, Throwable throwable) 119 { 120 getLogger().fatalError(message, throwable); 121 } 122 123 public boolean isFatalErrorEnabled() 124 { 125 return getLogger().isFatalErrorEnabled(); 126 } 127 128 public Logger getChildLogger(String name) 129 { 130 return getLogger().getChildLogger(name); 131 } 132 133 } 134 | Popular Tags |