Remote remoteBusAnn = (Remote) ejbClass.getAnnotation(Remote.class);
boolean emptyRemoteBusAnn = false;
if( remoteBusAnn != null ) {
for(Class next : remoteBusAnn.value()) {
if (next.getAnnotation(Local.class) != null) {
AnnotationProcessorException fatalException =
new AnnotationProcessorException(localStrings.getLocalString(
"enterprise.deployment.annotation.handlers.invalidbusinessinterface",
"The interface {0} cannot be both a local and a remote business interface.",
new Object[]{next.getName()}));
fatalException.setFatal(true);
throw fatalException;
}
clientInterfaces.add(next);
remoteBusIntfs.add(next);
}
emptyRemoteBusAnn = remoteBusIntfs.isEmpty();
}
Local localBusAnn = (Local) ejbClass.getAnnotation(Local.class);
if( localBusAnn != null ) {
for(Class next : localBusAnn.value()) {
if (next.getAnnotation(Remote.class) != null) {
AnnotationProcessorException fatalException =
new AnnotationProcessorException(localStrings.getLocalString(
"enterprise.deployment.annotation.handlers.invalidbusinessinterface",
"The interface {0} cannot be both a local and a remote business interface.",
new Object[]{next.getName()}));
fatalException.setFatal(true);
throw fatalException;
}
clientInterfaces.add(next);
localBusIntfs.add(next);
}
}
List<Class> imlementingInterfaces = new ArrayList<Class>();
List<Class> implementedDesignatedInterfaces = new ArrayList<Class>();
for(Class next : ejbClass.getInterfaces()) {
if( !excludedFromImplementsClause(next) ) {
if( next.getAnnotation(Local.class) != null || next.getAnnotation(Remote.class) != null ) {
implementedDesignatedInterfaces.add(next);
}
imlementingInterfaces.add(next);
}
}
LocalBean localBeanAnn = (LocalBean) ejbClass.getAnnotation(LocalBean.class);
if( localBeanAnn != null ) {
ejbDesc.setLocalBean(true);
}
// total number of local/remote business interfaces declared
// outside of the implements clause plus implemented designated interfaces
int designatedInterfaceCount =
remoteBusIntfs.size() + localBusIntfs.size() +
ejbDesc.getRemoteBusinessClassNames().size() +
ejbDesc.getLocalBusinessClassNames().size() +
implementedDesignatedInterfaces.size();
for(Class next : imlementingInterfaces) {
String nextIntfName = next.getName();
if( remoteBusIntfs.contains(next)
||
localBusIntfs.contains(next)
||
ejbDesc.getRemoteBusinessClassNames().contains(nextIntfName)
||
ejbDesc.getLocalBusinessClassNames().contains(nextIntfName)){
// Interface has already been identified as a Remote/Local
// business interface, so ignore.
} else if( next.getAnnotation(Local.class) != null ) {
clientInterfaces.add(next);
localBusIntfs.add(next);
} else if( next.getAnnotation(Remote.class) != null ) {
clientInterfaces.add(next);
remoteBusIntfs.add(next);
} else {
if( (designatedInterfaceCount == 0) &&
(!ejbDesc.isLocalBean()) ) {
// If there's an empty @Remote annotation on the class,
// it's treated as a remote business interface. Otherwise,
// it's treated as a local business interface.
if( emptyRemoteBusAnn ) {
remoteBusIntfs.add(next);
} else {
localBusIntfs.add(next);
}
clientInterfaces.add(next);
} else {
// Since the component has at least one other business
// interface, each implements clause interface that cannot
// be identified as business interface via the deployment
// descriptor or a @Remote/@Local annotation is ignored.
}
}
}
for (Class next : clientInterfaces) {
if (remoteBusIntfs.contains(next) && localBusIntfs.contains(next)) {
AnnotationProcessorException fatalException =
new AnnotationProcessorException(localStrings.getLocalString(
"enterprise.deployment.annotation.handlers.invalidbusinessinterface",
"The interface {0} cannot be both a local and a remote business interface.",
new Object[]{next.getName()}));
fatalException.setFatal(true);
throw fatalException;
}
}
if (localBusIntfs.size() > 0) {