KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fulcrum > yaafi > service > baseservice > BaseServiceImpl


1 package org.apache.fulcrum.yaafi.service.baseservice;
2
3 /*
4  * Copyright 2004 Apache Software Foundation
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14  * implied.
15  *
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19
20 import org.apache.avalon.framework.configuration.Configuration;
21 import org.apache.avalon.framework.configuration.ConfigurationException;
22 import org.apache.avalon.framework.context.Context;
23 import org.apache.avalon.framework.context.ContextException;
24 import org.apache.avalon.framework.logger.AbstractLogEnabled;
25 import org.apache.avalon.framework.parameters.ParameterException;
26 import org.apache.avalon.framework.parameters.Parameters;
27 import org.apache.avalon.framework.service.ServiceException;
28 import org.apache.avalon.framework.service.ServiceManager;
29
30 /**
31  * Base class for a service implementation capturing the Avalon
32  * configuration artifats
33  *
34  * @author <a HREF="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
35  */

36
37 public abstract class BaseServiceImpl
38     extends AbstractLogEnabled
39     implements BaseService
40 {
41     /** The name of the service - we don't know it yet */
42     // private String name;
43

44     /** The context supplied by the avalon framework */
45     private Context context;
46     
47     /** The service manager supplied by the avalon framework */
48     private ServiceManager serviceManager;
49     
50     /** The configuraton supplied by the avalon framework */
51     private Configuration configuration;
52     
53     /** The parameters supplied by the avalon framework */
54     private Parameters parameters;
55     
56     /**
57      * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
58      */

59     public void contextualize(Context context) throws ContextException
60     {
61         this.context = context;
62     }
63
64     /**
65      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceContainer)
66      */

67     public void service(ServiceManager serviceManager) throws ServiceException
68     {
69         this.serviceManager = serviceManager;
70     }
71     
72     /**
73      * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
74      */

75     public void configure(Configuration configuration) throws ConfigurationException
76     {
77         this.configuration = configuration;
78     }
79
80     /**
81      * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
82      */

83     public void parameterize(Parameters parameters) throws ParameterException
84     {
85         this.parameters = parameters;
86     }
87     
88     /**
89      * @return Returns the configuration.
90      */

91     protected Configuration getConfiguration()
92     {
93         return configuration;
94     }
95     
96     /**
97      * @return Returns the context.
98      */

99     protected Context getContext()
100     {
101         return context;
102     }
103         
104     /**
105      * @return Returns the parameters.
106      */

107     protected Parameters getParameters()
108     {
109         return parameters;
110     }
111     
112     /**
113      * @return Returns the serviceManager.
114      */

115     protected ServiceManager getServiceManager()
116     {
117         return serviceManager;
118     }
119 }
120
Popular Tags