res.setResult(new NamingException("Expected an ejb proxy, found unknown object: type="+object.getClass().getName() + ", toString="+object));
return;
}
}
ProxyInfo proxyInfo = handler.getProxyInfo();
DeploymentInfo deployment = proxyInfo.getDeploymentInfo();
String deploymentID = deployment.getDeploymentID().toString();
switch(proxyInfo.getInterfaceType()){
case EJB_HOME: {
res.setResponseCode(ResponseCodes.JNDI_EJBHOME);
EJBMetaDataImpl metaData = new EJBMetaDataImpl(deployment.getHomeInterface(),
deployment.getRemoteInterface(),
deployment.getPrimaryKeyClass(),
deployment.getComponentType().toString(),
deploymentID,
-1, null);
res.setResult(metaData);
break;
}
case EJB_LOCAL_HOME: {
res.setResponseCode(ResponseCodes.JNDI_NAMING_EXCEPTION);
res.setResult(new NamingException("Not remotable: '"+name+"'. EJBLocalHome interfaces are not remotable as per the EJB specification."));
break;
}
case BUSINESS_REMOTE: {
res.setResponseCode(ResponseCodes.JNDI_BUSINESS_OBJECT);
EJBMetaDataImpl metaData = new EJBMetaDataImpl(null,
null,
deployment.getPrimaryKeyClass(),
deployment.getComponentType().toString(),
deploymentID,
-1, proxyInfo.getInterfaces());
metaData.setPrimaryKey(proxyInfo.getPrimaryKey());
res.setResult(metaData);
break;
}
case BUSINESS_LOCAL: {
String property = SystemInstance.get().getProperty("openejb.remotable.businessLocals", "false");
if (property.equalsIgnoreCase("true")) {
res.setResponseCode(ResponseCodes.JNDI_BUSINESS_OBJECT);
EJBMetaDataImpl metaData = new EJBMetaDataImpl(null,
null,
deployment.getPrimaryKeyClass(),
deployment.getComponentType().toString(),
deploymentID,
-1, proxyInfo.getInterfaces());
metaData.setPrimaryKey(proxyInfo.getPrimaryKey());
res.setResult(metaData);
} else {
res.setResponseCode(ResponseCodes.JNDI_NAMING_EXCEPTION);
res.setResult(new NamingException("Not remotable: '"+name+"'. Business Local interfaces are not remotable as per the EJB specification. To disable this restriction, set the system property 'openejb.remotable.businessLocals=true' in the server."));
}