本文整理汇总了Java中javax.ejb.EJBObject类的典型用法代码示例。如果您正苦于以下问题:Java EJBObject类的具体用法?Java EJBObject怎么用?Java EJBObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EJBObject类属于javax.ejb包,在下文中一共展示了EJBObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test44_returnEJBObjectArray
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test44_returnEJBObjectArray() {
try {
final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
final EncBmpHome home = (EncBmpHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncBmpObject[] expected = new EncBmpObject[3];
for (int i = 0; i < expected.length; i++) {
expected[i] = home.create("test_44 BmpBean");
assertNotNull("The EJBObject created is null", expected[i]);
}
final EJBObject[] actual = ejbObject.returnEJBObjectArray(expected);
assertNotNull("The EJBObject array returned is null", actual);
assertEquals(expected.length, actual.length);
for (int i = 0; i < actual.length; i++) {
assertTrue("The EJBObjects are not identical", expected[i].isIdentical(actual[i]));
}
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例2: test50_returnHandle
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test50_returnHandle() {
try {
final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
final EncBmpHome home = (EncBmpHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncBmpObject object = home.create("test_50 BmpBean");
assertNotNull("The EJBObject created is null", object);
final Handle expected = object.getHandle();
assertNotNull("The EJBObject Handle returned is null", expected);
assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject());
final Handle actual = ejbObject.returnHandle(expected);
assertNotNull("The EJBObject Handle returned is null", actual);
assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
final EJBObject exp = expected.getEJBObject();
final EJBObject act = actual.getEJBObject();
assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act));
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例3: Xtest03_copyHandleBySerialize
import javax.ejb.EJBObject; //导入依赖的package包/类
public void Xtest03_copyHandleBySerialize() {
try {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(ejbHandle);
oos.flush();
oos.close();
final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
final ObjectInputStream ois = new ObjectInputStream(bais);
final Handle copy = (Handle) ois.readObject();
final EJBObject object = copy.getEJBObject();
assertNotNull("The EJBObject is null", object);
assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例4: Xtest44_returnEJBObjectArray
import javax.ejb.EJBObject; //导入依赖的package包/类
public void Xtest44_returnEJBObjectArray() {
try {
final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
final EncCmpHome home = (EncCmpHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncCmpObject[] expected = new EncCmpObject[3];
for (int i = 0; i < expected.length; i++) {
expected[i] = home.create("test_44 CmpBean");
assertNotNull("The EJBObject created is null", expected[i]);
}
final EJBObject[] actual = ejbObject.returnEJBObjectArray(expected);
assertNotNull("The EJBObject array returned is null", actual);
assertEquals(expected.length, actual.length);
for (int i = 0; i < actual.length; i++) {
assertTrue("The EJBObejcts are not identical", expected[i].isIdentical(actual[i]));
}
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例5: test50_returnHandle
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test50_returnHandle() {
try {
final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
final EncCmpHome home = (EncCmpHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncCmpObject object = home.create("test_50 CmpBean");
assertNotNull("The EJBObject created is null", object);
final Handle expected = object.getHandle();
assertNotNull("The EJBObject Handle returned is null", expected);
assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject());
final Handle actual = ejbObject.returnHandle(expected);
assertNotNull("The EJBObject Handle returned is null", actual);
assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
final EJBObject exp = expected.getEJBObject();
final EJBObject act = actual.getEJBObject();
assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act));
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例6: test44_returnEJBObjectArray
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test44_returnEJBObjectArray() {
try {
final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
final EncCmpHome home = (EncCmpHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncCmpObject[] expected = new EncCmpObject[3];
for (int i = 0; i < expected.length; i++) {
expected[i] = home.create("test_44 CmpBean");
assertNotNull("The EJBObject created is null", expected[i]);
}
final EJBObject[] actual = ejbObject.returnEJBObjectArray(expected);
assertNotNull("The EJBObject array returned is null", actual);
assertEquals(expected.length, actual.length);
for (int i = 0; i < actual.length; i++) {
assertTrue("The EJBObejcts are not identical", expected[i].isIdentical(actual[i]));
}
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例7: test44_returnEJBObjectArray
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test44_returnEJBObjectArray() {
try {
final Object obj = initialContext.lookup("client/tests/stateful/EncBean");
final EncStatefulHome home = (EncStatefulHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncStatefulObject[] expected = new EncStatefulObject[3];
for (int i = 0; i < expected.length; i++) {
expected[i] = home.create("test_44 StatefulBean");
assertNotNull("The EJBObject created is null", expected[i]);
}
final EJBObject[] actual = ejbObject.returnEJBObjectArray(expected);
assertNotNull("The EJBObject array returned is null", actual);
assertEquals(expected.length, actual.length);
for (int i = 0; i < actual.length; i++) {
assertTrue("The EJBObejcts are not identical", expected[i].isIdentical(actual[i]));
}
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例8: test50_returnHandle
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test50_returnHandle() {
try {
final Object obj = initialContext.lookup("client/tests/stateful/EncBean");
final EncStatefulHome home = (EncStatefulHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncStatefulObject object = home.create("test_50 StatefulBean");
assertNotNull("The EJBObject created is null", object);
final Handle expected = object.getHandle();
assertNotNull("The EJBObject Handle returned is null", expected);
assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject());
final Handle actual = ejbObject.returnHandle(expected);
assertNotNull("The EJBObject Handle returned is null", actual);
assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
final EJBObject exp = expected.getEJBObject();
final EJBObject act = actual.getEJBObject();
assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act));
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例9: test44_returnEJBObjectArray
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test44_returnEJBObjectArray() {
try {
final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
final EncStatelessHome home = (EncStatelessHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncStatelessObject[] expected = new EncStatelessObject[3];
for (int i = 0; i < expected.length; i++) {
expected[i] = home.create();
assertNotNull("The EJBObject created is null", expected[i]);
}
final EJBObject[] actual = ejbObject.returnEJBObjectArray(expected);
assertNotNull("The EJBObject array returned is null", actual);
assertEquals(expected.length, actual.length);
for (int i = 0; i < actual.length; i++) {
assertTrue("The EJBObejcts are not identical", expected[i].isIdentical(actual[i]));
}
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例10: test50_returnHandle
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test50_returnHandle() {
try {
final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
final EncStatelessHome home = (EncStatelessHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncStatelessObject object = home.create();
assertNotNull("The EJBObject created is null", object);
final Handle expected = object.getHandle();
assertNotNull("The EJBObject Handle returned is null", expected);
assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject());
final Handle actual = ejbObject.returnHandle(expected);
assertNotNull("The EJBObject Handle returned is null", actual);
assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
final EJBObject exp = expected.getEJBObject();
final EJBObject act = actual.getEJBObject();
assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act));
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例11: test44_returnEJBObjectArray
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test44_returnEJBObjectArray() {
try {
final Object obj = initialContext.lookup("client/tests/singleton/EncBean");
final EncSingletonHome home = (EncSingletonHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncSingletonObject[] expected = new EncSingletonObject[3];
for (int i = 0; i < expected.length; i++) {
expected[i] = home.create();
assertNotNull("The EJBObject created is null", expected[i]);
}
final EJBObject[] actual = ejbObject.returnEJBObjectArray(expected);
assertNotNull("The EJBObject array returned is null", actual);
assertEquals(expected.length, actual.length);
for (int i = 0; i < actual.length; i++) {
assertTrue("The EJBObejcts are not identical", expected[i].isIdentical(actual[i]));
}
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例12: test50_returnHandle
import javax.ejb.EJBObject; //导入依赖的package包/类
public void test50_returnHandle() {
try {
final Object obj = initialContext.lookup("client/tests/singleton/EncBean");
final EncSingletonHome home = (EncSingletonHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncSingletonObject object = home.create();
assertNotNull("The EJBObject created is null", object);
final Handle expected = object.getHandle();
assertNotNull("The EJBObject Handle returned is null", expected);
assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject());
final Handle actual = ejbObject.returnHandle(expected);
assertNotNull("The EJBObject Handle returned is null", actual);
assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
final EJBObject exp = expected.getEJBObject();
final EJBObject act = actual.getEJBObject();
assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act));
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例13: mapObjectInterface
import javax.ejb.EJBObject; //导入依赖的package包/类
private void mapObjectInterface(final Class intrface) {
if (intrface == BusinessLocalHome.class || intrface == BusinessRemoteHome.class || intrface == ServiceEndpoint.class) {
return;
}
final Method[] interfaceMethods = intrface.getMethods();
for (final Method method : interfaceMethods) {
final Class declaringClass = method.getDeclaringClass();
if (declaringClass == EJBObject.class || declaringClass == EJBLocalObject.class) {
continue;
}
try {
final Method beanMethod = beanClass.getMethod(method.getName(), method.getParameterTypes());
mapMethods(method, beanMethod);
} catch (final NoSuchMethodException nsme) {
throw new OpenEJBRuntimeException("Invalid method [" + method + "]. Not declared by " + beanClass.getName() + " class");
}
}
}
示例14: isValidInterface
import javax.ejb.EJBObject; //导入依赖的package包/类
/**
* Checks that the values specified via @Local and @Remote are *not*:
* <p/>
* - classes
* - derived from javax.ejb.EJBObject
* - derived from javax.ejb.EJBHome
* - derived from javax.ejb.EJBLocalObject
* - derived from javax.ejb.EJBLocalHome
*
* @param interfce
* @param validation
* @param ejbName
* @param annotationName
* @return
*/
private boolean isValidInterface(final Class interfce, final ValidationContext validation, final String ejbName, final String annotationName) {
if (!interfce.isInterface()) {
validation.fail(ejbName, "ann.notAnInterface", annotationName, interfce.getName());
return false;
} else if (EJBHome.class.isAssignableFrom(interfce)) {
validation.fail(ejbName, "ann.remoteOrLocal.ejbHome", annotationName, interfce.getName());
return false;
} else if (EJBObject.class.isAssignableFrom(interfce)) {
validation.fail(ejbName, "ann.remoteOrLocal.ejbObject", annotationName, interfce.getName());
return false;
} else if (EJBLocalHome.class.isAssignableFrom(interfce)) {
validation.fail(ejbName, "ann.remoteOrLocal.ejbLocalHome", annotationName, interfce.getName());
return false;
} else if (EJBLocalObject.class.isAssignableFrom(interfce)) {
validation.fail(ejbName, "ann.remoteOrLocal.ejbLocalObject", annotationName, interfce.getName());
return false;
}
return true;
}
示例15: getEJBObject
import javax.ejb.EJBObject; //导入依赖的package包/类
public EJBObject getEJBObject() throws IllegalStateException {
doCheck(Call.getEJBObject);
final ThreadContext threadContext = ThreadContext.getThreadContext();
final BeanContext di = threadContext.getBeanContext();
if (di.getRemoteInterface() == null) {
throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface");
}
final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getBeanContext(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>(), di.getRemoteInterface());
try {
final Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class};
return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler);
} catch (final IllegalAccessException iae) {
throw new InternalErrorException("Could not create IVM proxy for " + di.getRemoteInterface() + " interface", iae);
}
}