use of org.jboss.ejb.client.EJBMetaDataImpl in project wildfly by wildfly.
the class RemoteObjectSubstitutionService method writeReplaceRemote.
@Override
public Object writeReplaceRemote(final Object object) {
final DeploymentRepository deploymentRepository = deploymentRepositoryInjectedValue.getOptionalValue();
// if we are not started yet just return
if (deploymentRepository == null) {
return object;
}
if (EJBClient.isEJBProxy(object)) {
return createIIOPReferenceForBean(object, deploymentRepository);
} else if (object instanceof EJBHandle) {
final EJBHandle<?> handle = (EJBHandle<?>) object;
final EJBLocator<?> locator = handle.getLocator();
final EjbIIOPService factory = serviceForLocator(locator, deploymentRepository);
if (factory != null) {
return factory.handleForLocator(locator);
}
} else if (object instanceof EJBHomeHandle) {
final EJBHomeHandle<?> handle = (EJBHomeHandle<?>) object;
final EJBLocator<?> locator = handle.getLocator();
final EjbIIOPService factory = serviceForLocator(locator, deploymentRepository);
if (factory != null) {
return factory.handleForLocator(locator);
}
} else if (object instanceof EJBMetaDataImpl) {
final EJBMetaDataImpl metadata = (EJBMetaDataImpl) object;
Class<?> pk = null;
if (!metadata.isSession()) {
pk = metadata.getPrimaryKeyClass();
}
final EJBLocator<?> locator = EJBClient.getLocatorFor(metadata.getEJBHome());
final EjbIIOPService factory = serviceForLocator(locator, deploymentRepository);
if (factory != null) {
return new EJBMetaDataImplIIOP(metadata.getRemoteInterfaceClass(), metadata.getHomeInterfaceClass(), pk, metadata.isSession(), metadata.isStatelessSession(), (HomeHandle) factory.handleForLocator(locator));
}
} else if (object instanceof AbstractEJBMetaData) {
final AbstractEJBMetaData<?, ?> metadata = (AbstractEJBMetaData<?, ?>) object;
final EJBHomeLocator<?> locator = metadata.getHomeLocator();
final EjbIIOPService factory = serviceForLocator(locator, deploymentRepository);
Class<?> pk = metadata instanceof EntityEJBMetaData ? metadata.getPrimaryKeyClass() : null;
if (factory != null) {
return new EJBMetaDataImplIIOP(metadata.getRemoteInterfaceClass(), metadata.getHomeInterfaceClass(), pk, metadata.isSession(), metadata.isStatelessSession(), (HomeHandle) factory.handleForLocator(locator));
}
}
return object;
}
Aggregations