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