KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > refactoring > whereused > EjbJarWhereUsedRefactoring


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.refactoring.whereused;
21
22 import java.io.IOException JavaDoc;
23 import java.text.MessageFormat JavaDoc;
24 import java.util.Collection JavaDoc;
25 import java.util.Iterator JavaDoc;
26 import javax.jmi.reflect.RefObject;
27 import org.netbeans.api.project.FileOwnerQuery;
28 import org.netbeans.api.project.Project;
29 import org.netbeans.modules.j2ee.dd.api.ejb.AssemblyDescriptor;
30 import org.netbeans.modules.j2ee.dd.api.ejb.ContainerTransaction;
31 import org.netbeans.modules.j2ee.dd.api.ejb.ExcludeList;
32 import org.netbeans.modules.j2ee.dd.api.ejb.MethodPermission;
33 import org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException;
34 import org.netbeans.modules.j2ee.dd.api.common.EjbRef;
35 import org.netbeans.modules.j2ee.dd.api.common.EjbLocalRef;
36 import org.netbeans.jmi.javamodel.ClassDefinition;
37 import org.netbeans.jmi.javamodel.JavaClass;
38 import org.netbeans.jmi.javamodel.Method;
39 import org.netbeans.jmi.javamodel.UnresolvedClass;
40 import org.netbeans.modules.j2ee.dd.api.ejb.EjbJar;
41 import org.netbeans.modules.j2ee.dd.api.ejb.EnterpriseBeans;
42 import org.netbeans.modules.j2ee.dd.api.ejb.Entity;
43 import org.netbeans.modules.j2ee.dd.api.ejb.MessageDriven;
44 import org.netbeans.modules.j2ee.dd.api.ejb.Query;
45 import org.netbeans.modules.j2ee.dd.api.ejb.QueryMethod;
46 import org.netbeans.modules.j2ee.dd.api.ejb.Session;
47 import org.netbeans.modules.j2ee.refactoring.Utility;
48 import org.netbeans.modules.javacore.api.JavaModel;
49 import org.netbeans.modules.refactoring.api.AbstractRefactoring;
50 import org.netbeans.modules.refactoring.api.Problem;
51 import org.netbeans.modules.refactoring.api.RefactoringSession;
52 import org.netbeans.modules.refactoring.spi.RefactoringElementsBag;
53 import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation;
54 import org.netbeans.modules.refactoring.api.WhereUsedQuery;
55 import org.openide.ErrorManager;
56 import org.openide.filesystems.FileObject;
57 import org.openide.util.NbBundle;
58
59 /**
60  *
61  * @author Martin Grebac
62  */

