001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.j2ee.deployment.annotation;
017:
018: import java.util.ArrayList;
019: import java.util.List;
020:
021: import org.apache.commons.logging.Log;
022: import org.apache.commons.logging.LogFactory;
023: import org.apache.geronimo.xbeans.javaee.EjbLocalRefType;
024: import org.apache.geronimo.xbeans.javaee.EjbRefType;
025: import org.apache.geronimo.xbeans.javaee.EnvEntryType;
026: import org.apache.geronimo.xbeans.javaee.LifecycleCallbackType;
027: import org.apache.geronimo.xbeans.javaee.MessageDestinationRefType;
028: import org.apache.geronimo.xbeans.javaee.PersistenceContextRefType;
029: import org.apache.geronimo.xbeans.javaee.PersistenceUnitRefType;
030: import org.apache.geronimo.xbeans.javaee.ResourceEnvRefType;
031: import org.apache.geronimo.xbeans.javaee.ResourceRefType;
032: import org.apache.geronimo.xbeans.javaee.ServiceRefType;
033: import org.apache.geronimo.xbeans.javaee.WebAppType;
034:
035: /**
036: * Wrapper class to encapsulate the WebAppType class with an interface that the various
037: * AnnotationHelpers can use
038: * <p/>
039: * <p><strong>Remaining ToDo(s):</strong>
040: * <ul>
041: * <li>None
042: * </ul>
043: *
044: * @version $Rev $Date
045: * @since Geronimo 2.0
046: */
047: public class AnnotatedWebApp implements AnnotatedApp {
048:
049: // Private instance variables
050: private static final Log log = LogFactory
051: .getLog(AnnotatedWebApp.class);
052: private WebAppType webApp;
053:
054: // Protected instance variables
055: protected List<EjbRefType> ambiguousEjbRefs;
056:
057: /**
058: * WebAppType-qualified constructor
059: *
060: * @param webApp WebAppType
061: */
062: public AnnotatedWebApp(WebAppType webApp) {
063: this .webApp = webApp;
064: }
065:
066: /**
067: * WebAppType methods used for the @EJB, @EJBs annotations
068: */
069: public EjbLocalRefType[] getEjbLocalRefArray() {
070: return webApp.getEjbLocalRefArray();
071: }
072:
073: public EjbLocalRefType addNewEjbLocalRef() {
074: return webApp.addNewEjbLocalRef();
075: }
076:
077: public EjbRefType[] getEjbRefArray() {
078: return webApp.getEjbRefArray();
079: }
080:
081: public EjbRefType addNewEjbRef() {
082: return webApp.addNewEjbRef();
083: }
084:
085: /**
086: * WebAppType methods used for the @Resource, @Resources annotations
087: */
088: public EnvEntryType[] getEnvEntryArray() {
089: return webApp.getEnvEntryArray();
090: }
091:
092: public EnvEntryType addNewEnvEntry() {
093: return webApp.addNewEnvEntry();
094: }
095:
096: public ServiceRefType[] getServiceRefArray() {
097: return webApp.getServiceRefArray();
098: }
099:
100: public ServiceRefType addNewServiceRef() {
101: return webApp.addNewServiceRef();
102: }
103:
104: public ResourceRefType[] getResourceRefArray() {
105: return webApp.getResourceRefArray();
106: }
107:
108: public ResourceRefType addNewResourceRef() {
109: return webApp.addNewResourceRef();
110: }
111:
112: public MessageDestinationRefType[] getMessageDestinationRefArray() {
113: return webApp.getMessageDestinationRefArray();
114: }
115:
116: public MessageDestinationRefType addNewMessageDestinationRef() {
117: return webApp.addNewMessageDestinationRef();
118: }
119:
120: public ResourceEnvRefType[] getResourceEnvRefArray() {
121: return webApp.getResourceEnvRefArray();
122: }
123:
124: public ResourceEnvRefType addNewResourceEnvRef() {
125: return webApp.addNewResourceEnvRef();
126: }
127:
128: /**
129: * webApp getter
130: *
131: * @return String representation of webApp
132: */
133: public String toString() {
134: return webApp.toString();
135: }
136:
137: /**
138: * webApp getter
139: *
140: * @return webApp WebAppType
141: */
142: public WebAppType getWebApp() {
143: return webApp;
144: }
145:
146: /**
147: * ambiguousRefs getter
148: * <p/>
149: * <p>There is no corresponding setter method. To add a new item to the list do:
150: * <pre>
151: * getAmbiguousEjbRefs().add(ejbRef);
152: * </pre>
153: *
154: * @return ambiguousRefs list
155: */
156: public List<EjbRefType> getAmbiguousEjbRefs() {
157: if (ambiguousEjbRefs == null) {
158: ambiguousEjbRefs = new ArrayList<EjbRefType>();
159: }
160: return this .ambiguousEjbRefs;
161: }
162:
163: public LifecycleCallbackType[] getPostConstructArray() {
164: return webApp.getPostConstructArray();
165: }
166:
167: public LifecycleCallbackType addPostConstruct() {
168: return webApp.addNewPostConstruct();
169: }
170:
171: public LifecycleCallbackType[] getPreDestroyArray() {
172: return webApp.getPreDestroyArray();
173: }
174:
175: public LifecycleCallbackType addPreDestroy() {
176: return webApp.addNewPreDestroy();
177: }
178:
179: public PersistenceContextRefType[] getPersistenceContextRefArray() {
180: return webApp.getPersistenceContextRefArray();
181: }
182:
183: public PersistenceContextRefType addNewPersistenceContextRef() {
184: return webApp.addNewPersistenceContextRef();
185: }
186:
187: public PersistenceUnitRefType[] getPersistenceUnitRefArray() {
188: return webApp.getPersistenceUnitRefArray();
189: }
190:
191: public PersistenceUnitRefType addNewPersistenceUnitRef() {
192: return webApp.addNewPersistenceUnitRef();
193: }
194:
195: public String getComponentType() {
196: return null;
197: }
198: }
|