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 package org.apache.catalina;
18
19 import org.apache.catalina.connector.Connector;
20 import org.apache.catalina.mapper.Mapper;
21
22 /**
23  * A <strong>Service</strong> is a group of one or more
24  * <strong>Connectors</strong> that share a single <strong>Container</strong>
25  * to process their incoming requests.  This arrangement allows, for example,
26  * a non-SSL and SSL connector to share the same population of web apps.
27  * <p>
28  * A given JVM can contain any number of Service instances; however, they are
29  * completely independent of each other and share only the basic JVM facilities
30  * and classes on the system class path.
31  *
32  * @author Craig R. McClanahan
33  */

34 public interface Service extends Lifecycle {
35
36     // ------------------------------------------------------------- Properties
37
38     /**
39      * @return the <code>Engine</code> that handles requests for all
40      * <code>Connectors</code> associated with this Service.
41      */

42     public Engine getContainer();
43
44     /**
45      * Set the <code>Engine</code> that handles requests for all
46      * <code>Connectors</code> associated with this Service.
47      *
48      * @param engine The new Engine
49      */

50     public void setContainer(Engine engine);
51
52     /**
53      * @return the name of this Service.
54      */

55     public String getName();
56
57     /**
58      * Set the name of this Service.
59      *
60      * @param name The new service name
61      */

62     public void setName(String name);
63
64     /**
65      * @return the <code>Server</code> with which we are associated (if any).
66      */

67     public Server getServer();
68
69     /**
70      * Set the <code>Server</code> with which we are associated (if any).
71      *
72      * @param server The server that owns this Service
73      */

74     public void setServer(Server server);
75
76     /**
77      * @return the parent class loader for this component. If not set, return
78      * {@link #getServer()} {@link Server#getParentClassLoader()}. If no server
79      * has been set, return the system class loader.
80      */

81     public ClassLoader getParentClassLoader();
82
83     /**
84      * Set the parent class loader for this service.
85      *
86      * @param parent The new parent class loader
87      */

88     public void setParentClassLoader(ClassLoader parent);
89
90     /**
91      * @return the domain under which this container will be / has been
92      * registered.
93      */

94     public String getDomain();
95
96
97     // --------------------------------------------------------- Public Methods
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      * Find and return the set of Connectors associated with this Service.
109      *
110      * @return the set of associated Connectors
111      */

112     public Connector[] findConnectors();
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      * Adds a named executor to the service
125      * @param ex Executor
126      */

127     public void addExecutor(Executor ex);
128
129     /**
130      * Retrieves all executors
131      * @return Executor[]
132      */

133     public Executor[] findExecutors();
134
135     /**
136      * Retrieves executor by name, null if not found
137      * @param name String
138      * @return Executor
139      */

140     public Executor getExecutor(String name);
141
142     /**
143      * Removes an executor from the service
144      * @param ex Executor
145      */

146     public void removeExecutor(Executor ex);
147
148     /**
149      * @return the mapper associated with this Service.
150      */

151     Mapper getMapper();
152 }
153