001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.injection;
023:
024: import java.lang.annotation.Annotation;
025: import java.lang.reflect.AccessibleObject;
026: import java.lang.reflect.Field;
027: import java.lang.reflect.Method;
028: import java.util.List;
029: import java.util.Map;
030:
031: import javax.naming.Context;
032: import javax.naming.NameNotFoundException;
033:
034: import org.jboss.ejb3.Container;
035: import org.jboss.ejb3.DependencyPolicy;
036: import org.jboss.ejb3.entity.PersistenceUnitDeployment;
037: import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
038:
039: //import org.jboss.virtual.VirtualFile;
040:
041: /**
042: * This is the container that manages all injections. Could be an EJB Container
043: * or a WAR.
044: *
045: * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
046: * @version $Revision: 60233 $
047: */
048: public interface InjectionContainer {
049: /** Some identifier that can be used in error messages */
050: String getIdentifier();
051:
052: /**
053: * For error messages
054: * @return ejb-jar.xml, web.xml, etc..
055: */
056: String getDeploymentDescriptorType();
057:
058: ClassLoader getClassloader();
059:
060: Map<String, EncInjector> getEncInjectors();
061:
062: Map<String, Map<AccessibleObject, Injector>> getEncInjections();
063:
064: // EncInjectors/Handlers may need to add extra instance injectors
065: List<Injector> getInjectors();
066:
067: // VirtualFile getRootFile();
068:
069: Context getEnc();
070:
071: PersistenceUnitDeployment getPersistenceUnitDeployment(
072: String unitName) throws NameNotFoundException;
073:
074: Container resolveEjbContainer(String link, Class businessIntf);
075:
076: Container resolveEjbContainer(Class businessIntf)
077: throws NameNotFoundException;
078:
079: String getEjbJndiName(Class businessInterface)
080: throws NameNotFoundException;
081:
082: String getEjbJndiName(String link, Class businessInterface);
083:
084: /**
085: * If class has container overridable annotations, this method will
086: * discover those overriden annotations.
087: */
088: <T extends Annotation> T getAnnotation(Class<T> annotationType,
089: Class<?> clazz);
090:
091: /**
092: * If class has container overridable annotations, this method will
093: * discover those overriden annotations.
094: */
095: <T extends Annotation> T getAnnotation(Class<T> annotationType,
096: Class<?> clazz, Method method);
097:
098: <T extends Annotation> T getAnnotation(Class<T> annotationType,
099: Method method);
100:
101: /**
102: * If class has container overridable annotations, this method will
103: * discover those overriden annotations.
104: */
105: <T extends Annotation> T getAnnotation(Class<T> annotationType,
106: Class<?> clazz, Field field);
107:
108: <T extends Annotation> T getAnnotation(Class<T> annotationType,
109: Field field);
110:
111: DependencyPolicy getDependencyPolicy();
112:
113: EnvironmentRefGroup getEnvironmentRefGroup();
114: }
|