1 package org.apache.turbine.services; 2 3 18 19 import java.util.Properties ; 20 21 import org.apache.commons.configuration.Configuration; 22 import org.apache.commons.configuration.ConfigurationConverter; 23 24 32 public class BaseService 33 extends BaseInitable 34 implements Service 35 { 36 37 protected ServiceBroker serviceBroker; 38 39 40 protected Configuration configuration; 41 42 43 protected String name; 44 45 52 public void setServiceBroker(ServiceBroker broker) 53 { 54 this.serviceBroker = broker; 55 } 56 57 62 public void setName(String name) 63 { 64 this.name = name; 65 } 66 67 72 public String getName() 73 { 74 return name; 75 } 76 77 82 public ServiceBroker getServiceBroker() 83 { 84 return serviceBroker; 85 } 86 87 92 public Properties getProperties() 93 { 94 return ConfigurationConverter.getProperties(getConfiguration()); 95 } 96 97 102 public Configuration getConfiguration() 103 { 104 if (name == null) 105 { 106 return null; 107 } 108 109 if (configuration == null) 110 { 111 configuration = getServiceBroker().getConfiguration(name); 112 } 113 return configuration; 114 } 115 } 116 | Popular Tags |