View Javadoc
1   /*
2    * Copyright 2011 The Kuali Foundation.
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.web;
17  
18  import javax.servlet.ServletContextEvent;
19  import javax.servlet.ServletContextListener;
20  
21  import org.kuali.ole.docstore.process.DocStoreCamelContext;
22  import org.kuali.ole.docstore.utility.DocStoreSettingsUtil;
23  import org.kuali.ole.service.DocumentStoreService;
24  import org.slf4j.Logger;
25  import org.slf4j.LoggerFactory;
26  
27  /**
28   * Created by IntelliJ IDEA.
29   * User: pvsubrah
30   * Date: 11/3/11
31   * Time: 1:24 PM
32   * To change this template use File | Settings | File Templates.
33   */
34  public class DocumentStoreContextListner implements ServletContextListener {
35      private Logger logger   = LoggerFactory.getLogger(DocumentStoreContextListner.class);
36      @Override
37      public void contextInitialized(ServletContextEvent sce) {
38          try {
39              DocStoreSettingsUtil.getInstance().copyResources();
40          } catch (Exception e) {
41             logger.error(e.getMessage() , e);
42          }
43          DocStoreCamelContext.getInstance();
44      }
45  
46      @Override
47      public void contextDestroyed(ServletContextEvent sce) {
48  
49          DocStoreCamelContext.getInstance().stop();
50          new DocumentStoreService().shutdownRepository();
51      }
52  }