throw new IllegalStateException("Operation not allowed");
}
T businessObject = null;
EjbDescriptor ejbDesc = container.getEjbDescriptor();
if( businessInterface != null ) {
String intfName = businessInterface.getName();
if( (ejbLocalBusinessObjectImpl != null) &&
ejbDesc.getLocalBusinessClassNames().contains(intfName) ) {
// Get proxy corresponding to this business interface.
businessObject = (T) ejbLocalBusinessObjectImpl
.getClientObject(intfName);
} else if( (ejbRemoteBusinessObjectImpl != null) &&
ejbDesc.getRemoteBusinessClassNames().contains(intfName)) {
// Create a new client object from the stub for this
// business interface.
String generatedIntf =
EJBUtils.getGeneratedRemoteIntfName(intfName);
java.rmi.Remote stub =
ejbRemoteBusinessObjectImpl.getStub(generatedIntf);
try {
businessObject = (T) EJBUtils.createRemoteBusinessObject
(container.getClassLoader(), intfName, stub);
} catch(Exception e) {
IllegalStateException ise = new IllegalStateException
("Error creating remote business object for " +
intfName);
ise.initCause(e);
throw ise;
}
}
}
if( businessObject == null ) {
throw new IllegalStateException("Invalid business interface : " +
businessInterface + " for ejb " + ejbDesc.getName());
}
return businessObject;
}