KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > Service


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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 implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18
19 package org.apache.catalina;
20
21 import org.apache.catalina.connector.Connector;
22
23
24 /**
25  * A <strong>Service</strong> is a group of one or more
26  * <strong>Connectors</strong> that share a single <strong>Container</strong>
27  * to process their incoming requests. This arrangement allows, for example,
28  * a non-SSL and SSL connector to share the same population of web apps.
29  * <p>
30  * A given JVM can contain any number of Service instances; however, they are
31  * completely independent of each other and share only the basic JVM facilities
32  * and classes on the system class path.
33  *
34  * @author Craig R. McClanahan
35  * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
36  */

37
38 public interface Service {
39
40
41     // ------------------------------------------------------------- Properties
42

43
44     /**
45      * Return the <code>Container</code> that handles requests for all
46      * <code>Connectors</code> associated with this Service.
47      */

48     public Container getContainer();
49
50
51     /**
52      * Set the <code>Container</code> that handles requests for all
53      * <code>Connectors</code> associated with this Service.
54      *
55      * @param container The new Container
56      */

57     public void setContainer(Container container);
58
59
60     /**
61      * Return descriptive information about this Service implementation and
62      * the corresponding version number, in the format
63      * <code>&lt;description&gt;/&lt;version&gt;</code>.
64      */

65     public String JavaDoc getInfo();
66
67
68     /**
69      * Return the name of this Service.
70      */

71     public String JavaDoc getName();
72
73
74     /**
75      * Set the name of this Service.
76      *
77      * @param name The new service name
78      */

79     public void setName(String JavaDoc name);
80
81
82     /**
83      * Return the <code>Server</code> with which we are associated (if any).
84      */

85     public Server getServer();
86
87
88     /**
89      * Set the <code>Server</code> with which we are associated (if any).
90      *
91      * @param server The server that owns this Service
92      */

93     public void setServer(Server server);
94
95     
96     // --------------------------------------------------------- Public Methods
97

98
99     /**
100      * Add a new Connector to the set of defined Connectors, and associate it
101      * with this Service's Container.
102      *
103      * @param connector The Connector to be added
104      */

105     public void addConnector(Connector connector);
106
107
108     /**
109      * Find and return the set of Connectors associated with this Service.
110      */

111     public Connector[] findConnectors();
112
113
114     /**
115      * Remove the specified Connector from the set associated from this
116      * Service. The removed Connector will also be disassociated from our
117      * Container.
118      *
119      * @param connector The Connector to be removed
120      */

121     public void removeConnector(Connector connector);
122
123     /**
124      * Invoke a pre-startup initialization. This is used to allow connectors
125      * to bind to restricted ports under Unix operating environments.
126      *
127      * @exception LifecycleException If this server was already initialized.
128      */

129     public void initialize()
130     throws LifecycleException;
131
132 }
133
Popular Tags