63 public final class EjbJarWhereUsedRefactoring {
64     
65     private static final ErrorManager err = ErrorManager.getDefault().getInstance("org.netbeans.modules.j2ee.refactoring.whereused"); // NOI18N
66

67     public EjbJarWhereUsedRefactoring() { }
68
69     public Problem prepare(AbstractRefactoring refactoring, RefObject refObject, RefactoringElementsBag refactoringElements) {
70         RefactoringSession session = refactoringElements.getSession();
71         Problem problem = null;
72         if (refObject instanceof JavaClass) {
73             
74             JavaClass jClass = (JavaClass)refObject;
75             err.log("jClass: " + jClass);
76             
77             String JavaDoc name = jClass.getName();
78             err.log("name: " + name);
79             Collection JavaDoc emodules = Utility.getRelevantEjbModules(jClass);
80             Iterator JavaDoc emIter = null;
81
82             if (emodules != null) {
83                 emIter = emodules.iterator();
84             }
85             if (emIter != null) {
86                 while (emIter.hasNext()) {
87                     org.netbeans.modules.j2ee.api.ejbjar.EjbJar em = (org.netbeans.modules.j2ee.api.ejbjar.EjbJar)emIter.next();
88                     if (em != null) { // the class is in an ejb module
89
FileObject ejbJarFO = em.getDeploymentDescriptor();
90                         EjbJar ejbJarDD = null;
91                         try {
92                             ejbJarDD = org.netbeans.modules.j2ee.dd.api.ejb.DDProvider.getDefault().getMergedDDRoot(em.getMetadataUnit());
93                         } catch (IOException JavaDoc ioe) {
94                             // ignore
95
}
96                         if ((ejbJarDD != null) && (ejbJarDD.getStatus()!=EjbJar.STATE_INVALID_UNPARSABLE) && ejbJarFO != null) {
97                             EnterpriseBeans eBeans = ejbJarDD.getEnterpriseBeans();
98
99                             /* First check Session beans */
100                             Session [] sessionBeans = eBeans.getSession();
101                             err.log("Session Beans: " + sessionBeans);
102                             if ((sessionBeans != null) && (sessionBeans.length > 0)) {
103                                 for (int b=0; b < sessionBeans.length; b++) {
104                                     Session sBean = sessionBeans[b];
105                                     err.log("Session Bean: " + sBean);
106                                     String JavaDoc ejbClass = sBean.getEjbClass();
107                                     err.log("EJB Class: " + ejbClass);
108                                     if ((ejbClass != null) && (ejbClass.equals(name))) {
109                                         RefactoringElementImplementation elem = new EjbJarBeanClassWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
110                                         refactoringElements.add(refactoring, elem);
111                                     }
112                                     String JavaDoc ejbLocal = sBean.getLocal();
113                                     err.log("EJB Local: " + ejbLocal);
114                                     if ((ejbLocal != null) && (ejbLocal.equals(name))) {
115                                         RefactoringElementImplementation elem = new EjbJarLocalWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
116                                         refactoringElements.add(refactoring, elem);
117                                     }
118                                     String JavaDoc ejbLocalHome = sBean.getLocalHome();
119                                     err.log("EJB LocalHome: " + ejbLocalHome);
120                                     if ((ejbLocalHome != null) && (ejbLocalHome.equals(name))) {
121                                         RefactoringElementImplementation elem = new EjbJarLocalHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
122                                         refactoringElements.add(refactoring, elem);
123                                     }
124                                     String JavaDoc ejbHome = sBean.getHome();
125                                     err.log("EJB Home: " + ejbHome);
126                                     if ((ejbHome != null) && (ejbHome.equals(name))) {
127                                         RefactoringElementImplementation elem = new EjbJarHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
128                                         refactoringElements.add(refactoring, elem);
129                                     }
130                                     String JavaDoc ejbRemote = sBean.getRemote();
131                                     err.log("EJB Remote: " + ejbRemote);
132                                     if ((ejbRemote != null) && (ejbRemote.equals(name))) {
133                                         RefactoringElementImplementation elem = new EjbJarRemoteWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
134                                         refactoringElements.add(refactoring, elem);
135                                     }
136
137                                     // service endpoint is related to ejb based web services
138
String JavaDoc serviceEndpoint;
139                                     try {
140                                         serviceEndpoint = sBean.getServiceEndpoint();
141                                         err.log("EJB Service Endpoint: " + serviceEndpoint);
142                                         if ((serviceEndpoint != null) && (serviceEndpoint.equals(name))) {
143                                             RefactoringElementImplementation elem = new EjbJarServiceEndpointWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
144                                             refactoringElements.add(refactoring, elem);
145                                         }
146                                     } catch (VersionNotSupportedException versionex) {
147                                         // No problem, just ignore
148
err.log("Service endpoint not supported in this version of dd.");
149                                     }
150                                     // refs
151
EjbRef[] refs = sBean.getEjbRef();
152                                     if ((refs != null) && (refs.length > 0)) {
153                                         for (int l=0; l < refs.length; l++) {
154                                             EjbRef ref = refs[l];
155                                             err.log("EJB ref: " + ref);
156                                             String JavaDoc refHome = ref.getHome();
157                                             if ((refHome != null) && (refHome.equals(name))) {
158                                                 RefactoringElementImplementation elem = new EjbJarRefHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
159                                                 refactoringElements.add(refactoring, elem);
160                                             }
161                                             String JavaDoc refRemote = ref.getRemote();
162                                             if ((refRemote != null) && (refRemote.equals(name))) {
163                                                 RefactoringElementImplementation elem = new EjbJarRefRemoteWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
164                                                 refactoringElements.add(refactoring, elem);
165                                             }
166                                         }
167                                     }
168                                     // local refs
169
EjbLocalRef[] localRefs = sBean.getEjbLocalRef();
170                                     if ((localRefs != null) && (localRefs.length > 0)) {
171                                         for (int l=0; l < localRefs.length; l++) {
172                                             EjbLocalRef localRef = localRefs[l];
173                                             err.log("EJB local ref: " + localRef);
174                                             String JavaDoc refLocal = localRef.getLocal();
175                                             if ((refLocal != null) && (refLocal.equals(name))) {
176                                                 RefactoringElementImplementation elem = new EjbJarRefLocalWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
177                                                 refactoringElements.add(refactoring, elem);
178                                             }
179                                             String JavaDoc refLocalHome = localRef.getLocalHome();
180                                             if ((refLocalHome != null) && (refLocalHome.equals(name))) {
181                                                 RefactoringElementImplementation elem = new EjbJarRefLocalHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
182                                                 refactoringElements.add(refactoring, elem);
183                                             }
184                                         }
185                                     }
186                                 }
187                             }
188
189                             /* Then entity beans */
190                             Entity [] entityBeans = eBeans.getEntity();
191                             err.log("Entity Beans: " + entityBeans);
192                             if ((entityBeans != null) && (entityBeans.length > 0)) {
193                                 for (int b=0; b < entityBeans.length; b++) {
194                                     Entity entBean = entityBeans[b];
195                                     err.log("Entity Bean: " + entBean);
196                                     String JavaDoc ejbClass = entBean.getEjbClass();
197                                     err.log("EJB Class: " + ejbClass);
198                                     if ((ejbClass != null) && (ejbClass.equals(name))) {
199                                         RefactoringElementImplementation elem = new EjbJarBeanClassWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
200                                         refactoringElements.add(refactoring, elem);
201                                     }
202                                     String JavaDoc ejbLocal = entBean.getLocal();
203                                     err.log("EJB Local: " + ejbLocal);
204                                     if ((ejbLocal != null) && (ejbLocal.equals(name))) {
205                                         RefactoringElementImplementation elem = new EjbJarLocalWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
206                                         refactoringElements.add(refactoring, elem);
207                                     }
208                                     String JavaDoc ejbLocalHome = entBean.getLocalHome();
209                                     err.log("EJB LocalHome: " + ejbLocalHome);
210                                     if ((ejbLocalHome != null) && (ejbLocalHome.equals(name))) {
211                                         RefactoringElementImplementation elem = new EjbJarLocalHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
212                                         refactoringElements.add(refactoring, elem);
213                                     }
214                                     String JavaDoc ejbHome = entBean.getHome();
215                                     err.log("EJB Home: " + ejbHome);
216                                     if ((ejbHome != null) && (ejbHome.equals(name))) {
217                                         RefactoringElementImplementation elem = new EjbJarHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
218                                         refactoringElements.add(refactoring, elem);
219                                     }
220                                     String JavaDoc ejbRemote = entBean.getRemote();
221                                     err.log("EJB Remote: " + ejbRemote);
222                                     if ((ejbRemote != null) && (ejbRemote.equals(name))) {
223                                         RefactoringElementImplementation elem = new EjbJarRemoteWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
224                                         refactoringElements.add(refactoring, elem);
225                                     }
226
227                                     // refs
228
EjbRef[] refs = entBean.getEjbRef();
229                                     if ((refs != null) && (refs.length > 0)) {
230                                         for (int l=0; l < refs.length; l++) {
231                                             EjbRef ref = refs[l];
232                                             err.log("EJB ref: " + ref);
233                                             String JavaDoc refHome = ref.getHome();
234                                             if ((refHome != null) && (refHome.equals(name))) {
235                                                 RefactoringElementImplementation elem = new EjbJarRefHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
236                                                 refactoringElements.add(refactoring, elem);
237                                             }
238                                             String JavaDoc refRemote = ref.getRemote();
239                                             if ((refRemote != null) && (refRemote.equals(name))) {
240                                                 RefactoringElementImplementation elem = new EjbJarRefRemoteWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
241                                                 refactoringElements.add(refactoring, elem);
242                                             }
243                                         }
244                                     }
245
246                                     // local refs
247
EjbLocalRef[] localRefs = entBean.getEjbLocalRef();
248                                     if ((localRefs != null) && (localRefs.length > 0)) {
249                                         for (int l=0; l < localRefs.length; l++) {
250                                             EjbLocalRef localRef = localRefs[l];
251                                             err.log("EJB local ref: " + localRef);
252                                             String JavaDoc refLocal = localRef.getLocal();
253                                             if ((refLocal != null) && (refLocal.equals(name))) {
254                                                 RefactoringElementImplementation elem = new EjbJarRefLocalWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
255                                                 refactoringElements.add(refactoring, elem);
256                                             }
257                                             String JavaDoc refLocalHome = localRef.getLocalHome();
258                                             if ((refLocalHome != null) && (refLocalHome.equals(name))) {
259                                                 RefactoringElementImplementation elem = new EjbJarRefLocalHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
260                                                 refactoringElements.add(refactoring, elem);
261                                             }
262                                         }
263                                     }
264                                 }
265                             }
266
267                             /* And finally message driven beans */
268                             MessageDriven [] messageBeans = eBeans.getMessageDriven();
269                             err.log("MessageDriven Beans: " + messageBeans);
270                             if ((messageBeans != null) && (messageBeans.length > 0)) {
271                                 for (int b=0; b < messageBeans.length; b++) {
272                                     MessageDriven msgBean = messageBeans[b];
273                                     err.log("MessageDriven Bean: " + msgBean);
274                                     String JavaDoc ejbClass = msgBean.getEjbClass();
275                                     err.log("EJB Class: " + ejbClass);
276                                     if ((ejbClass != null) && (ejbClass.equals(name))) {
277                                         RefactoringElementImplementation elem = new EjbJarBeanClassWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
278                                         refactoringElements.add(refactoring, elem);
279                                     }
280
281                                     // refs
282
EjbRef[] refs = msgBean.getEjbRef();
283                                     if ((refs != null) && (refs.length > 0)) {
284                                         for (int l=0; l < refs.length; l++) {
285                                             EjbRef ref = refs[l];
286                                             err.log("EJB ref: " + ref);
287                                             String JavaDoc refHome = ref.getHome();
288                                             if ((refHome != null) && (refHome.equals(name))) {
289                                                 RefactoringElementImplementation elem = new EjbJarRefHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
290                                                 refactoringElements.add(refactoring, elem);
291                                             }
292                                             String JavaDoc refRemote = ref.getRemote();
293                                             if ((refRemote != null) && (refRemote.equals(name))) {
294                                                 RefactoringElementImplementation elem = new EjbJarRefRemoteWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
295                                                 refactoringElements.add(refactoring, elem);
296                                             }
297                                         }
298                                     }
299
300                                     // local refs
301
EjbLocalRef[] localRefs = msgBean.getEjbLocalRef();
302                                     if ((localRefs != null) && (localRefs.length > 0)) {
303                                         for (int l=0; l < localRefs.length; l++) {
304                                             EjbLocalRef localRef = localRefs[l];
305                                             err.log("EJB local ref: " + localRef);
306                                             String JavaDoc refLocal = localRef.getLocal();
307                                             if ((refLocal != null) && (refLocal.equals(name))) {
308                                                 RefactoringElementImplementation elem = new EjbJarRefLocalWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
309                                                 refactoringElements.add(refactoring, elem);
310                                             }
311                                             String JavaDoc refLocalHome = localRef.getLocalHome();
312                                             if ((refLocalHome != null) && (refLocalHome.equals(name))) {
313                                                 RefactoringElementImplementation elem = new EjbJarRefLocalHomeWhereUsedRefactoringElement(ejbJarDD, name, ejbJarFO);
314                                                 refactoringElements.add(refactoring, elem);
315                                             }
316                                         }
317                                     }
318                                 }
319                             }
320
321                         } else {
322                             Problem newProblem = new Problem(false, NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarWhereUsedInvalidProblem"));
323                             problem = Utility.addProblemsToEnd(problem, newProblem);
324                         }
325                     } // find usages in ejb-jar.xml
326
}
327             }
328         } // javaclass
329

330         if (refObject instanceof Method) {
331             Method method = (Method)refObject;
332             FileObject fo = JavaModel.getFileObject(method.getResource());
333             Collection JavaDoc emodules = Utility.getRelevantEjbModules(method);
334             if ((emodules != null) && (emodules.size() > 0)) { // there are ejb modules that can be affected by the change
335
ClassDefinition jc = method.getDeclaringClass();
336                 err.log("classdefinition classDefinition: " + jc);
337                 if (jc instanceof JavaClass) {
338
339                     // update Assembly descriptor part
340
Iterator JavaDoc emIter = emodules.iterator();
341                     while (emIter.hasNext()) {
342                         org.netbeans.modules.j2ee.api.ejbjar.EjbJar em = (org.netbeans.modules.j2ee.api.ejbjar.EjbJar)emIter.next();
343                         if (em != null) { // the class is in an ejb module
344
FileObject ejbJarFO = em.getDeploymentDescriptor();
345                             EjbJar ejbJarDD = null;
346                             try {
347                                 ejbJarDD = org.netbeans.modules.j2ee.dd.api.ejb.DDProvider.getDefault().getMergedDDRoot(em.getMetadataUnit());
348                             } catch (IOException JavaDoc ioe) {
349                                 // ignore
350
}
351                             if ((ejbJarDD != null) && (ejbJarDD.getStatus()!=EjbJar.STATE_INVALID_UNPARSABLE) && ejbJarFO != null) {
352                                 AssemblyDescriptor asmDesc = ejbJarDD.getSingleAssemblyDescriptor();
353                                 err.log("asm desc: " + asmDesc);
354                                 
355                                 if (asmDesc != null) {
356                                     // container transaction part under assembly descriptor
357
ContainerTransaction[] contTx = asmDesc.getContainerTransaction();
358                                     if ((contTx != null) && (contTx.length > 0)) {
359                                         for (int c=0; c<contTx.length; c++) {
360                                             ContainerTransaction cTx = contTx[c];
361                                             err.log("ctx: " + cTx);
362                                             if (cTx != null) {
363                                                 org.netbeans.modules.j2ee.dd.api.ejb.Method[] mtds = cTx.getMethod();
364                                                 if ((mtds != null) && (mtds.length > 0)) {
365                                                     for (int m=0; m < mtds.length; m++) {
366                                                         org.netbeans.modules.j2ee.dd.api.ejb.Method mtd = mtds[m];
367                                                         err.log("mtd: " + mtd);
368                                                         String JavaDoc mtdName = mtd.getMethodName();
369                                                         err.log("mtdName: " + mtdName);
370                                                         if (mtdName.equals(method.getName())) {
371                                                             String JavaDoc invokedEjbName = mtd.getEjbName();
372                                                             err.log("invokedejb: " + invokedEjbName);
373                                                             String JavaDoc ejbName = Utility.getEjbNameForClass(ejbJarDD, jc);
374                                                             err.log("ejbname: " + ejbName);
375                                                             if (invokedEjbName.equals(ejbName)) {
376                                                                 RefactoringElementImplementation elem = new EjbJarContainerTxWhereUsedRefactoringElement(ejbJarDD, mtdName, ejbName, ejbJarFO);
377                                                                 refactoringElements.add(refactoring, elem);
378                                                             }
379                                                         }
380
381                                                     }
382                                                 }
383                                             }
384                                         }
385                                     }
386
387                                     // method permissions part under assembly descriptor
388
MethodPermission[] mtdPerms = asmDesc.getMethodPermission();
389                                     if ((mtdPerms != null) && (mtdPerms.length > 0)) {
390                                         for (int c=0; c<mtdPerms.length; c++) {
391                                             MethodPermission mtdPerm = mtdPerms[c];
392                                             err.log("mtdPerm: " + mtdPerm);
393                                             if (mtdPerm != null) {
394                                                 org.netbeans.modules.j2ee.dd.api.ejb.Method[] mtds = mtdPerm.getMethod();
395                                                 if ((mtds != null) && (mtds.length > 0)) {
396                                                     for (int m=0; m < mtds.length; m++) {
397                                                         org.netbeans.modules.j2ee.dd.api.ejb.Method mtd = mtds[m];
398                                                         err.log("mtd: " + mtd);
399                                                         String JavaDoc mtdName = mtd.getMethodName();
400                                                         err.log("mtdName: " + mtdName);
401                                                         if (mtdName.equals(method.getName())) {
402                                                             String JavaDoc invokedEjbName = mtd.getEjbName();
403                                                             err.log("invokedejb: " + invokedEjbName);
404                                                             String JavaDoc ejbName = Utility.getEjbNameForClass(ejbJarDD, jc);
405                                                             err.log("ejbname: " + ejbName);
406                                                             if (invokedEjbName.equals(ejbName)) {
407                                                                 RefactoringElementImplementation elem = new EjbJarMethodPermissionWhereUsedRefactoringElement(ejbJarDD, mtdName, ejbName, ejbJarFO);
408                                                                 refactoringElements.add(refactoring, elem);
409                                                             }
410                                                         }
411
412                                                     }
413                                                 }
414                                             }
415                                         }
416                                     }
417
418                                     // exclude list part under assembly descriptor
419
ExcludeList excList = asmDesc.getExcludeList();
420                                     err.log("excList: " + excList);
421                                     if (excList != null) {
422                                         org.netbeans.modules.j2ee.dd.api.ejb.Method[] mtds = excList.getMethod();
423                                         if ((mtds != null) && (mtds.length > 0)) {
424                                             for (int m=0; m < mtds.length; m++) {
425                                                 org.netbeans.modules.j2ee.dd.api.ejb.Method mtd = mtds[m];
426                                                 err.log("mtd: " + mtd);
427                                                 String JavaDoc mtdName = mtd.getMethodName();
428                                                 err.log("mtdName: " + mtdName);
429                                                 if (mtdName.equals(method.getName())) {
430                                                     String JavaDoc invokedEjbName = mtd.getEjbName();
431                                                     err.log("invokedejb: " + invokedEjbName);
432                                                     String JavaDoc ejbName = Utility.getEjbNameForClass(ejbJarDD, jc);
433                                                     err.log("ejbname: " + ejbName);
434                                                     if (invokedEjbName.equals(ejbName)) {
435                                                         RefactoringElementImplementation elem = new EjbJarExcludeListWhereUsedRefactoringElement(ejbJarDD, mtdName, ejbName, ejbJarFO);
436                                                         refactoringElements.add(refactoring, elem);
437                                                     }
438                                                 }
439
440                                             }
441                                         }
442                                     }
443                                 }
444                             
445                             } else {
446                                 Problem newProblem = new Problem(false, NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarWhereUsedInvalidProblem"));
447                                 problem = Utility.addProblemsToEnd(problem, newProblem);
448                             }
449                         }
450                         
451                     }
452                     
453                     // method in SESSION BEAN IMPL CLASS
454
JavaClass javaClass = (JavaClass)JavaModel.getDefaultExtent().getType().resolve(Utility.SESSION_BEAN);
455                     err.log("javaclass: " + javaClass);
456                     if (!(javaClass instanceof UnresolvedClass)) {
457                         if (jc.isSubTypeOf(javaClass)) {
458                             Method homeInHome = Utility.getHomeHomeMethodForSessionImplHomeMethod(method, fo, jc.getName(), false /*not local*/);
459                             Method homeInLocalHome = Utility.getHomeHomeMethodForSessionImplHomeMethod(method, fo, jc.getName(), true /*local*/);
460                             if (homeInHome != null) {
461                                 WhereUsedQuery whereHomeInHome = new WhereUsedQuery(homeInHome);
462                                 Problem p = whereHomeInHome.prepare(session);
463                                 problem = Utility.addProblemsToEnd(problem, p);
464                             }
465                             if (homeInLocalHome != null) {
466                                 WhereUsedQuery whereHomeInLocalHome = new WhereUsedQuery(homeInLocalHome);
467                                 Problem p = whereHomeInLocalHome.prepare(session);
468                                 problem = Utility.addProblemsToEnd(problem, p);
469                             }
470                             
471                             return problem;
472                         }
473                     }
474                     
475                     // method in ENTITY BEANS IMPL CLASS
476
javaClass = (JavaClass)JavaModel.getDefaultExtent().getType().resolve(Utility.ENTITY_BEAN);
477                     err.log("javaclass: " + javaClass);
478                     if (!(javaClass instanceof UnresolvedClass)) {
479                         // first check if we are trying to rename a method from javax.ejb.EntityBean interface, and do not allow this
480
if (jc.isSubTypeOf(javaClass)) {
481                             
482                             // next check if we are trying to find some finder method finders in home/localhome need to be found, too
483
Method finderInHome = Utility.getHomeFinderMethodForImplFinderMethod(method, fo, jc.getName(), false /*not local*/);
484                             Method finderInLocalHome = Utility.getHomeFinderMethodForImplFinderMethod(method, fo, jc.getName(), true /*local*/);
485                             if (finderInHome != null) {
486                                 WhereUsedQuery whereFinderInHome = new WhereUsedQuery(finderInHome);
487                                 Problem p = whereFinderInHome.prepare(session);
488                                 problem = Utility.addProblemsToEnd(problem, p);
489                             }
490                             if (finderInLocalHome != null) {
491                                 WhereUsedQuery whereFinderInLocalHome = new WhereUsedQuery(finderInLocalHome);
492                                 Problem p = whereFinderInLocalHome.prepare(session);
493                                 problem = Utility.addProblemsToEnd(problem, p);
494                             }
495
496                             Method homeInHome = Utility.getHomeHomeMethodForSessionImplHomeMethod(method, fo, jc.getName(), false /*not local*/);
497                             Method homeInLocalHome = Utility.getHomeHomeMethodForSessionImplHomeMethod(method, fo, jc.getName(), true /*local*/);
498                             if (homeInHome != null) {
499                                 WhereUsedQuery whereHomeInHome = new WhereUsedQuery(homeInHome);
500                                 Problem p = whereHomeInHome.prepare(session);
501                                 problem = Utility.addProblemsToEnd(problem, p);
502                             }
503                             if (homeInLocalHome != null) {
504                                 WhereUsedQuery whereHomeInLocalHome = new WhereUsedQuery(homeInLocalHome);
505                                 Problem p = whereHomeInLocalHome.prepare(session);
506                                 problem = Utility.addProblemsToEnd(problem, p);
507                             }
508
509                             if (method.getName().startsWith("ejbSelect")) { // NOI18N
510
Project prj = FileOwnerQuery.getOwner(fo);
511                                 if (prj != null) {
512                                     org.netbeans.modules.j2ee.api.ejbjar.EjbJar emod =
513                                             org.netbeans.modules.j2ee.api.ejbjar.EjbJar.getEjbJar(prj.getProjectDirectory());
514                                     Entity[] eBeans = Utility.getEntityBeans(emod);
515                                     EjbJar ejbJarDD = Utility.getEjbJar(emod);
516                                     if ((eBeans != null) && (ejbJarDD != null)) {
517                                         for (int e = 0; e < eBeans.length; e++) {
518                                             Entity entity = eBeans[e];
519                                             String JavaDoc ejbClass = entity.getEjbClass();
520                                             if (jc.getName().equals(ejbClass)) {
521                                                 Query[] queries = entity.getQuery();
522                                                 for (int q = 0; q < queries.length; q++) {
523                                                     Query query = queries[q];
524                                                     QueryMethod qm = query.getQueryMethod();
525                                                     err.log("query method: " + qm);
526                                                     if (method.getName().equals(qm.getMethodName())) {
527                                                         RefactoringElementImplementation elem =
528                                                                 new EjbJarSelectMethodWhereUsedRefactoringElement(
529                                                                         ejbJarDD, method.getName(),
530                                                                         emod.getDeploymentDescriptor());
531                                                         refactoringElements.add(refactoring, elem);
532                                                     }
533                                                 }
534                                             }
535                                         }
536                                     }
537                                 }
538                             }
539
540                             return problem;
541                         }
542                     }
543
544                     // HOME INTERFACE CLASS
545
javaClass = (JavaClass)JavaModel.getDefaultExtent().getType().resolve(Utility.EJB_HOME);
546                     err.log("javaclass: " + javaClass);
547                     if (!(javaClass instanceof UnresolvedClass)) {
548                         if (jc.isSubTypeOf(javaClass)) {
549
550                             // next check if we are trying to rename some finder method - this is allowed with some restrictions and finders in implclass/localhome need to be renamed, too
551
Method finderInImpl = Utility.getImplFinderMethodForHomeFinderMethod(method, fo, jc.getName(), false /*not local*/);
552                             Method finderInLocalHome = Utility.getHomeFinderMethodForHomeFinderMethod(method, fo, jc.getName(), true /*local*/);
553                             if (finderInImpl != null) {
554                                 WhereUsedQuery renameFinderInImpl = new WhereUsedQuery(finderInImpl);
555                                 Problem p = renameFinderInImpl.prepare(session);
556                                 problem = Utility.addProblemsToEnd(problem, p);
557                             }
558                             if (finderInLocalHome != null) {
559                                 WhereUsedQuery renameFinderInLocalHome = new WhereUsedQuery(finderInLocalHome);
560                                 Problem p = renameFinderInLocalHome.prepare(session);
561                                 problem = Utility.addProblemsToEnd(problem, p);
562                             }
563                             Project prj = FileOwnerQuery.getOwner(fo);
564                             if (prj != null) {
565                                 org.netbeans.modules.j2ee.api.ejbjar.EjbJar emod = org.netbeans.modules.j2ee.api.ejbjar.EjbJar.getEjbJar(prj.getProjectDirectory());
566                                 Entity[] eBeans = Utility.getEntityBeans(emod);
567                                 EjbJar ejbJarDD = Utility.getEjbJar(emod);
568                                 if ((eBeans != null) && (ejbJarDD != null)) {
569                                     for (int e=0; e < eBeans.length; e++) {
570                                         Entity entity = eBeans[e];
571                                         String JavaDoc ejbClass = entity.getHome();
572                                         if (jc.getName().equals(ejbClass)) {
573                                             Query[] queries = entity.getQuery();
574                                             for (int q=0; q<queries.length; q++) {
575                                                 Query query = queries[q];
576                                                 QueryMethod qm = query.getQueryMethod();
577                                                 err.log("query method: " + qm);
578                                                 if (method.getName().equals(qm.getMethodName())) {
579                                                     RefactoringElementImplementation elem =
580                                                             new EjbJarFinderMethodWhereUsedRefactoringElement(ejbJarDD, method.getName(), emod.getDeploymentDescriptor());
581                                                     refactoringElements.add(refactoring, elem);
582                                                 }
583                                             }
584                                         }
585                                     }
586                                 }
587                             }
588
589                             // next check if we are trying to rename some home method - this is allowed with some restrictions and homes in implclass/localhome need to be renamed, too
590
Method homeInImpl = Utility.getImplHomeMethodForHomeHomeMethod(method, fo, jc.getName(), false /*not local*/);
591                             Method homeInLocalHome = Utility.getHomeHomeMethodForHomeHomeMethod(method, fo, jc.getName(), true /*local*/);
592                             if (homeInImpl != null) {
593                                 WhereUsedQuery renameHomeInImpl = new WhereUsedQuery(homeInImpl);
594                                 Problem p = renameHomeInImpl.prepare(session);
595                                 problem = Utility.addProblemsToEnd(problem, p);
596                             }
597                             if (homeInLocalHome != null) {
598                                 WhereUsedQuery renameHomeInLocalHome = new WhereUsedQuery(homeInLocalHome);
599                                 Problem p = renameHomeInLocalHome.prepare(session);
600                                 problem = Utility.addProblemsToEnd(problem, p);
601                             }
602                             return problem;
603                         }
604                     }
605
606                     // LOCAL HOME INTERFACE CLASS
607
javaClass = (JavaClass)JavaModel.getDefaultExtent().getType().resolve(Utility.EJB_LOCAL_HOME);
608                     err.log("javaclass: " + javaClass);
609                     if (!(javaClass instanceof UnresolvedClass)) {
610                         if (jc.isSubTypeOf(javaClass)) {
611                             
612                             Method finderInImpl = Utility.getImplFinderMethodForHomeFinderMethod(method, fo, jc.getName(), true /*local*/);
613                             Method finderInHome = Utility.getHomeFinderMethodForHomeFinderMethod(method, fo, jc.getName(), false /*not local*/);
614                             if (finderInImpl != null) {
615                                 WhereUsedQuery renameFinderInImpl = new WhereUsedQuery(finderInImpl);
616                                 Problem p = renameFinderInImpl.prepare(session);
617                                 problem = Utility.addProblemsToEnd(problem, p);
618                             }
619                             if (finderInHome != null) {
620                                 WhereUsedQuery renameFinderInHome = new WhereUsedQuery(finderInHome);
621                                 Problem p = renameFinderInHome.prepare(session);
622                                 problem = Utility.addProblemsToEnd(problem, p);
623                             }
624
625                             Project prj = FileOwnerQuery.getOwner(fo);
626                             if (prj != null) {
627                                 org.netbeans.modules.j2ee.api.ejbjar.EjbJar emod = org.netbeans.modules.j2ee.api.ejbjar.EjbJar.getEjbJar(prj.getProjectDirectory());
628                                 Entity[] eBeans = Utility.getEntityBeans(emod);
629                                 EjbJar ejbJarDD = Utility.getEjbJar(emod);
630                                 if ((eBeans != null) && (ejbJarDD != null)) {
631                                     for (int e=0; e < eBeans.length; e++) {
632                                         Entity entity = eBeans[e];
633                                         String JavaDoc ejbClass = entity.getLocalHome();
634                                         if (jc.getName().equals(ejbClass)) {
635                                             Query[] queries = entity.getQuery();
636                                             for (int q=0; q<queries.length; q++) {
637                                                 Query query = queries[q];
638                                                 QueryMethod qm = query.getQueryMethod();
639                                                 err.log("query method: " + qm);
640                                                 if (method.getName().equals(qm.getMethodName())) {
641                                                     RefactoringElementImplementation elem =
642                                                             new EjbJarFinderMethodWhereUsedRefactoringElement(ejbJarDD, method.getName(), emod.getDeploymentDescriptor());
643                                                     refactoringElements.add(refactoring, elem);
644                                                 }
645                                             }
646                                         }
647                                     }
648                                 }
649                             }
650                             
651                             // next check if we are trying to rename some home method - this is allowed with some restrictions and homes in implclass/home need to be renamed, too
652
Method homeInImpl = Utility.getImplHomeMethodForHomeHomeMethod(method, fo, jc.getName(), true /*not local*/);
653                             Method homeInHome = Utility.getHomeHomeMethodForHomeHomeMethod(method, fo, jc.getName(), false /*local*/);
654                             if (homeInImpl != null) {
655                                 WhereUsedQuery renameHomeInImpl = new WhereUsedQuery(homeInImpl);
656                                 Problem p = renameHomeInImpl.prepare(session);
657                                 problem = Utility.addProblemsToEnd(problem, p);
658                             }
659                             if (homeInHome != null) {
660                                 WhereUsedQuery renameHomeInHome = new WhereUsedQuery(homeInHome);
661                                 Problem p = renameHomeInHome.prepare(session);
662                                 problem = Utility.addProblemsToEnd(problem, p);
663                             }
664                             return problem;
665                         }
666                     }
667                 }
668             }
669             
670         } // method
671

672         return problem;
673     }
674
675     public final class EjbJarBeanClassWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
676
677         protected EjbJar ejbJarDD;
678
679         /** Creates a new instance of EjbJarBeanWhereUsedRefactoringElement */
680         public EjbJarBeanClassWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
681             this.ejbJarDD = ejbJarDD;
682             this.name = name;
683             this.parentFile = parentFile;
684         }
685
686         /** Returns text describing the refactoring formatted for display (using HTML tags).
687          * @return Formatted text.
688          */

689         public String JavaDoc getDisplayText() {
690             Object JavaDoc[] args = new Object JavaDoc [] {name};
691             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarBeanClassWhereUsed"), args);
692         }
693     }
694     
695     public final class EjbJarLocalWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
696
697         protected EjbJar ejbJarDD;
698
699         /** Creates a new instance of EjbJarBeanWhereUsedRefactoringElement */
700         public EjbJarLocalWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
701             this.ejbJarDD = ejbJarDD;
702             this.name = name;
703             this.parentFile = parentFile;
704         }
705
706         /** Returns text describing the refactoring formatted for display (using HTML tags).
707          * @return Formatted text.
708          */

