类javax.ejb.EJBHome源码实例Demo

下面列出了怎么用javax.ejb.EJBHome的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: tomee   文件: Complex2HomeHandleTests.java
public void Xtest03_copyHandleBySerialize() {
    try {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(ejbHomeHandle);
        oos.flush();
        oos.close();
        final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        final ObjectInputStream ois = new ObjectInputStream(bais);
        final HomeHandle copy = (HomeHandle) ois.readObject();

        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());
    }
}
 
源代码2 项目: tomee   文件: Cmp2RmiIiopTests.java
public void Xtest39_returnEJBHomeArray() {
    try {

        final EncCmpHome[] expected = new EncCmpHome[3];
        for (int i = 0; i < expected.length; i++) {
            final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
            expected[i] = (EncCmpHome) obj;
            assertNotNull("The EJBHome returned from JNDI is null", expected[i]);
        }

        final EJBHome[] actual = ejbObject.returnEJBHomeArray(expected);
        assertNotNull("The EJBHome array returned is null", actual);
        assertEquals(expected.length, actual.length);

    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码3 项目: tomee   文件: ProxyFactory.java
public ProxyFactory(final BeanContext beanContext) {
    this.beanContext = beanContext;
    keyGenerator = beanContext.getKeyGenerator();

    remoteInterface = beanContext.getRemoteInterface();
    if (remoteInterface != null) {
        final EJBHome homeProxy = beanContext.getEJBHome();
        remoteHandler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(homeProxy);
    } else {
        remoteHandler = null;
    }

    localInterface = beanContext.getLocalInterface();
    if (localInterface != null) {
        final EJBLocalHome localHomeProxy = beanContext.getEJBLocalHome();
        localHandler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(localHomeProxy);
    } else {
        localHandler = null;
    }
}
 
源代码4 项目: tomee   文件: Cmp2HomeHandleTests.java
public void Xtest03_copyHandleBySerialize() {
    try {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(ejbHomeHandle);
        oos.flush();
        oos.close();
        final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        final ObjectInputStream ois = new ObjectInputStream(bais);
        final HomeHandle copy = (HomeHandle) ois.readObject();

        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());
    }
}
 
源代码5 项目: tomee   文件: Unknown2HomeHandleTests.java
public void Xtest03_copyHandleBySerialize() {
    try {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(ejbHomeHandle);
        oos.flush();
        oos.close();
        final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        final ObjectInputStream ois = new ObjectInputStream(bais);
        final HomeHandle copy = (HomeHandle) ois.readObject();

        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());
    }
}
 
