* Obtain and apply initialization from annotations.
*/
public void initIntrospect() throws ConfigException {
super.initIntrospect();
ApiClass type = getEJBClassWrapper();
// XXX: ejb/0f78
if (type == null)
return;
// ejb/0j20
if (!type.isAnnotationPresent(Stateful.class)
&& !type.isAnnotationPresent(Stateless.class) && !isAllowPOJO())
return;
/*
* TCK: ejb/0f6d: bean with local and remote interfaces if (_localHome !=
* null || _localList.size() != 0 || _remoteHome != null ||
* _remoteList.size() != 0) return;
*/
ArrayList<ApiClass> interfaceList = new ArrayList<ApiClass>();
for (ApiClass localApi : type.getInterfaces()) {
Class javaApi = localApi.getJavaClass();
Local local = (Local) javaApi.getAnnotation(Local.class);
if (local != null) {
setLocalWrapper(localApi);
continue;
}
javax.ejb.Remote remote = (javax.ejb.Remote) javaApi
.getAnnotation(javax.ejb.Remote.class);
if (remote != null || java.rmi.Remote.class.isAssignableFrom(javaApi)) {
setRemoteWrapper(localApi);
continue;
}
if (javaApi.getName().equals("java.io.Serializable"))
continue;
if (javaApi.getName().equals("java.io.Externalizable"))
continue;
if (javaApi.getName().startsWith("javax.ejb"))
continue;
if (javaApi.getName().equals("java.rmi.Remote"))
continue;
if (!interfaceList.contains(localApi))
interfaceList.add(localApi);
}
Local local = type.getAnnotation(Local.class);
if (local != null && local.value() != null) {
_localList.clear();
for (Class api : local.value()) {
// XXX: grab from type?
_localList.add(new ApiClass(api));
}
}
Remote remote = type.getAnnotation(Remote.class);
if (remote != null && remote.value() != null) {
_remoteList.clear();
for (Class api : remote.value()) {
// XXX: grab from type?
_remoteList.add(new ApiClass(api));
}
}
// if (getLocalList().size() != 0 || getRemoteList().size() != 0) {
if (_localHome != null || _localList.size() != 0 || _remoteHome != null
|| _remoteList.size() != 0) {
} else if (interfaceList.size() == 0) {
// Session bean no-interface view.
} else if (interfaceList.size() != 1)
throw new ConfigException(
L
.l(
"'{0}' has multiple interfaces, but none are marked as @Local or @Remote.\n{1}",
type.getName(), interfaceList.toString()));
else {
setLocalWrapper(interfaceList.get(0));
}
// XXX: Check ejb30/bb/session/stateless/migration/twothree/annotated
// There is a conflict between 2.1 and 3.0 interfaces.
// ejb/0f6f
// The session bean might have @RemoteHome for EJB 2.1 and
// the @Remote interface for EJB 3.0 (same with @LocalHome and @Local).
// TCK: ejb30/bb/session/stateful/sessioncontext/annotated
ApiClass ejbClass = getEJBClassWrapper();
LocalHome localHomeAnn = ejbClass.getAnnotation(LocalHome.class);
// ejb/0f6f
if (localHomeAnn != null) {
Class localHome = localHomeAnn.value();
setLocalHome(localHome);
}
RemoteHome remoteHomeAnn = ejbClass.getAnnotation(RemoteHome.class);
// ejb/0f6f
if (remoteHomeAnn != null) {
Class home = remoteHomeAnn.value();
setHome(home);