##### Coverage Report - org.apache.turbine.services.BaseUnicastRemoteService

Classes in this File | Line Coverage | Branch Coverage | Complexity
BaseUnicastRemoteService |
0% | 0/32
0% | 0/4
| 1.2;1,2

1 |  |
     package org.apache.turbine.services;
2 |  |
3 |  |
4 |  |
     /*
5 |  |
      * Licensed to the Apache Software Foundation (ASF) under one
6 |  |
      * or more contributor license agreements.  See the NOTICE file
7 |  |
      * distributed with this work for additional information
8 |  |
      * regarding copyright ownership.  The ASF licenses this file
9 |  |
      * to you under the Apache License, Version 2.0 (the
10 |  |
      * "License"); you may not use this file except in compliance
11 |  |
      * with the License.  You may obtain a copy of the License at
12 |  |
      *
13 |  |
      *   http://www.apache.org/licenses/LICENSE-2.0
14 |  |
      *
15 |  |
      * Unless required by applicable law or agreed to in writing,
16 |  |
      * software distributed under the License is distributed on an
17 |  |
      * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 |  |
      * KIND, either express or implied.  See the License for the
19 |  |
      * specific language governing permissions and limitations
20 |  |
      * under the License.
21 |  |
      */
22 |  |
23 |  |
24 |  |
     import java.rmi.RemoteException;
25 |  |
     import java.rmi.server.UnicastRemoteObject;
26 |  |
     import java.util.Properties;
27 |  |
     import javax.servlet.ServletConfig;
28 |  |
29 |  |
     import org.apache.commons.configuration.Configuration;
30 |  |
     import org.apache.commons.configuration.ConfigurationConverter;
31 |  |
32 |  |
     /**
33 |  |
      * A base implementation of an {@link java.rmi.server.UnicastRemoteObject}
34 |  |
      * as a Turbine {@link org.apache.turbine.services.Service}.
35 |  |
      *
36 |  |
      * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
37 |  |
      */
38 |  |
     public class BaseUnicastRemoteService extends UnicastRemoteObject
39 |  |
             implements Service
40 |  |
     {
41 |  |
         /**
42 |  |
          * Serial version.
43 |  |
          */
44 |  |
         private static final long serialVersionUID = -7775459623190960297L;
45 |  |
46 |  |
         protected Configuration configuration;
47 |  |
         private boolean isInitialized;
48 |  |
         private InitableBroker initableBroker;
49 |  |
         private String name;
50 |  |
         private ServiceBroker serviceBroker;
51 |  |
52 |  |
         public BaseUnicastRemoteService()
53 |  |
                 throws RemoteException
54 | 0 |
         {
55 | 0 |
             isInitialized = false;
56 | 0 |
             initableBroker = null;
57 | 0 |
             name = null;
58 | 0 |
             serviceBroker = null;
59 | 0 |
         }
60 |  |
61 |  |
         /**
62 |  |
          * Returns the configuration of this service.
63 |  |
          *
64 |  |
          * @return The configuration of this service.
65 |  |
          */
66 |  |
         public Configuration getConfiguration()
67 |  |
         {
68 | 0 |
             if (name == null)
69 |  |
             {
70 | 0 |
                 return null;
71 |  |
             }
72 |  |
             else
73 |  |
             {
74 | 0 |
                 if (configuration == null)
75 |  |
                 {
76 | 0 |
                     configuration = getServiceBroker().getConfiguration(name);
77 |  |
                 }
78 | 0 |
                 return configuration;
79 |  |
             }
80 |  |
         }
81 |  |
82 |  |
         public void init(ServletConfig config)
83 |  |
                 throws InitializationException
84 |  |
         {
85 | 0 |
             setInit(true);
86 | 0 |
         }
87 |  |
88 |  |
         public void setInitableBroker(InitableBroker broker)
89 |  |
         {
90 | 0 |
             this.initableBroker = broker;
91 | 0 |
         }
92 |  |
93 |  |
         public InitableBroker getInitableBroker()
94 |  |
         {
95 | 0 |
             return initableBroker;
96 |  |
         }
97 |  |
98 |  |
         public void init(Object data)
99 |  |
                 throws InitializationException
100 |  |
         {
101 | 0 |
             init((ServletConfig) data);
102 | 0 |
         }
103 |  |
104 |  |
         public void init() throws InitializationException
105 |  |
         {
106 | 0 |
             setInit(true);
107 | 0 |
         }
108 |  |
109 |  |
         protected void setInit(boolean value)
110 |  |
         {
111 | 0 |
             isInitialized = value;
112 | 0 |
         }
113 |  |
114 |  |
         public boolean getInit()
115 |  |
         {
116 | 0 |
             return isInitialized;
117 |  |
         }
118 |  |
119 |  |
         /**
120 |  |
          * Shuts down this service.
121 |  |
          */
122 |  |
         public void shutdown()
123 |  |
         {
124 | 0 |
             setInit(false);
125 | 0 |
         }
126 |  |
127 |  |
         public Properties getProperties()
128 |  |
         {
129 | 0 |
             return ConfigurationConverter.getProperties(getConfiguration());
130 |  |
         }
131 |  |
132 |  |
         public void setName(String name)
133 |  |
         {
134 | 0 |
             this.name = name;
135 | 0 |
         }
136 |  |
137 |  |
         public String getName()
138 |  |
         {
139 | 0 |
             return name;
140 |  |
         }
141 |  |
142 |  |
         public ServiceBroker getServiceBroker()
143 |  |
         {
144 | 0 |
             return serviceBroker;
145 |  |
         }
146 |  |
147 |  |
         public void setServiceBroker(ServiceBroker broker)
148 |  |
         {
149 | 0 |
             this.serviceBroker = broker;
150 | 0 |
         }
151 |  |
     }