001 package org.kuali.ole.docstore.service;
002
003 import org.kuali.ole.repository.DocumentStoreManager;
004 import org.springframework.context.ApplicationContext;
005 import org.springframework.context.support.ClassPathXmlApplicationContext;
006
007 /**
008 * Created by IntelliJ IDEA.
009 * User: SG7940
010 * Date: 5/16/12
011 * Time: 12:54 PM
012 * To change this template use File | Settings | File Templates.
013 *
014 * Helper class to access beans created by Spring.
015 */
016 public class BeanLocator {
017
018 public static ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
019 "/docstore-springbeans.xml");
020
021 public static DocumentStoreManager getDocumentStoreManager() {
022
023 DocumentStoreManager documentStoreManager = (DocumentStoreManager) applicationContext
024 .getBean("documentStoreManagerService");
025 return documentStoreManager;
026 }
027
028 public static IngestNIndexHandlerService getIngestNIndexHandlerService() {
029
030 IngestNIndexHandlerService ingestNIndexHandlerService = (IngestNIndexHandlerService) applicationContext
031 .getBean("ingestNIndexHandlerService");
032 return ingestNIndexHandlerService;
033 }
034
035 public static Object getBean(String id) {
036 return applicationContext.getBean(id);
037 }
038
039 }