709         public String JavaDoc getDisplayText() {
710             Object JavaDoc[] args = new Object JavaDoc [] {name};
711             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarLocalWhereUsed"), args);
712         }
713     }
714
715     public final class EjbJarLocalHomeWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
716
717         protected EjbJar ejbJarDD;
718
719         /** Creates a new instance of EjbJarLocalHomeWhereUsedRefactoringElement */
720         public EjbJarLocalHomeWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
721             this.ejbJarDD = ejbJarDD;
722             this.name = name;
723             this.parentFile = parentFile;
724         }
725
726         /** Returns text describing the refactoring formatted for display (using HTML tags).
727          * @return Formatted text.
728          */

729         public String JavaDoc getDisplayText() {
730             Object JavaDoc[] args = new Object JavaDoc [] {name};
731             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarLocalHomeWhereUsed"), args);
732         }
733     }
734     
735     public final class EjbJarHomeWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
736
737         protected EjbJar ejbJarDD;
738
739         /** Creates a new instance of EjbJarLocalHomeWhereUsedRefactoringElement */
740         public EjbJarHomeWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
741             this.ejbJarDD = ejbJarDD;
742             this.name = name;
743             this.parentFile = parentFile;
744         }
745
746         /** Returns text describing the refactoring formatted for display (using HTML tags).
747          * @return Formatted text.
748          */

