KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > kernel > plugins > config > AbstractKernelConfigurator


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.kernel.plugins.config;
23
24 import java.util.List JavaDoc;
25 import java.util.Set JavaDoc;
26
27 import org.jboss.beans.info.spi.BeanInfo;
28 import org.jboss.beans.info.spi.PropertyInfo;
29 import org.jboss.beans.metadata.spi.BeanMetaData;
30 import org.jboss.beans.metadata.spi.ConstructorMetaData;
31 import org.jboss.beans.metadata.spi.PropertyMetaData;
32 import org.jboss.beans.metadata.spi.ValueMetaData;
33 import org.jboss.joinpoint.spi.Joinpoint;
34 import org.jboss.joinpoint.spi.MethodJoinpoint;
35 import org.jboss.joinpoint.spi.TargettedJoinpoint;
36 import org.jboss.kernel.Kernel;
37 import org.jboss.kernel.plugins.AbstractKernelObject;
38 import org.jboss.kernel.spi.config.KernelConfig;
39 import org.jboss.kernel.spi.config.KernelConfigurator;
40 import org.jboss.reflect.spi.ClassInfo;
41 import org.jboss.reflect.spi.TypeInfo;
42
43 /**
44  * Abstract Kernel configurator.
45  *
46  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
47  * @version $Revision: 45764 $
48  */

49 public class AbstractKernelConfigurator extends AbstractKernelObject implements KernelConfigurator
50 {
51    /** The kernel config */
52    protected KernelConfig config;
53    
54    /**
55     * Create an abstract kernel configurator
56     *
57     * @throws Exception for any error
58     */

59    public AbstractKernelConfigurator() throws Exception JavaDoc
60    {
61    }
62
63    public BeanInfo getBeanInfo(String JavaDoc className, ClassLoader JavaDoc cl) throws Throwable JavaDoc
64    {
65       return config.getBeanInfo(className, cl);
66    }
67
68    public BeanInfo getBeanInfo(Class JavaDoc clazz) throws Throwable JavaDoc
69    {
70       return config.getBeanInfo(clazz);
71    }
72
73    public BeanInfo getBeanInfo(TypeInfo type) throws Throwable JavaDoc
74    {
75       return config.getBeanInfo(type);
76    }
77
78    public BeanInfo getBeanInfo(BeanMetaData metaData) throws Throwable JavaDoc
79    {
80       ClassLoader JavaDoc cl = Configurator.getClassLoader(metaData);
81       String JavaDoc className = metaData.getBean();
82       if (className == null)
83          return null;
84       return getBeanInfo(className, cl);
85    }
86
87    public ClassInfo getClassInfo(String JavaDoc className, ClassLoader JavaDoc cl) throws Throwable JavaDoc
88    {
89       return config.getClassInfo(className, cl);
90    }
91
92    public ClassInfo getClassInfo(Class JavaDoc clazz) throws Throwable JavaDoc
93    {
94       return config.getClassInfo(clazz);
95    }
96    
97    public Joinpoint getConstructorJoinPoint(BeanInfo info) throws Throwable JavaDoc
98    {
99       return getConstructorJoinPoint(info, null, null);
100    }
101
102    public Joinpoint getConstructorJoinPoint(BeanMetaData metaData) throws Throwable JavaDoc
103    {
104       BeanInfo info = getBeanInfo(metaData);
105       return getConstructorJoinPoint(info, metaData.getConstructor(), metaData);
106    }
107
108    public Joinpoint getConstructorJoinPoint(BeanInfo info, ConstructorMetaData metaData, BeanMetaData beanMetaData) throws Throwable JavaDoc
109    {
110       return Configurator.getConstructorJoinPoint(config, info, metaData, beanMetaData);
111    }
112
113    public TargettedJoinpoint getPropertyGetterJoinPoint(BeanInfo info, String JavaDoc property) throws Throwable JavaDoc
114    {
115       return Configurator.getPropertyGetterJoinPoint(info, property);
116    }
117
118    public Set JavaDoc<TargettedJoinpoint> getPropertySetterJoinPoints(BeanInfo info, BeanMetaData metaData) throws Throwable JavaDoc
119    {
120       return Configurator.getPropertySetterJoinPoints(info, metaData);
121    }
122
123    public TargettedJoinpoint getPropertySetterJoinPoint(BeanInfo info, ClassLoader JavaDoc cl, PropertyMetaData metaData) throws Throwable JavaDoc
124    {
125       return Configurator.getPropertySetterJoinPoint(info, cl, metaData);
126    }
127
128    public TargettedJoinpoint getPropertySetterJoinPoint(PropertyInfo info, ClassLoader JavaDoc cl, PropertyMetaData metaData) throws Throwable JavaDoc
129    {
130       return Configurator.getPropertySetterJoinPoint(info, cl, metaData);
131    }
132
133    public TargettedJoinpoint getPropertySetterJoinPoint(BeanInfo info, String JavaDoc property, ClassLoader JavaDoc cl, ValueMetaData vmd) throws Throwable JavaDoc
134    {
135       return Configurator.getPropertySetterJoinPoint(info, property, cl, vmd);
136    }
137
138    public Set JavaDoc<TargettedJoinpoint> getPropertyNullerJoinPoints(BeanInfo info, BeanMetaData metaData) throws Throwable JavaDoc
139    {
140       return Configurator.getPropertyNullerJoinPoints(info, metaData);
141    }
142
143    public TargettedJoinpoint getPropertyNullerJoinPoint(BeanInfo info, PropertyMetaData metaData) throws Throwable JavaDoc
144    {
145       return Configurator.getPropertyNullerJoinPoint(info, metaData);
146    }
147
148    public TargettedJoinpoint getPropertyNullerJoinPoint(PropertyInfo info, PropertyMetaData metaData) throws Throwable JavaDoc
149    {
150       return Configurator.getPropertyNullerJoinPoint(info, metaData);
151    }
152    
153    public MethodJoinpoint getMethodJoinPoint(BeanInfo info, ClassLoader JavaDoc cl, String JavaDoc name, List JavaDoc parameters, boolean isStatic, boolean isPublic) throws Throwable JavaDoc
154    {
155       return Configurator.findMethod(info, cl, name, parameters, isStatic, isPublic);
156    }
157    
158    public void setKernel(Kernel kernel) throws Throwable JavaDoc
159    {
160       super.setKernel(kernel);
161       config = kernel.getConfig();
162    }
163 }
164
Popular Tags