PageRenderTime 36ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/tomcat-8.0.9-sourcecode/java/org/apache/catalina/Server.java

https://gitlab.com/wenzhucjy/tomcat_source
Java | 216 lines | 30 code | 50 blank | 136 comment | 0 complexity | 986e2c4aa206e7a09c7fe66001facebc MD5 | raw file
Possible License(s): Apache-2.0
  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. import java.io.File;
  19. import org.apache.catalina.deploy.NamingResourcesImpl;
  20. import org.apache.catalina.startup.Catalina;
  21. /**
  22. * A <code>Server</code> element represents the entire Catalina
  23. * servlet container. Its attributes represent the characteristics of
  24. * the servlet container as a whole. A <code>Server</code> may contain
  25. * one or more <code>Services</code>, and the top level set of naming
  26. * resources.
  27. * <p>
  28. * Normally, an implementation of this interface will also implement
  29. * <code>Lifecycle</code>, such that when the <code>start()</code> and
  30. * <code>stop()</code> methods are called, all of the defined
  31. * <code>Services</code> are also started or stopped.
  32. * <p>
  33. * In between, the implementation must open a server socket on the port number
  34. * specified by the <code>port</code> property. When a connection is accepted,
  35. * the first line is read and compared with the specified shutdown command.
  36. * If the command matches, shutdown of the server is initiated.
  37. * <p>
  38. * <strong>NOTE</strong> - The concrete implementation of this class should
  39. * register the (singleton) instance with the <code>ServerFactory</code>
  40. * class in its constructor(s).
  41. *
  42. * @author Craig R. McClanahan
  43. */
  44. public interface Server extends Lifecycle {
  45. // ------------------------------------------------------------- Properties
  46. /**
  47. * Return the global naming resources.
  48. */
  49. public NamingResourcesImpl getGlobalNamingResources();
  50. /**
  51. * Set the global naming resources.
  52. *
  53. * @param globalNamingResources The new global naming resources
  54. */
  55. public void setGlobalNamingResources
  56. (NamingResourcesImpl globalNamingResources);
  57. /**
  58. * Return the global naming resources context.
  59. */
  60. public javax.naming.Context getGlobalNamingContext();
  61. /**
  62. * Return the port number we listen to for shutdown commands.
  63. */
  64. public int getPort();
  65. /**
  66. * Set the port number we listen to for shutdown commands.
  67. *
  68. * @param port The new port number
  69. */
  70. public void setPort(int port);
  71. /**
  72. * Return the address on which we listen to for shutdown commands.
  73. */
  74. public String getAddress();
  75. /**
  76. * Set the address on which we listen to for shutdown commands.
  77. *
  78. * @param address The new address
  79. */
  80. public void setAddress(String address);
  81. /**
  82. * Return the shutdown command string we are waiting for.
  83. */
  84. public String getShutdown();
  85. /**
  86. * Set the shutdown command we are waiting for.
  87. *
  88. * @param shutdown The new shutdown command
  89. */
  90. public void setShutdown(String shutdown);
  91. /**
  92. * Return the parent class loader for this component. If not set, return
  93. * {@link #getCatalina()} {@link Catalina#getParentClassLoader()}. If
  94. * catalina has not been set, return the system class loader.
  95. */
  96. public ClassLoader getParentClassLoader();
  97. /**
  98. * Set the parent class loader for this server.
  99. *
  100. * @param parent The new parent class loader
  101. */
  102. public void setParentClassLoader(ClassLoader parent);
  103. /**
  104. * Return the outer Catalina startup/shutdown component if present.
  105. */
  106. public Catalina getCatalina();
  107. /**
  108. * Set the outer Catalina startup/shutdown component if present.
  109. */
  110. public void setCatalina(Catalina catalina);
  111. /**
  112. * Obtain the configured base (instance) directory. Note that home and base
  113. * may be the same (and are by default). If this is not set the value
  114. * returned by {@link #getCatalinaHome()} will be used.
  115. */
  116. public File getCatalinaBase();
  117. /**
  118. * Set the configured base (instance) directory. Note that home and base
  119. * may be the same (and are by default).
  120. */
  121. public void setCatalinaBase(File catalinaBase);
  122. /**
  123. * Obtain the configured home (binary) directory. Note that home and base
  124. * may be the same (and are by default).
  125. */
  126. public File getCatalinaHome();
  127. /**
  128. * Set the configured home (binary) directory. Note that home and base
  129. * may be the same (and are by default).
  130. */
  131. public void setCatalinaHome(File catalinaHome);
  132. // --------------------------------------------------------- Public Methods
  133. /**
  134. * Add a new Service to the set of defined Services.
  135. *
  136. * @param service The Service to be added
  137. */
  138. public void addService(Service service);
  139. /**
  140. * Wait until a proper shutdown command is received, then return.
  141. */
  142. public void await();
  143. /**
  144. * Return the specified Service (if it exists); otherwise return
  145. * <code>null</code>.
  146. *
  147. * @param name Name of the Service to be returned
  148. */
  149. public Service findService(String name);
  150. /**
  151. * Return the set of Services defined within this Server.
  152. */
  153. public Service[] findServices();
  154. /**
  155. * Remove the specified Service from the set associated from this
  156. * Server.
  157. *
  158. * @param service The Service to be removed
  159. */
  160. public void removeService(Service service);
  161. /**
  162. * Obtain the token necessary for operations on the associated JNDI naming
  163. * context.
  164. */
  165. public Object getNamingToken();
  166. }