|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2023 Contributors to the Eclipse Foundation |
| 2 | + * Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation. |
3 | 3 | * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
|
4 | 4 | *
|
5 | 5 | * This program and the accompanying materials are made available under the
|
@@ -332,6 +332,7 @@ protected HandlerProcessingResult setBusinessAndHomeInterfaces(
|
332 | 332 |
|
333 | 333 | Remote remoteBusAnn = (Remote) ejbClass.getAnnotation(Remote.class);
|
334 | 334 | boolean emptyRemoteBusAnn = false;
|
| 335 | + boolean emptyLocalBusAnn = false; |
335 | 336 | if( remoteBusAnn != null ) {
|
336 | 337 | for(Class next : remoteBusAnn.value()) {
|
337 | 338 | if (next.getAnnotation(Local.class) != null) {
|
@@ -364,6 +365,7 @@ protected HandlerProcessingResult setBusinessAndHomeInterfaces(
|
364 | 365 | clientInterfaces.add(next);
|
365 | 366 | localBusIntfs.add(next);
|
366 | 367 | }
|
| 368 | + emptyLocalBusAnn = localBusIntfs.isEmpty(); |
367 | 369 | }
|
368 | 370 |
|
369 | 371 | List<Class> imlementingInterfaces = new ArrayList<>();
|
@@ -393,50 +395,45 @@ protected HandlerProcessingResult setBusinessAndHomeInterfaces(
|
393 | 395 | for(Class next : imlementingInterfaces) {
|
394 | 396 | String nextIntfName = next.getName();
|
395 | 397 |
|
396 |
| - if( remoteBusIntfs.contains(next) |
397 |
| - || |
398 |
| - localBusIntfs.contains(next) |
399 |
| - || |
400 |
| - ejbDesc.getRemoteBusinessClassNames().contains(nextIntfName) |
401 |
| - || |
402 |
| - ejbDesc.getLocalBusinessClassNames().contains(nextIntfName)){ |
403 |
| - |
| 398 | + if (remoteBusIntfs.contains(next) || localBusIntfs.contains(next) |
| 399 | + || ejbDesc.getRemoteBusinessClassNames().contains(nextIntfName) |
| 400 | + || ejbDesc.getLocalBusinessClassNames().contains(nextIntfName)) { |
404 | 401 | // Interface has already been identified as a Remote/Local
|
405 | 402 | // business interface, so ignore.
|
| 403 | + continue; |
| 404 | + } |
406 | 405 |
|
407 |
| - } else if( next.getAnnotation(Local.class) != null ) { |
408 |
| - |
409 |
| - clientInterfaces.add(next); |
410 |
| - localBusIntfs.add(next); |
411 |
| - |
412 |
| - } else if( next.getAnnotation(Remote.class) != null ) { |
| 406 | + boolean isLocal = next.isAnnotationPresent(Local.class); |
| 407 | + boolean isRemote = next.isAnnotationPresent(Remote.class); |
413 | 408 |
|
| 409 | + if (isLocal || isRemote) { |
| 410 | + if (isLocal) { |
| 411 | + localBusIntfs.add(next); |
| 412 | + } |
| 413 | + if (isRemote) { |
| 414 | + remoteBusIntfs.add(next); |
| 415 | + } |
414 | 416 | clientInterfaces.add(next);
|
415 |
| - remoteBusIntfs.add(next); |
416 |
| - |
417 |
| - } else { |
418 |
| - |
419 |
| - if( (designatedInterfaceCount == 0) && |
420 |
| - (!ejbDesc.isLocalBean()) ) { |
| 417 | + continue; |
| 418 | + } |
421 | 419 |
|
422 |
| - // If there's an empty @Remote annotation on the class, |
423 |
| - // it's treated as a remote business interface. Otherwise, |
424 |
| - // it's treated as a local business interface. |
425 |
| - if( emptyRemoteBusAnn ) { |
| 420 | + if (designatedInterfaceCount == 0 && !ejbDesc.isLocalBean()) { |
| 421 | + // If there's an empty @Remote annotation on the class |
| 422 | + // it's treated as a remote business interface. |
| 423 | + // If there's an empty @Local annotation on the class or if |
| 424 | + // the bean class is annotated with neither the @Local nor the |
| 425 | + // @Remote annotation, it's treated as a local business interface. |
| 426 | + if (emptyLocalBusAnn || emptyRemoteBusAnn) { |
| 427 | + if (emptyRemoteBusAnn) { |
426 | 428 | remoteBusIntfs.add(next);
|
427 |
| - } else { |
| 429 | + } |
| 430 | + if (emptyLocalBusAnn) { |
428 | 431 | localBusIntfs.add(next);
|
429 | 432 | }
|
430 |
| - clientInterfaces.add(next); |
431 |
| - |
432 | 433 | } else {
|
433 |
| - |
434 |
| - // Since the component has at least one other business |
435 |
| - // interface, each implements clause interface that cannot |
436 |
| - // be identified as business interface via the deployment |
437 |
| - // descriptor or a @Remote/@Local annotation is ignored. |
438 |
| - |
| 434 | + localBusIntfs.add(next); |
439 | 435 | }
|
| 436 | + clientInterfaces.add(next); |
440 | 437 | }
|
441 | 438 | }
|
442 | 439 |
|
|
0 commit comments