749         public String JavaDoc getDisplayText() {
750             Object JavaDoc[] args = new Object JavaDoc [] {name};
751             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarHomeWhereUsed"), args);
752         }
753     }
754
755     public final class EjbJarRemoteWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
756
757         protected EjbJar ejbJarDD;
758
759         /** Creates a new instance of EjbJarRemoteWhereUsedRefactoringElement */
760         public EjbJarRemoteWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
761             this.ejbJarDD = ejbJarDD;
762             this.name = name;
763             this.parentFile = parentFile;
764         }
765
766         /** Returns text describing the refactoring formatted for display (using HTML tags).
767          * @return Formatted text.
768          */

769         public String JavaDoc getDisplayText() {
770             Object JavaDoc[] args = new Object JavaDoc [] {name};
771             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarRemoteWhereUsed"), args);
772         }
773     }
774
775     public final class EjbJarServiceEndpointWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
776
777         protected EjbJar ejbJarDD;
778
779         /** Creates a new instance of EjbJarServiceEndpointWhereUsedRefactoringElement */
780         public EjbJarServiceEndpointWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
781             this.ejbJarDD = ejbJarDD;
782             this.name = name;
783             this.parentFile = parentFile;
784         }
785
786         /** Returns text describing the refactoring formatted for display (using HTML tags).
787          * @return Formatted text.
788          */

