001 /* 002 * To change this template, choose Tools | Templates 003 * and open the template in the editor. 004 */ 005 package org.kuali.rice.krms.impl.repository.mock; 006 007 import org.kuali.rice.krms.api.repository.RuleManagementService; 008 import org.kuali.rice.krms.api.repository.term.TermRepositoryService; 009 import org.kuali.rice.krms.api.repository.type.KrmsTypeRepositoryService; 010 011 /** 012 * 013 * @author nwright 014 */ 015 public class KrmsConfigurationLoader { 016 017 private KrmsTypeRepositoryService krmsTypeRepositoryService = null; 018 private RuleManagementService ruleManagementService = null; 019 private TermRepositoryService termRepositoryService = null; 020 021 public KrmsTypeRepositoryService getKrmsTypeRepositoryService() { 022 023 return krmsTypeRepositoryService; 024 } 025 026 public void setKrmsTypeRepositoryService(KrmsTypeRepositoryService krmsTypeRepositoryService) { 027 this.krmsTypeRepositoryService = krmsTypeRepositoryService; 028 } 029 030 public RuleManagementService getRuleManagementService() { 031 return ruleManagementService; 032 } 033 034 public void setRuleManagementService(RuleManagementService ruleManagementService) { 035 this.ruleManagementService = ruleManagementService; 036 } 037 038 public TermRepositoryService getTermRepositoryService() { 039 return termRepositoryService; 040 } 041 042 public void setTermRepositoryService(TermRepositoryService termRepositoryService) { 043 this.termRepositoryService = termRepositoryService; 044 } 045 046 public void loadConfiguration() { 047 this.loadTypes(); 048 this.loadTypeRelations(); 049 this.loadNlUsages(); 050 this.loadNaturalLanguateTemplates(); 051 this.loadTermSpecs(); 052 this.loadTermResolvers(); 053 this.loadContexts(); 054 } 055 056 private void loadTypes() { 057 KrmsTypeLoader loader = new KrmsTypeLoader(); 058 loader.setKrmsTypeRepositoryService(krmsTypeRepositoryService); 059 loader.load(); 060 } 061 062 private void loadTypeRelations() { 063 KrmsTypeRelationLoader loader = new KrmsTypeRelationLoader(); 064 loader.setKrmsTypeRepositoryService(krmsTypeRepositoryService); 065 loader.load(); 066 } 067 068 private void loadNlUsages() { 069 KrmsNaturalLanguageUsageLoader loader = new KrmsNaturalLanguageUsageLoader(); 070 loader.setRuleManagementService(this.ruleManagementService); 071 loader.load(); 072 } 073 074 private void loadNaturalLanguateTemplates() { 075 KrmsNaturalLanguageTemplateLoader loader = new KrmsNaturalLanguageTemplateLoader(); 076 loader.setRuleManagementService(this.ruleManagementService); 077 loader.load(); 078 } 079 080 private void loadTermSpecs() { 081 KrmsTermSpecificationLoader loader = new KrmsTermSpecificationLoader(); 082 loader.setTermRepositoryService(this.termRepositoryService); 083 loader.load(); 084 } 085 086 private void loadTermResolvers() { 087 KrmsTermResolverLoader loader = new KrmsTermResolverLoader(); 088 loader.setTermRepositoryService(this.termRepositoryService); 089 loader.load(); 090 } 091 // TODO: decide if we should even load these instead of find/create them as needed 092 093 private void loadContexts() { 094 KrmsContextLoader loader = new KrmsContextLoader(); 095 loader.setRuleManagementService(this.ruleManagementService); 096 loader.load(); 097 } 098 }