Search in sources :

Example 6 with EJBMetaDataImpl

use of org.apache.openejb.client.EJBMetaDataImpl in project tomee by apache.

the class ClientObjectFactory method getEJBObject.

@Override
public javax.ejb.EJBObject getEJBObject(final ProxyInfo info) {
    final CallContext call = CallContext.getCallContext();
    final BeanContext beanContext = info.getBeanContext();
    final int idCode = -1;
    Object securityIdentity = null;
    try {
        securityIdentity = call.getEJBRequest().getClientIdentity();
    } catch (Exception e) {
        e.printStackTrace();
    }
    final ClientMetaData cMetaData = new ClientMetaData(securityIdentity);
    final EJBMetaDataImpl eMetaData = buildEjbMetaData(info, beanContext, idCode);
    final Object primKey = info.getPrimaryKey();
    final EJBObjectHandler hanlder = EJBObjectHandler.createEJBObjectHandler(JNDIContext.globalExecutor(), eMetaData, getServerMetaData(), cMetaData, primKey, null);
    return (javax.ejb.EJBObject) hanlder.createEJBObjectProxy();
}
Also used : BeanContext(org.apache.openejb.BeanContext) EJBMetaDataImpl(org.apache.openejb.client.EJBMetaDataImpl) EJBObjectHandler(org.apache.openejb.client.EJBObjectHandler) ClientMetaData(org.apache.openejb.client.ClientMetaData)

Example 7 with EJBMetaDataImpl

use of org.apache.openejb.client.EJBMetaDataImpl in project tomee by apache.

the class ClientObjectFactory method getHandle.

@Override
public javax.ejb.Handle getHandle(final ProxyInfo info) {
    final CallContext call = CallContext.getCallContext();
    final BeanContext beanContext = info.getBeanContext();
    final int idCode = -1;
    Object securityIdentity = null;
    try {
        securityIdentity = call.getEJBRequest().getClientIdentity();
    } catch (Exception e) {
    // Ignore
    }
    final ClientMetaData cMetaData = new ClientMetaData(securityIdentity);
    final EJBMetaDataImpl eMetaData = buildEjbMetaData(info, beanContext, idCode);
    final Object primKey = info.getPrimaryKey();
    final EJBObjectHandler handler = EJBObjectHandler.createEJBObjectHandler(JNDIContext.globalExecutor(), eMetaData, getServerMetaData(), cMetaData, primKey, null);
    return new EJBObjectHandle(handler.createEJBObjectProxy());
}
Also used : BeanContext(org.apache.openejb.BeanContext) EJBMetaDataImpl(org.apache.openejb.client.EJBMetaDataImpl) EJBObjectHandler(org.apache.openejb.client.EJBObjectHandler) EJBObjectHandle(org.apache.openejb.client.EJBObjectHandle) ClientMetaData(org.apache.openejb.client.ClientMetaData)

Example 8 with EJBMetaDataImpl

use of org.apache.openejb.client.EJBMetaDataImpl in project tomee by apache.

the class DeploymentIndexTest method testGetDeploymentEJBRequestRemoteException.

@Test(expected = RemoteException.class)
public void testGetDeploymentEJBRequestRemoteException() throws RemoteException {
    // 0 causes DeploymentIndex to move further
    final EJBMetaDataImpl ejbMetadata = new EJBMetaDataImpl(null, null, null, null, null, 0, InterfaceType.BUSINESS_REMOTE, null, null);
    final EJBRequest request = new EJBRequest(null, ejbMetadata, method, null, null, null);
    deploymentIndex.getDeployment(request);
}
Also used : EJBMetaDataImpl(org.apache.openejb.client.EJBMetaDataImpl) EJBRequest(org.apache.openejb.client.EJBRequest) Test(org.junit.Test)

Example 9 with EJBMetaDataImpl

use of org.apache.openejb.client.EJBMetaDataImpl in project tomee by apache.

the class ClientObjectFactory method getBusinessObject.

@Override
public Object getBusinessObject(final ProxyInfo info) {
    final CallContext call = CallContext.getCallContext();
    final BeanContext beanContext = info.getBeanContext();
    final int idCode = -1;
    Object securityIdentity = null;
    try {
        securityIdentity = call.getEJBRequest().getClientIdentity();
    } catch (Exception e) {
        e.printStackTrace();
    }
    final ClientMetaData cMetaData = new ClientMetaData(securityIdentity);
    final EJBMetaDataImpl eMetaData = new EJBMetaDataImpl(null, null, beanContext.getPrimaryKeyClass(), beanContext.getComponentType().toString(), beanContext.getDeploymentID().toString(), idCode, convert(info.getInterfaceType()), info.getInterfaces(), beanContext.getAsynchronousMethodSignatures());
    eMetaData.loadProperties(beanContext.getProperties());
    final Object primKey = info.getPrimaryKey();
    final EJBObjectHandler hanlder = EJBObjectHandler.createEJBObjectHandler(JNDIContext.globalExecutor(), eMetaData, getServerMetaData(), cMetaData, primKey, null);
    return hanlder.createEJBObjectProxy();
}
Also used : BeanContext(org.apache.openejb.BeanContext) EJBMetaDataImpl(org.apache.openejb.client.EJBMetaDataImpl) EJBObjectHandler(org.apache.openejb.client.EJBObjectHandler) ClientMetaData(org.apache.openejb.client.ClientMetaData)

Example 10 with EJBMetaDataImpl

use of org.apache.openejb.client.EJBMetaDataImpl in project tomee by apache.

the class ClientObjectFactory method buildEjbMetaData.

private EJBMetaDataImpl buildEjbMetaData(final ProxyInfo info, final BeanContext beanContext, final int idCode) {
    final EJBMetaDataImpl eMetaData = new EJBMetaDataImpl(beanContext.getHomeInterface(), beanContext.getRemoteInterface(), beanContext.getPrimaryKeyClass(), beanContext.getComponentType().toString(), beanContext.getDeploymentID().toString(), idCode, convert(info.getInterfaceType()), info.getInterfaces(), beanContext.getAsynchronousMethodSignatures());
    eMetaData.loadProperties(beanContext.getProperties());
    return eMetaData;
}
Also used : EJBMetaDataImpl(org.apache.openejb.client.EJBMetaDataImpl)

Aggregations

EJBMetaDataImpl (org.apache.openejb.client.EJBMetaDataImpl)11 BeanContext (org.apache.openejb.BeanContext)9 ClientMetaData (org.apache.openejb.client.ClientMetaData)5 ArrayList (java.util.ArrayList)3 EJBObjectHandler (org.apache.openejb.client.EJBObjectHandler)3 InterfaceType (org.apache.openejb.InterfaceType)2 EJBHomeHandler (org.apache.openejb.client.EJBHomeHandler)2 EJBRequest (org.apache.openejb.client.EJBRequest)2 ContainerSystem (org.apache.openejb.spi.ContainerSystem)2 Test (org.junit.Test)2 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Queue (java.util.Queue)1 ConnectionFactory (javax.jms.ConnectionFactory)1 Topic (javax.jms.Topic)1 Context (javax.naming.Context)1 NameNotFoundException (javax.naming.NameNotFoundException)1 NamingException (javax.naming.NamingException)1