789         public String JavaDoc getDisplayText() {
790             Object JavaDoc[] args = new Object JavaDoc [] {name};
791             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarServiceEndpointWhereUsed"), args);
792         }
793     }
794     
795     public final class EjbJarRefLocalWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
796
797         protected EjbJar ejbJarDD;
798
799         /** Creates a new instance of EjbJarRefLocalWhereUsedRefactoringElement */
800         public EjbJarRefLocalWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
801             this.ejbJarDD = ejbJarDD;
802             this.name = name;
803             this.parentFile = parentFile;
804         }
805
806         /** Returns text describing the refactoring formatted for display (using HTML tags).
807          * @return Formatted text.
808          */

809         public String JavaDoc getDisplayText() {
810             Object JavaDoc[] args = new Object JavaDoc [] {name};
811             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarRefLocalWhereUsed"), args);
812         }
813     }
814     
815     public final class EjbJarRefLocalHomeWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
816
817         protected EjbJar ejbJarDD;
818
819         /** Creates a new instance of EjbJarRefLocalHomeWhereUsedRefactoringElement */
820         public EjbJarRefLocalHomeWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
821             this.ejbJarDD = ejbJarDD;
822             this.name = name;
823             this.parentFile = parentFile;
824         }
825
826         /** Returns text describing the refactoring formatted for display (using HTML tags).
827          * @return Formatted text.
828          */

