1   package org.kuali.ole.docstore.common.client;
2   
3   
4   
5   
6   
7   
8   
9   
10  public class DocstoreClientLocator {
11  
12      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocstoreClientLocator.class);
13      private DocstoreClient docstoreClient = null;
14      public DocstoreClientLocator(){
15          
16          docstoreClient = new DocstoreRestClient();
17      }
18      public DocstoreClient getDocstoreClient()throws Exception{
19          if (docstoreClient !=null) {
20              return docstoreClient;
21          } else {
22              LOG.info("docstoreClient is null");
23              
24              try{
25                  Class<?> docstoreServiceClass = Class.forName("org.kuali.ole.docstore.engine.service.DocstoreServiceImpl");
26                  
27                  docstoreClient = (DocstoreClient) Class.forName("org.kuali.ole.docstore.engine.client.DocstoreLocalClient").newInstance();
28                  
29                  LOG.info("DocstoreLocalClient successfully instantiated");
30                  
31              }catch(ClassNotFoundException cnfe){
32                  
33                  docstoreClient = new DocstoreRestClient();
34                  LOG.info("DocstoreRestClient successfully instantiated");
35              }
36          }
37          return docstoreClient;
38      }
39  }