1 /**
2 * $Id: SpringKernelBuilderImpl.java 75 2006-12-15 21:24:12Z maldito_orco $
3 * $Revision: 75 $
4 * $Date: 2006-12-15 18:24:12 -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.springimpl;
23
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28 import org.tubo.configuration.ConfigurationManager;
29 import org.tubo.configuration.def.Configuration;
30 import org.tubo.kernel.KernelBuilder;
31 import org.tubo.kernel.Kernel;
32 import org.tubo.exception.TuboKernelException;
33 import org.tubo.exception.TuboException;
34 import org.tubo.resource.springimpl.SpringResourceManagerImpl;
35
36
37 /**
38 * Created: Dec 1, 2005 5:55:14 AM
39 * Last Modification Date: $Date: 2006-12-15 18:24:12 -0300 (Fri, 15 Dec 2006) $
40 *
41 * @author jvlio (jvlio@users.sourceforge.net)
42 * @version $Revision: 75 $
43 */
44 public class SpringKernelBuilderImpl implements KernelBuilder {
45 public static final String RCS_ID = "$Id: SpringKernelBuilderImpl.java 75 2006-12-15 21:24:12Z maldito_orco $";
46 private static Log log = LogFactory.getLog(SpringKernelBuilderImpl.class);
47
48 /**
49 * This method create a Kernerl based on a configuration
50 *
51 * TODO: crear un BaseBuilder y solo dejar aka la creacion del ResourceManager
52 * @param manager creational ConfiguracionManager
53 * @return retorna un nuevo Kernel a partir de la configuracion de entrada
54 */
55 public Kernel create(ConfigurationManager manager) throws TuboException {
56
57
58 SpringResourceManagerImpl rm = null;
59 try {
60
61
62 Configuration config = manager.getConfiguration();
63
64
65 rm = SpringResourceManagerImpl.newInstance(config);
66 } catch (TuboException e) {
67 throw new TuboKernelException("ResourceManager can't be created",e);
68 }
69
70
71 Kernel kernel = rm.getKernel();
72
73
74 return kernel;
75 }
76
77 }