829         public String JavaDoc getDisplayText() {
830             Object JavaDoc[] args = new Object JavaDoc [] {name};
831             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarRefLocalHomeWhereUsed"), args);
832         }
833     }
834
835     public final class EjbJarRefHomeWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
836
837         protected EjbJar ejbJarDD;
838
839         /** Creates a new instance of EjbJarRefHomeWhereUsedRefactoringElement */
840         public EjbJarRefHomeWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
841             this.ejbJarDD = ejbJarDD;
842             this.name = name;
843             this.parentFile = parentFile;
844         }
845
846         /** Returns text describing the refactoring formatted for display (using HTML tags).
847          * @return Formatted text.
848          */

849         public String JavaDoc getDisplayText() {
850             Object JavaDoc[] args = new Object JavaDoc [] {name};
851             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarRefHomeWhereUsed"), args);
852         }
853     }
854
855     public final class EjbJarRefRemoteWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
856
857         protected EjbJar ejbJarDD;
858
859         /** Creates a new instance of EjbJarRefRemoteWhereUsedRefactoringElement */
860         public EjbJarRefRemoteWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
861             this.ejbJarDD = ejbJarDD;
862             this.name = name;
863             this.parentFile = parentFile;
864         }
865
866         /** Returns text describing the refactoring formatted for display (using HTML tags).
867          * @return Formatted text.
868          */

