Changeset 6629
- Timestamp:
- Nov 27, 2014, 8:41:11 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/dist/web.xml
r6497 r6629 60 60 61 61 <!-- 62 BASE startup and shutdown servlet;63 should be configured to load on startup as the first servlet62 Listener implementation that start and stop BASE 63 when the Tomcat is starting/stopping. 64 64 --> 65 < servlet>65 <listener> 66 66 <description>Starts and stops BASE when Tomcat is starting and stopping</description> 67 67 <display-name>BASE Start/Stop servlet</display-name> 68 <servlet-name>BASE</servlet-name> 69 <servlet-class>net.sf.basedb.clients.web.servlet.StartStopServlet</servlet-class> 70 <load-on-startup>1</load-on-startup> 71 </servlet> 68 <listener-class>net.sf.basedb.clients.web.servlet.StartStopServlet</listener-class> 69 </listener> 72 70 73 71 <!-- The View servlet used to download files in view mode --> … … 218 216 <servlet> 219 217 <description> 220 Starts up the extensions system in the web client and handles request for 221 servlets inside extensions. 218 Handles request for servlets inside extensions. 222 219 </description> 223 220 <display-name>Web client extensions manager</display-name> 224 221 <servlet-name>ExtensionsServlet</servlet-name> 225 222 <servlet-class>net.sf.basedb.clients.web.servlet.ExtensionsServlet</servlet-class> 226 <load-on-startup>2</load-on-startup>227 223 </servlet> 228 224 <servlet-mapping> -
trunk/src/clients/web/net/sf/basedb/clients/web/servlet/ExtensionsServlet.java
r5606 r6629 25 25 import java.util.regex.Pattern; 26 26 27 import javax.servlet.ServletConfig;28 import javax.servlet.ServletContext;29 27 import javax.servlet.ServletException; 30 28 import javax.servlet.http.HttpServlet; … … 40 38 41 39 /** 42 Servlet for starting the extension system when the web server starts. 43 The servlet should be configured with the 44 <code><load-on-startup>1</load-on-startup></code> 45 option in the web.xml file. When the servlet is loaded it will initialise the 46 {@link ExtensionsControl} class. 47 <p> 48 49 This servlet is also acting as a proxy for requests to extension defined 40 This servlet is acting as a proxy for requests to extension defined 50 41 servlets. Such servlets are defined in <code>META-INF/servlets.xml</code> 51 42 in the extension JAR file. A request to a servlet must have the following … … 65 56 public ExtensionsServlet() 66 57 {} 67 68 @Override69 public void init()70 throws ServletException71 {72 super.init();73 ServletConfig cfg = getServletConfig();74 ServletContext context = cfg.getServletContext();75 ExtensionsControl.init(context);76 }77 78 @Override79 public void destroy()80 {81 ExtensionsControl.close();82 super.destroy();83 }84 58 85 59 /** -
trunk/src/clients/web/net/sf/basedb/clients/web/servlet/StartStopServlet.java
r4512 r6629 21 21 package net.sf.basedb.clients.web.servlet; 22 22 23 import javax.servlet.ServletException; 24 import javax.servlet.http.HttpServlet; 23 import javax.servlet.ServletContextEvent; 24 import javax.servlet.ServletContextListener; 25 26 import net.sf.basedb.clients.web.extensions.ExtensionsControl; 25 27 import net.sf.basedb.core.Application; 26 28 27 29 /** 28 Servlet for starting BASE when the web server is started and30 Servlet listener for starting BASE when the web server is started and 29 31 stopping BASE when the web server is stopped. This servlet is very simple. 30 It will call {@link Application#start()} when it is loaded and 31 {@link Application#stop()} when it is destroyed. 32 <p> 33 34 This servlet should be configured to load before any other servlet that 35 use BASE classes. 32 It will call {@link Application#start()} and {@link ExtensionsControl#init(javax.servlet.ServletContext)} 33 when it is loaded and {@link Application#stop()} and {@link ExtensionsControl#close()} 34 when it is destroyed. 35 36 36 37 37 @author nicklas … … 40 40 */ 41 41 public class StartStopServlet 42 extends HttpServlet42 implements ServletContextListener 43 43 { 44 44 … … 48 48 {} 49 49 50 /**51 Calls {@link Application#start()}.52 */53 50 @Override 54 public void init() 55 throws ServletException 51 public void contextInitialized(ServletContextEvent ctx) 56 52 { 57 super.init();58 53 Application.start(); 54 ExtensionsControl.init(ctx.getServletContext()); 55 } 56 57 @Override 58 public void contextDestroyed(ServletContextEvent ctx) 59 { 60 ExtensionsControl.close(); 61 Application.stop(); 59 62 } 60 63 61 /**62 Calls {@link Application#stop()}.63 */64 @Override65 public void destroy()66 {67 Application.stop();68 super.destroy();69 }70 64 71 65 } -
trunk/src/core/net/sf/basedb/core/Application.java
r6520 r6629 672 672 if (timer != null) timer.cancel(); 673 673 if (internalJobQueue != null) internalJobQueue.close(); 674 internalJobQueue = null; 674 675 timer = null; 675 676 scheduler = null; 676 677 cleanSessionControlCache(true); 677 678 sessionCache = null; 678 679 679 Keyring.unload(); 680 680 SystemItems.unload(); … … 690 690 ExtendedProperties.unload(); 691 691 Config.unload(); 692 693 xtManager = null; 694 secondaryStorageDriver = null; 695 userFilesDirectory = null; 696 pluginsDirectory = null; 697 extendedPropertiesFile = null; 698 rawDataTypesFile = null; 699 dynamicCatalog = null; 700 dynamicSchema = null; 701 hostName = null; 702 databaseVersionNumber = null; 703 692 704 schemaVersion = -2; 693 705 log.info("BASE has been stopped");
Note: See TracChangeset
for help on using the changeset viewer.