源代码6 项目: tomee   文件: CmpRmiIiopTests.java
public void test39_returnEJBHomeArray() {
    try {

        final EncCmpHome[] expected = new EncCmpHome[3];
        for (int i = 0; i < expected.length; i++) {
            final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
            expected[i] = (EncCmpHome) obj;
            assertNotNull("The EJBHome returned from JNDI is null", expected[i]);
        }

        final EJBHome[] actual = ejbObject.returnEJBHomeArray(expected);
        assertNotNull("The EJBHome array returned is null", actual);
        assertEquals(expected.length, actual.length);

    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
/**
 * Check for EJB3-style home object that serves as EJB component directly.
 */
@Override
protected Method getCreateMethod(Object home) throws EjbAccessException {
	if (this.homeAsComponent) {
		return null;
	}
	if (!(home instanceof EJBHome)) {
		// An EJB3 Session Bean...
		this.homeAsComponent = true;
		return null;
	}
	return super.getCreateMethod(home);
}
 
/**
 * Check for EJB3-style home object that serves as EJB component directly.
 */
@Override
protected Method getCreateMethod(Object home) throws EjbAccessException {
	if (this.homeAsComponent) {
		return null;
	}
	if (!(home instanceof EJBHome)) {
		// An EJB3 Session Bean...
		this.homeAsComponent = true;
		return null;
	}
	return super.getCreateMethod(home);
}
 
/**
 * Check for EJB3-style home object that serves as EJB component directly.
 */
@Override
protected Method getCreateMethod(Object home) throws EjbAccessException {
	if (this.homeAsComponent) {
		return null;
	}
	if (!(home instanceof EJBHome)) {
		// An EJB3 Session Bean...
		this.homeAsComponent = true;
		return null;
	}
	return super.getCreateMethod(home);
}
 
源代码10 项目: cxf   文件: EJBInvoker.java
public EJBInvoker(EJBHome home) {
    this.home = home;
    try {
        if (!home.getEJBMetaData().isSession() || !home.getEJBMetaData().isStatelessSession()) {
            throw new IllegalArgumentException("home must be for a stateless session bean");
        }
        createMethod = home.getClass().getMethod("create", new Class[0]);
    } catch (Exception ex) {
        throw new IllegalArgumentException("Unable to initialize invoker: " + ex);
    }
}
 
源代码11 项目: tomee   文件: EJBMetaDataImpl.java
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
    final byte version = in.readByte(); // future use

    homeClass = (Class) in.readObject();
    remoteClass = (Class) in.readObject();
    keyClass = (Class) in.readObject();
    ejbHomeProxy = (EJBHome) in.readObject();
    type = in.readByte();
    deploymentID = in.readUTF();
    deploymentCode = in.readShort();

    for (int i = in.readShort(); i > 0; i--) {
        businessClasses.add((Class) in.readObject());
    }
    if (businessClasses.size() > 0) {
        primaryKey = in.readObject();
    }
    if (version > 2) {
        mainInterface = (Class) in.readObject();
    }
    if (version > 1) {
        final byte typeIndex = in.readByte();
        interfaceType = InterfaceType.values()[typeIndex];
    }
    for (int i = in.readInt(); i > 0; i--) {
        asynchronousMethods.add((String) in.readObject());
    }

    final boolean hasProperties = in.readBoolean();
    if (hasProperties) {
        final int bufferLength = in.readInt();
        final byte[] buffer = new byte[bufferLength];
        in.read(buffer);
        final ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
        properties.load(bais);
    }
}
 
源代码12 项目: tomee   文件: EJBInvocationHandler.java
public EJBInvocationHandler(final EJBMetaDataImpl ejb, final ServerMetaData server, final ClientMetaData client, final JNDIContext.AuthenticationInfo auth) {
    this.ejb = ejb;
    this.server = server;
    this.client = client;
    this.authenticationInfo = auth;
    final Class remoteInterface = ejb.getRemoteInterfaceClass();
    remote = remoteInterface != null && (EJBObject.class.isAssignableFrom(remoteInterface) || EJBHome.class.isAssignableFrom(remoteInterface));
}
 
源代码13 项目: tomee   文件: BmpEjbMetaDataTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbMetaData.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码14 项目: tomee   文件: BmpEjbObjectTests.java
public void test04_getEjbHome() {
    try {
        final EJBHome home = ejbObject.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码15 项目: tomee   文件: Complex2EjbMetaDataTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbMetaData.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码16 项目: tomee   文件: Complex2HomeHandleTests.java
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());
    }
}
 
源代码17 项目: tomee   文件: Cmp2EjbMetaDataTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbMetaData.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码18 项目: tomee   文件: Unknown2EjbMetaDataTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbMetaData.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码19 项目: tomee   文件: Complex2EjbObjectTests.java
public void test04_getEjbHome() {
    try {
        final EJBHome home = ejbObject.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码20 项目: tomee   文件: Unknown2EjbObjectTests.java
public void test04_getEjbHome() {
    try {
        final EJBHome home = ejbObject.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码21 项目: tomee   文件: Cmp2HomeHandleTests.java
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());
    }
}
 
源代码22 项目: tomee   文件: Unknown2HomeHandleTests.java
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());
    }
}
 
源代码23 项目: tomee   文件: ComplexHomeHandleTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbHomeHandle.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码24 项目: tomee   文件: ComplexEjbObjectTests.java
public void test04_getEjbHome() {
    try {
        final EJBHome home = ejbObject.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码25 项目: tomee   文件: UnknownHomeHandleTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbHomeHandle.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码26 项目: tomee   文件: UnknownEjbObjectTests.java
public void test04_getEjbHome() {
    try {
        final EJBHome home = ejbObject.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码27 项目: tomee   文件: UnknownEjbMetaDataTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbMetaData.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码28 项目: tomee   文件: ComplexEjbMetaDataTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbMetaData.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码29 项目: tomee   文件: CmpEjbMetaDataTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbMetaData.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
源代码30 项目: tomee   文件: CmpHomeHandleTests.java
public void test01_getEJBHome() {
    try {
        final EJBHome home = ejbHomeHandle.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}