869         public String JavaDoc getDisplayText() {
870             Object JavaDoc[] args = new Object JavaDoc [] {name};
871             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarRefRemoteWhereUsed"), args);
872         }
873     }
874     
875     public final class EjbJarFinderMethodWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
876
877         protected EjbJar ejbJarDD;
878
879         /** Creates a new instance of EjbJarFinderMethodWhereUsedRefactoringElement */
880         public EjbJarFinderMethodWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
881             this.ejbJarDD = ejbJarDD;
882             this.name = name;
883             this.parentFile = parentFile;
884         }
885
886         /** Returns text describing the refactoring formatted for display (using HTML tags).
887          * @return Formatted text.
888          */

889         public String JavaDoc getDisplayText() {
890             Object JavaDoc[] args = new Object JavaDoc [] {name};
891             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarFinderMethodWhereUsed"), args);
892         }
893     }
894     
895     public final class EjbJarSelectMethodWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
896
897         protected EjbJar ejbJarDD;
898
899         /** Creates a new instance of EjbJarSelectMethodWhereUsedRefactoringElement */
900         public EjbJarSelectMethodWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc name, FileObject parentFile) {
901             this.ejbJarDD = ejbJarDD;
902             this.name = name;
903             this.parentFile = parentFile;
904         }
905
906         /** Returns text describing the refactoring formatted for display (using HTML tags).
907          * @return Formatted text.
908          */

