01: /**********************************************************************************
02: * $URL:https://source.sakaiproject.org/svn/osp/trunk/warehouse/api-impl/src/java/org/theospi/portfolio/warehouse/impl/DataWarehouseManagerImpl.java $
03: * $Id:DataWarehouseManagerImpl.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.theospi.portfolio.warehouse.impl;
21:
22: import java.util.Iterator;
23: import java.util.List;
24:
25: import org.apache.commons.logging.Log;
26: import org.apache.commons.logging.LogFactory;
27:
28: import org.quartz.JobExecutionContext;
29: import org.quartz.JobExecutionException;
30: import org.sakaiproject.authz.api.SecurityService;
31: import org.theospi.portfolio.security.impl.AllowAllSecurityAdvisor;
32: import org.theospi.portfolio.warehouse.intf.DataWarehouseManager;
33: import org.theospi.portfolio.warehouse.intf.WarehouseTask;
34:
35: /**
36: * Created by IntelliJ IDEA.
37: * User: John Ellis
38: * Date: Nov 30, 2005
39: * Time: 4:48:34 PM
40: * To change this template use File | Settings | File Templates.
41: */
42: public class DataWarehouseManagerImpl implements DataWarehouseManager {
43: protected final Log logger = LogFactory
44: .getLog(DataWarehouseManagerImpl.class);
45:
46: private List tasks;
47: private SecurityService securityService;
48: private boolean autoDdl = true;
49:
50: public void registerTask(WarehouseTask task) {
51: getTasks().add(task);
52: }
53:
54: public void execute(JobExecutionContext jobExecutionContext)
55: throws JobExecutionException {
56:
57: getSecurityService().pushAdvisor(new AllowAllSecurityAdvisor());
58: for (Iterator i = getTasks().iterator(); i.hasNext();) {
59: WarehouseTask task = (WarehouseTask) i.next();
60: try {
61: task.execute();
62: } catch (Exception e) {
63: logger.error("problem running dw warehouse task:"
64: + e.getMessage(), e);
65: }
66: }
67: getSecurityService().popAdvisor();
68: }
69:
70: public List getTasks() {
71: return tasks;
72: }
73:
74: public void setTasks(List tasks) {
75: this .tasks = tasks;
76: }
77:
78: public SecurityService getSecurityService() {
79: return securityService;
80: }
81:
82: public void setSecurityService(SecurityService securityService) {
83: this .securityService = securityService;
84: }
85:
86: public boolean isAutoDdl() {
87: return autoDdl;
88: }
89:
90: public void setAutoDdl(boolean autoDdl) {
91: this.autoDdl = autoDdl;
92: }
93: }
|