01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * 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.ejb3.interceptor;
23:
24: import org.jboss.ejb3.BeanContext;
25: import org.jboss.ejb3.Container;
26: import org.jboss.ejb3.EJBContainer;
27: import org.jboss.injection.Injector;
28: import org.jboss.injection.PojoInjector;
29: import org.jboss.ejb3.metamodel.Interceptor;
30:
31: import java.lang.reflect.AccessibleObject;
32: import java.util.Map;
33:
34: /**
35: *
36: * @author <a href="kabir.khan@jboss.com">Kabir Khan</a>
37: * @version $Revision: 60233 $
38: */
39: public class InterceptorInjector {
40: EJBContainer container;
41: InterceptorInfo info;
42: PojoInjector[] injectors;
43: protected Map<AccessibleObject, Injector> encInjections;
44:
45: public InterceptorInjector(Container container,
46: InterceptorInfo info,
47: Map<AccessibleObject, Injector> injections) {
48: this .container = (EJBContainer) container;
49: this .info = info;
50: injectors = injections.values().toArray(
51: new PojoInjector[injections.size()]);
52: }
53:
54: public Interceptor getXml() {
55: return info.getXml();
56: }
57:
58: public Class getClazz() {
59: return info.getClazz();
60: }
61:
62: public Container getContainer() {
63: return container;
64: }
65:
66: public void inject(BeanContext ctx, Object instance) {
67: for (PojoInjector injector : injectors) {
68: injector.inject(ctx, instance);
69: }
70: }
71: }
|