909         public String JavaDoc getDisplayText() {
910             Object JavaDoc[] args = new Object JavaDoc [] {name};
911             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarSelectMethodWhereUsed"), args);
912         }
913     }
914
915     public final class EjbJarContainerTxWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
916
917         protected EjbJar ejbJarDD;
918         protected String JavaDoc ejbName;
919
920         /** Creates a new instance of EjbJarContainerTxWhereUsedRefactoringElement */
921         public EjbJarContainerTxWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc mtdName, String JavaDoc ejbName, FileObject parentFile) {
922             this.ejbJarDD = ejbJarDD;
923             this.name = mtdName;
924             this.ejbName = ejbName;
925             this.parentFile = parentFile;
926         }
927
928         /** Returns text describing the refactoring formatted for display (using HTML tags).
929          * @return Formatted text.
930          */

931         public String JavaDoc getDisplayText() {
932             Object JavaDoc[] args = new Object JavaDoc [] {name, ejbName};
933             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarContainerTxMethodWhereUsed"), args);
934         }
935     }
936
937     public final class EjbJarExcludeListWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
938
939         protected EjbJar ejbJarDD;
940         protected String JavaDoc ejbName;
941
942         /** Creates a new instance of EjbJarExcludeListWhereUsedRefactoringElement */
943         public EjbJarExcludeListWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc mtdName, String JavaDoc ejbName, FileObject parentFile) {
944             this.ejbJarDD = ejbJarDD;
945             this.name = mtdName;
946             this.ejbName = ejbName;
947             this.parentFile = parentFile;
948         }
949
950         /** Returns text describing the refactoring formatted for display (using HTML tags).
951          * @return Formatted text.
952          */

953         public String JavaDoc getDisplayText() {
954             Object JavaDoc[] args = new Object JavaDoc [] {name, ejbName};
955             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarExcludeListMethodWhereUsed"), args);
956         }
957     }
958
959     public final class EjbJarMethodPermissionWhereUsedRefactoringElement extends AbstractWhereUsedRefactoringElement {
960
961         protected EjbJar ejbJarDD;
962         protected String JavaDoc ejbName;
963
964         /** Creates a new instance of EjbJarMethodPermissionWhereUsedRefactoringElement */
965         public EjbJarMethodPermissionWhereUsedRefactoringElement(EjbJar ejbJarDD, String JavaDoc mtdName, String JavaDoc ejbName, FileObject parentFile) {
966             this.ejbJarDD = ejbJarDD;
967             this.name = mtdName;
968             this.ejbName = ejbName;
969             this.parentFile = parentFile;
970         }
971
972         /** Returns text describing the refactoring formatted for display (using HTML tags).
973          * @return Formatted text.
974          */

975         public String JavaDoc getDisplayText() {
976             Object JavaDoc[] args = new Object JavaDoc [] {name, ejbName};
977             return MessageFormat.format(NbBundle.getMessage(EjbJarWhereUsedRefactoring.class, "TXT_EjbJarMethodPermissionMethodWhereUsed"), args);
978         }
979     }
980     
981 }
982
Popular Tags