View Javadoc
1 package org.apache.turbine.services; 2 3 import org.apache.commons.configuration.Configuration; 4 5 import java.util.Properties; 6 import java.rmi.RemoteException; 7 import java.rmi.server.UnicastRemoteObject; 8 import javax.servlet.ServletConfig; 9 10 11 /*** 12 * A base implementation of an {@link java.rmi.server.UnicastRemoteObject} 13 * as a Turbine {@link org.apache.turbine.services.Service}. 14 * 15 * @author <a href="mailto:dlr@collab.net">Daniel Rall</a> 16 */ 17 public class BaseUnicastRemoteService extends UnicastRemoteObject 18 implements Service 19 { 20 protected Configuration configuration; 21 private boolean isInitialized; 22 private InitableBroker initableBroker; 23 private String name; 24 private Properties properties; 25 private ServiceBroker serviceBroker; 26 27 public BaseUnicastRemoteService() 28 throws RemoteException 29 { 30 isInitialized = false; 31 initableBroker = null; 32 properties = null; 33 name = null; 34 serviceBroker = null; 35 } 36 37 /*** 38 * Returns the configuration of this service. 39 * 40 * @return The configuration of this service. 41 */ 42 public Configuration getConfiguration() 43 { 44 if (name == null) 45 { 46 return null; 47 } 48 else 49 { 50 if (configuration == null) 51 { 52 configuration = getServiceBroker().getConfiguration(name); 53 } 54 return configuration; 55 } 56 } 57 58 public void init(ServletConfig config) 59 throws InitializationException 60 { 61 setInit(true); 62 } 63 64 public void setInitableBroker(InitableBroker broker) 65 { 66 this.initableBroker = broker; 67 } 68 69 public InitableBroker getInitableBroker() 70 { 71 return initableBroker; 72 } 73 74 public void init(Object data) 75 throws InitializationException 76 { 77 init((ServletConfig) data); 78 } 79 80 public void init() throws InitializationException 81 { 82 setInit(true); 83 } 84 85 protected void setInit(boolean value) 86 { 87 isInitialized = value; 88 } 89 90 public boolean getInit() 91 { 92 return isInitialized; 93 } 94 95 /*** 96 * Shuts down this service. 97 */ 98 public void shutdown() 99 { 100 setInit(false); 101 } 102 103 public Properties getProperties() 104 { 105 if (name == null) 106 { 107 return null; 108 } 109 110 if (properties == null) 111 { 112 properties = getServiceBroker().getProperties(name); 113 } 114 return properties; 115 } 116 117 public void setName(String name) 118 { 119 this.name = name; 120 } 121 122 public String getName() 123 { 124 return name; 125 } 126 127 public ServiceBroker getServiceBroker() 128 { 129 return serviceBroker; 130 } 131 132 public void setServiceBroker(ServiceBroker broker) 133 { 134 this.serviceBroker = broker; 135 } 136 }

This page was automatically generated by Maven