// Initialize issue used in Error Message
String issue = "[" + ErrorCodes.ERROR_CODE_EJBTHREE1025 + "]";
// Obtain annotations, if found
Local local = (Local) resolveAnnotation(Local.class);
Remote remote = (Remote) resolveAnnotation(Remote.class);
// If either local or remote is unspecified, return safely - there can be no overlap
if (local == null || remote == null)
{
return;
}
// Ensure "value" attribute of both local and remote are not blank
if (local.value().length < 1 && local.value().length < 1)
{
throw new EJBException("Cannot designate both " + Local.class.getName() + " and " + Remote.class.getName()
+ " annotations without 'value' attribute on " + this.getEjbName() + ". " + issue);
}
// Iterate through local and remote interfaces, ensuring any one interface is not being used for both local and remote exposure
for (Class<?> localClass : local.value())
{
for (Class<?> remoteClass : remote.value())
{
if (localClass.equals(remoteClass))
{
throw new EJBException("Cannot designate " + localClass.getName() + " as both " + Local.class.getName()
+ " and " + Remote.class.getName() + " on " + this.getEjbName() + ". " + issue);