use of javax.ejb.HomeHandle in project tomee by apache.
the class Complex2HomeHandleTests method Xtest02_copyHandleByMarshalledObject.
public void Xtest02_copyHandleByMarshalledObject() {
try {
final MarshalledObject obj = new MarshalledObject(ejbHomeHandle);
final HomeHandle copy = (HomeHandle) obj.get();
assertNotNull("The HomeHandle copy is null", copy);
final EJBHome home = copy.getEJBHome();
assertNotNull("The EJBHome is null", home);
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
use of javax.ejb.HomeHandle in project tomee by apache.
the class Cmp2HomeHandleTests method Xtest02_copyHandleByMarshalledObject.
public void Xtest02_copyHandleByMarshalledObject() {
try {
final MarshalledObject obj = new MarshalledObject(ejbHomeHandle);
final HomeHandle copy = (HomeHandle) obj.get();
assertNotNull("The HomeHandle copy is null", copy);
final EJBHome home = copy.getEJBHome();
assertNotNull("The EJBHome is null", home);
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
use of javax.ejb.HomeHandle 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);
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;
return new EJBMetaDataImplIIOP(metadata.getRemoteInterfaceClass(), metadata.getHomeInterfaceClass(), pk, metadata.isSession(), metadata.isStatelessSession(), (HomeHandle) factory.handleForLocator(locator));
}
return object;
}
use of javax.ejb.HomeHandle in project wildfly by wildfly.
the class ClientEjb method getRemoteViaHomeHandleMessage.
public String getRemoteViaHomeHandleMessage() throws RemoteException {
final HomeHandle handle = home.getHomeHandle();
final IIOPBasicHome newHome = (IIOPBasicHome) PortableRemoteObject.narrow(handle.getEJBHome(), IIOPBasicHome.class);
final IIOPBasicRemote object = newHome.create();
return object.hello();
}
use of javax.ejb.HomeHandle in project tomee by apache.
the class Unknown2HomeHandleTests method Xtest02_copyHandleByMarshalledObject.
public void Xtest02_copyHandleByMarshalledObject() {
try {
final MarshalledObject obj = new MarshalledObject(ejbHomeHandle);
final HomeHandle copy = (HomeHandle) obj.get();
assertNotNull("The HomeHandle copy is null", copy);
final EJBHome home = copy.getEJBHome();
assertNotNull("The EJBHome is null", home);
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
Aggregations