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
25 /**
26 * Created by IntelliJ IDEA.
27 * User: pvsubrah
28 * Date: 11/3/11
29 * Time: 1:24 PM
30 * To change this template use File | Settings | File Templates.
31 */
32 public class DocumentStoreContextListner implements ServletContextListener {
33
34 @Override
35 public void contextInitialized(ServletContextEvent sce) {
36 try {
37 DocStoreSettingsUtil.getInstance().copyResources();
38 } catch (Exception e) {
39 e.printStackTrace();
40 }
41 DocStoreCamelContext.getInstance();
42 }
43
44 @Override
45 public void contextDestroyed(ServletContextEvent sce) {
46
47 DocStoreCamelContext.getInstance().stop();
48 new DocumentStoreService().shutdownRepository();
49 }
50 }