1 /**
2 * $Id: Kernel.java 72 2006-12-15 21:04:30Z maldito_orco $
3 * $Revision: 72 $
4 * $Date: 2006-12-15 18:04:30 -0300 (Fri, 15 Dec 2006) $
5 *
6 * =========================================================================
7 *
8 * Copyright 2005 Tubo
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22 package org.tubo.kernel;
23
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28 import org.tubo.resource.consumer.ConsumerManager;
29 import org.tubo.resource.ResourceManager;
30 import org.tubo.exception.TuboConsumerException;
31 import org.tubo.exception.TuboException;
32
33 import java.util.List;
34 import java.util.Iterator;
35
36 /**
37 * Created: Jun 16, 2005 5:59:46 AM
38 * Last Modification Date: $Date: 2006-12-15 18:04:30 -0300 (Fri, 15 Dec 2006) $
39 *
40 * @author maldito_orco (maldito_orco@users.sourceforge.net)
41 * @version $Revision: 72 $
42 */
43 public class Kernel {
44 public static final String RCS_ID = "$Id: Kernel.java 72 2006-12-15 21:04:30Z maldito_orco $";
45 private static Log log = LogFactory.getLog(Kernel.class);
46
47 /** resource manager for this kernel instance */
48 private ResourceManager resourceManager = null;
49
50
51 public Kernel() {
52 }
53
54 public ResourceManager getResourceManager() {
55 return resourceManager;
56 }
57
58 public void setResourceManager(ResourceManager resourceManager) {
59 this.resourceManager = resourceManager;
60 }
61
62 /**
63 * + Load Consumers
64 * + Activate Flows??
65 * + Create KernelThead
66 * + run
67 */
68 public void boot() throws TuboException {
69 log.info(".boot() - Booting Tubo");
70
71
72 List consumerManagers = resourceManager.getConsumerManagers();
73
74
75 for (Iterator it=consumerManagers.iterator(); it.hasNext();) {
76 ConsumerManager consumerManager = (ConsumerManager)it.next();
77 try {
78
79
80 consumerManager.load();
81 } catch (TuboConsumerException e) {
82
83
84 throw resourceManager.getExceptionManager().getException(1100,consumerManager.getId(),e);
85 }
86 }
87 log.info(".boot() - Tubo complete boot succefully");
88 }
89
90
91 public void shutdown() {
92 log.info("Tubo Shutdown in process");
93 log.info("Tubo Shutdown completed");
94 }
95
96 public boolean isRunning() {
97 return true;
98 }
99 }