View Javadoc

1   package org.kuali.ole.docstore.service;
2   
3   import org.kuali.ole.docstore.document.jcr.JcrDocumentManagerFactory;
4   import org.kuali.ole.docstore.factory.DocstoreFactory;
5   import org.kuali.ole.repository.DocumentStoreManager;
6   import org.springframework.context.ApplicationContext;
7   import org.springframework.context.support.ClassPathXmlApplicationContext;
8   
9   /**
10   * Created by IntelliJ IDEA.
11   * User: SG7940
12   * Date: 5/16/12
13   * Time: 12:54 PM
14   * To change this template use File | Settings | File Templates.
15   * <p/>
16   * Helper class to access beans created by Spring.
17   */
18  public class BeanLocator {
19  
20      public static ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
21              "/docstore-springbeans.xml");
22  
23      public static DocumentStoreManager getDocumentStoreManager() {
24  
25          DocumentStoreManager documentStoreManager = (DocumentStoreManager) applicationContext
26                  .getBean("documentStoreManagerService");
27          return documentStoreManager;
28      }
29  
30      public static IngestNIndexHandlerService getIngestNIndexHandlerService() {
31  
32          IngestNIndexHandlerService ingestNIndexHandlerService = (IngestNIndexHandlerService) applicationContext
33                  .getBean("ingestNIndexHandlerService");
34          return ingestNIndexHandlerService;
35      }
36  
37      public static Object getBean(String id) {
38          return applicationContext.getBean(id);
39      }
40  
41      public static DocumentServiceImpl getDocumentServiceImpl() {
42          DocumentServiceImpl documentServiceImpl = (DocumentServiceImpl) applicationContext
43                  .getBean("documentService");
44          return documentServiceImpl;
45      }
46  
47      public static JcrDocumentManagerFactory getDocumentManagerFactory() {
48          JcrDocumentManagerFactory jcrDocumentManagerFactoryService = (JcrDocumentManagerFactory) applicationContext
49                  .getBean("documentManagerFactory");
50          return jcrDocumentManagerFactoryService;
51      }
52  
53      public static BulkIngestProcessHandlerService getBulkIngestProcessHandlerService() {
54          BulkIngestProcessHandlerService bulkIngestProcessHandlerService
55                  = (BulkIngestProcessHandlerService) applicationContext.getBean("bulkIngestProcessHandlerService");
56          return bulkIngestProcessHandlerService;
57      }
58  
59      public static DocstoreFactory getDocstoreFactory() {
60          DocstoreFactory docstoreFactory = (DocstoreFactory) applicationContext.getBean("docstoreFactory");
61          return docstoreFactory;
62      }
63  
64  
65  }