本文整理汇总了Java中javax.ejb.EJBHome类的典型用法代码示例。如果您正苦于以下问题:Java EJBHome类的具体用法?Java EJBHome怎么用?Java EJBHome使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EJBHome类属于javax.ejb包,在下文中一共展示了EJBHome类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import javax.ejb.EJBHome; //导入依赖的package包/类
/**
* Setting up the test fixture.
*/
private void init() throws Exception
{
Context ctx = ContextHelper.getContext();
times = new long[4];
try
{
Object object = PortableRemoteObject.narrow(ctx.lookup(PBSessionHome.JNDI_NAME), EJBHome.class);
bean = ((PBSessionHome) object).create();
}
catch(Exception e)
{
e.printStackTrace(System.err);
throw e;
}
}
示例2: init
import javax.ejb.EJBHome; //导入依赖的package包/类
/**
* Setting up the test fixture.
*/
private void init() throws Exception
{
Context ctx = ContextHelper.getContext();
times = new long[4];
try
{
Object object = PortableRemoteObject.narrow(ctx.lookup(ODMGSessionHome.JNDI_NAME), EJBHome.class);
bean = ((ODMGSessionHome) object).create();
}
catch(Exception e)
{
e.printStackTrace(System.err);
throw e;
}
}
示例3: test39_returnEJBHomeArray
import javax.ejb.EJBHome; //导入依赖的package包/类
public void test39_returnEJBHomeArray() {
try {
final EncBmpHome[] expected = new EncBmpHome[3];
for (int i = 0; i < expected.length; i++) {
final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
expected[i] = (EncBmpHome) 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());
}
}
示例4: Xtest03_copyHandleBySerialize
import javax.ejb.EJBHome; //导入依赖的package包/类
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: Xtest39_returnEJBHomeArray
import javax.ejb.EJBHome; //导入依赖的package包/类
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());
}
}
示例6: test39_returnEJBHomeArray
import javax.ejb.EJBHome; //导入依赖的package包/类
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());
}
}
示例7: test39_returnEJBHomeArray
import javax.ejb.EJBHome; //导入依赖的package包/类
public void test39_returnEJBHomeArray() {
try {
final EncStatefulHome[] expected = new EncStatefulHome[3];
for (int i = 0; i < expected.length; i++) {
final Object obj = initialContext.lookup("client/tests/stateful/EncBean");
expected[i] = (EncStatefulHome) 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());
}
}
示例8: test39_returnEJBHomeArray
import javax.ejb.EJBHome; //导入依赖的package包/类
public void test39_returnEJBHomeArray() {
try {
final EncStatelessHome[] expected = new EncStatelessHome[3];
for (int i = 0; i < expected.length; i++) {
final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
expected[i] = (EncStatelessHome) 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());
}
}
示例9: test39_returnEJBHomeArray
import javax.ejb.EJBHome; //导入依赖的package包/类
public void test39_returnEJBHomeArray() {
try {
final EncSingletonHome[] expected = new EncSingletonHome[3];
for (int i = 0; i < expected.length; i++) {
final Object obj = initialContext.lookup("client/tests/singleton/EncBean");
expected[i] = (EncSingletonHome) 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());
}
}
示例10: isValidInterface
import javax.ejb.EJBHome; //导入依赖的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;
}
示例11: check_homeInterfaceMethods
import javax.ejb.EJBHome; //导入依赖的package包/类
private void check_homeInterfaceMethods(final RemoteBean b) {
Class home = null;
Class bean = null;
try {
home = loadClass(b.getHome());
bean = loadClass(b.getEjbClass());
} catch (final OpenEJBException e) {
return;
}
if (!EJBHome.class.isAssignableFrom(home)) {
return;
}
if (check_hasCreateMethod(b, bean, home)) {
check_createMethodsAreImplemented(b, bean, home);
// ejbPostCreate methods are now automatically generated
// check_postCreateMethodsAreImplemented(b, bean, home);
}
}
示例12: ProxyFactory
import javax.ejb.EJBHome; //导入依赖的package包/类
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;
}
}
示例13: log
import javax.ejb.EJBHome; //导入依赖的package包/类
@Override
public void log() throws RemoteException {
Principal principal = context.getCallerPrincipal();
Map<String, Object> contextData = context.getContextData();
EJBHome ejbHome = context.getEJBHome();
EJBObject ejbObject = context.getEJBObject();
Ejb21Remote RemoteEngine = context.getBusinessObject(Ejb21Remote.class);
boolean isCallerInRole = context.isCallerInRole("admin");
logger.info("ejb21RemoteEngineBean principal: " + principal);
logger.info("ejb21RemoteEngineBean contextData:" + contextData);
logger.info("ejb21RemoteEngineBean ejbHome:" + ejbHome);
logger.info("ejb21RemoteEngineBean ejbObject:" + ejbObject);
logger.info("ejb21RemoteEngineBean RemoteEngineBean:" + RemoteEngine);
logger.info("ejb21RemoteEngineBean isCallerInRole:" + isCallerInRole);
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:16,代码来源:Ejb21EngineRemoteBean.java
示例14: log
import javax.ejb.EJBHome; //导入依赖的package包/类
@Override
public void log() throws RemoteException {
Principal principal = context.getCallerPrincipal();
Map<String, Object> contextData = context.getContextData();
EJBHome ejbHome = context.getEJBHome();
EJBObject ejbObject = context.getEJBObject();
Ejb21StateRemote stateRemoteEngine = context.getBusinessObject(Ejb21StateRemote.class);
boolean isCallerInRole = context.isCallerInRole("admin");
logger.info("stateRemoteEngineBean principal: " + principal);
logger.info("stateRemoteEngineBean contextData:" + contextData);
logger.info("stateRemoteEngineBean ejbHome:" + ejbHome);
logger.info("stateRemoteEngineBean ejbObject:" + ejbObject);
logger.info("stateRemoteEngineBean stateRemoteEngineBean:" + stateRemoteEngine);
logger.info("stateRemoteEngineBean isCallerInRole:" + isCallerInRole);
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:16,代码来源:Ejb21StateEngineRemoteBean.java
示例15: getCreateMethod
import javax.ejb.EJBHome; //导入依赖的package包/类
/**
* 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);
}