001: /*
002: * Copyright 2006-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.core;
017:
018: import java.util.ArrayList;
019: import java.util.List;
020:
021: import org.kuali.core.authorization.KualiModuleAuthorizer;
022: import org.kuali.core.datadictionary.spring.DataDictionaryLocationConfigurer;
023: import org.kuali.core.maintenance.rules.MaintenanceDocumentRuleBase;
024: import org.kuali.core.rules.PreRulesContinuationBase;
025: import org.kuali.core.service.KualiModuleUserService;
026: import org.kuali.core.service.impl.KualiModuleUserServiceDefaultImpl;
027: import org.kuali.rice.KNSServiceLocator;
028: import org.springframework.beans.factory.InitializingBean;
029:
030: /**
031: * This class is used for determining which modules are installed
032: */
033: public class KualiModule implements InitializingBean {
034: // private static final Logger LOG = Logger.getLogger(KualiModule.class);
035:
036: private String moduleId;
037:
038: private String moduleName;
039:
040: private String moduleCode;
041:
042: private KualiModuleUserService moduleUserService;
043:
044: private MaintenanceDocumentRuleBase moduleUserRule;
045:
046: private PreRulesContinuationBase moduleUserPreRules;
047:
048: private KualiModuleAuthorizer moduleAuthorizer;
049:
050: private List<String> databaseRepositoryFilePaths;
051:
052: private List<String> dataDictionaryPackages;
053:
054: private List<String> scriptConfigurationFilePaths;
055:
056: private List<String> jobNames;
057:
058: private List<String> triggerNames;
059:
060: private boolean initializeDataDictionary;
061:
062: public KualiModule() {
063: databaseRepositoryFilePaths = new ArrayList<String>();
064: dataDictionaryPackages = new ArrayList<String>();
065: scriptConfigurationFilePaths = new ArrayList<String>();
066: jobNames = new ArrayList<String>();
067: triggerNames = new ArrayList<String>();
068: }
069:
070: public void afterPropertiesSet() throws Exception {
071: if (moduleUserService == null) {
072: this .moduleUserService = new KualiModuleUserServiceDefaultImpl(
073: this .getModuleId());
074: }
075: moduleUserService.setModule(this );
076: KNSServiceLocator.getKualiModuleService().getInstalledModules()
077: .add(this );
078: if (isInitializeDataDictionary()) {
079: DataDictionaryLocationConfigurer ddl = new DataDictionaryLocationConfigurer();
080: ddl.setDataDictionaryPackages(getDataDictionaryPackages());
081: ddl.afterPropertiesSet();
082: }
083: for (String repositoryLocation : getDatabaseRepositoryFilePaths()) {
084: KNSServiceLocator.getPersistenceService()
085: .loadRepositoryDescriptor(repositoryLocation);
086: }
087: }
088:
089: public String getModuleId() {
090: return moduleId;
091: }
092:
093: public void setModuleId(String moduleId) {
094: this .moduleId = moduleId;
095: }
096:
097: public String getModuleName() {
098: return moduleName;
099: }
100:
101: public void setModuleName(String moduleName) {
102: this .moduleName = moduleName;
103: }
104:
105: public KualiModuleUserService getModuleUserService() {
106: return moduleUserService;
107: }
108:
109: public void setModuleUserService(
110: KualiModuleUserService moduleUserService) {
111: this .moduleUserService = moduleUserService;
112: }
113:
114: public KualiModuleAuthorizer getModuleAuthorizer() {
115: return moduleAuthorizer;
116: }
117:
118: public void setModuleAuthorizer(
119: KualiModuleAuthorizer moduleAuthorizer) {
120: this .moduleAuthorizer = moduleAuthorizer;
121: this .moduleAuthorizer.setModule(this ); // link in the module for
122: // reference
123: }
124:
125: public PreRulesContinuationBase getModuleUserPreRules() {
126: return moduleUserPreRules;
127: }
128:
129: public void setModuleUserPreRules(
130: PreRulesContinuationBase moduleUserPreRules) {
131: this .moduleUserPreRules = moduleUserPreRules;
132: }
133:
134: public MaintenanceDocumentRuleBase getModuleUserRule() {
135: return moduleUserRule;
136: }
137:
138: public void setModuleUserRule(
139: MaintenanceDocumentRuleBase moduleUserRule) {
140: this .moduleUserRule = moduleUserRule;
141: }
142:
143: public List<String> getDataDictionaryPackages() {
144: return dataDictionaryPackages;
145: }
146:
147: public void setDataDictionaryPackages(
148: List<String> dataDictionaryPackages) {
149: this .dataDictionaryPackages = dataDictionaryPackages;
150: }
151:
152: public String getModuleCode() {
153: return moduleCode;
154: }
155:
156: public void setModuleCode(String moduleCode) {
157: this .moduleCode = moduleCode;
158: }
159:
160: public List<String> getDatabaseRepositoryFilePaths() {
161: return databaseRepositoryFilePaths;
162: }
163:
164: public void setDatabaseRepositoryFilePaths(
165: List<String> databaseRepositoryFilePaths) {
166: this .databaseRepositoryFilePaths = databaseRepositoryFilePaths;
167: }
168:
169: public List<String> getJobNames() {
170: return jobNames;
171: }
172:
173: public void setJobNames(List<String> jobNames) {
174: this .jobNames = jobNames;
175: }
176:
177: public List<String> getScriptConfigurationFilePaths() {
178: return scriptConfigurationFilePaths;
179: }
180:
181: public void setScriptConfigurationFilePaths(
182: List<String> scriptConfigurationFilePaths) {
183: this .scriptConfigurationFilePaths = scriptConfigurationFilePaths;
184: }
185:
186: public List<String> getTriggerNames() {
187: return triggerNames;
188: }
189:
190: public void setTriggerNames(List<String> triggerNames) {
191: this .triggerNames = triggerNames;
192: }
193:
194: public boolean isInitializeDataDictionary() {
195: return initializeDataDictionary;
196: }
197:
198: public void setInitializeDataDictionary(
199: boolean initializeDataDictionary) {
200: this.initializeDataDictionary = initializeDataDictionary;
201: }
202: }
|