本文整理汇总了Java中javax.ejb.EJBLocalHome类的典型用法代码示例。如果您正苦于以下问题:Java EJBLocalHome类的具体用法?Java EJBLocalHome怎么用?Java EJBLocalHome使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EJBLocalHome类属于javax.ejb包,在下文中一共展示了EJBLocalHome类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidInterface
import javax.ejb.EJBLocalHome; //导入依赖的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;
}
示例2: check_localHomeInterfaceMethods
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
private void check_localHomeInterfaceMethods(final RemoteBean b) {
Class home = null;
Class bean = null;
try {
home = loadClass(b.getLocalHome());
bean = loadClass(b.getEjbClass());
} catch (final OpenEJBException e) {
return;
}
if (!EJBLocalHome.class.isAssignableFrom(home)) {
return;
}
if (check_hasCreateMethod(b, bean, home)) {
check_createMethodsAreImplemented(b, bean, home);
// check_postCreateMethodsAreImplemented(b, bean, home);
}
}
示例3: ProxyFactory
import javax.ejb.EJBLocalHome; //导入依赖的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;
}
}
示例4: log
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
public void log() {
Principal principal = context.getCallerPrincipal();
Map<String, Object> contextData = context.getContextData();
EJBLocalHome ejbLocalHome = context.getEJBLocalHome();
EJBLocalObject ejbLocalObject = context.getEJBLocalObject();
Ejb21StateLocal stateLocalEngine = context.getBusinessObject(Ejb21StateLocal.class);
boolean isCallerInRole = context.isCallerInRole("admin");
logger.info("stateLocalEngineBean principal: " + principal);
logger.info("stateLocalEngineBean contextData:" + contextData);
logger.info("stateLocalEngineBean ejbLocalHome:" + ejbLocalHome);
logger.info("stateLocalEngineBean ejbLocalObject:" + ejbLocalObject);
logger.info("stateLocalEngineBean stateLocalEngineBean:" + stateLocalEngine);
logger.info("stateLocalEngineBean isCallerInRole:" + isCallerInRole);
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:15,代码来源:Ejb21StateEngineLocalBean.java
示例5: log
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
public void log() {
Principal principal = context.getCallerPrincipal();
Map<String, Object> contextData = context.getContextData();
EJBLocalHome ejbLocalHome = context.getEJBLocalHome();
EJBLocalObject ejbLocalObject = context.getEJBLocalObject();
Ejb21Local LocalEngine = context.getBusinessObject(Ejb21Local.class);
boolean isCallerInRole = context.isCallerInRole("admin");
logger.info("ejb21LocalEngineBean principal: " + principal);
logger.info("ejb21LocalEngineBean contextData:" + contextData);
logger.info("ejb21LocalEngineBean ejbLocalHome:" + ejbLocalHome);
logger.info("ejb21LocalEngineBean ejbLocalObject:" + ejbLocalObject);
logger.info("ejb21LocalEngineBean LocalEngineBean:" + LocalEngine);
logger.info("ejb21LocalEngineBean isCallerInRole:" + isCallerInRole);
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:15,代码来源:Ejb21EngineLocalBean.java
示例6: getCreateMethod
import javax.ejb.EJBLocalHome; //导入依赖的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 EJBLocalHome)) {
// An EJB3 Session Bean...
this.homeAsComponent = true;
return null;
}
return super.getCreateMethod(home);
}
示例7: findLocalHome
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
/**
* 找出本地Home对象
*
* @param jndiName
* ejb的本地jndi名称
* @return EJBLocalHome
*/
public static EJBLocalHome findLocalHome(String jndiName) {
EJBLocalHome ejbLocalHome = (EJBLocalHome) HOME_INTERFACES_LOCAL
.get(jndiName);
if (ejbLocalHome == null) {
ejbLocalHome = getLocalHome(jndiName);
}
return ejbLocalHome;
}
示例8: getLocalHome
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
private static synchronized EJBLocalHome getLocalHome(String jndiName) {
try {
Context ctx = ContainerUtil.getLocalEJBContainerContext();
EJBLocalHome ejbLocalHome = (EJBLocalHome) ctx.lookup(jndiName);
HOME_INTERFACES_LOCAL.put(jndiName, ejbLocalHome);
return ejbLocalHome;
} catch (NamingException e) {
e.printStackTrace();
if (HOME_INTERFACES_LOCAL.containsKey(jndiName)) {
HOME_INTERFACES_LOCAL.remove(jndiName);
}
return null;
}
}
示例9: getLocalHome
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
/**
* Obtiene el Home local del ejb
* El acceso a este m�todo �nicamente puede hacerse a partir de la instancia del singleton:
* <code>EJB2ServiceLocator.getInstance().getLocalHome(jndiName,"com.acme.ejb.MyHome");</code>
* @param jndiName Nombre jndi del ejb
* @param homeClassName Nombre de la Clase (Class) para devolver el objeto tipado
* @return El objeto tipado
*/
public EJBLocalHome getLocalHome(final String jndiName,
final String homeClassName) {
EJBLocalHome home = null;
try {
home = this.getLocalHome(jndiName,Reflection.type(homeClassName).getType());
} catch (ReflectionException cnfEx) {
// TODO logging
String err = Strings.of("NO se ha encontrado la clase {} para hacer un narrow del objeto home > {}")
.customizeWith(homeClassName,cnfEx.getMessage()).asString();
System.out.println(err);
}
return home;
}
示例10: test02_getEjbLocalHome
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
public void test02_getEjbLocalHome() {
try {
final EJBLocalHome localHome = ejbLocalObject.getEJBLocalHome();
assertNotNull("The EJBHome is null", localHome);
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例11: test02_getEjbLocalHome
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
public void test02_getEjbLocalHome() {
try {
final EJBLocalHome localHome = ejbLocalObject.getEJBLocalHome();
assertNotNull("The EJBLocalHome is null", localHome);
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
示例12: getInterfaceType
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
public InterfaceType getInterfaceType(final Class clazz) {
final InterfaceType type = interfaces.get(clazz);
if (type != null) {
return type;
}
if (EJBLocalHome.class.isAssignableFrom(clazz)) {
return InterfaceType.EJB_LOCAL_HOME;
}
if (EJBLocalObject.class.isAssignableFrom(clazz)) {
return InterfaceType.EJB_LOCAL;
}
if (EJBHome.class.isAssignableFrom(clazz)) {
return InterfaceType.EJB_HOME;
}
if (EJBObject.class.isAssignableFrom(clazz)) {
return InterfaceType.EJB_OBJECT;
}
for (final Entry<Class, InterfaceType> entry : interfaces.entrySet()) { // for @Remote case where the loaded interface can be different from the stored one
if (entry.getKey().getName().equals(clazz.getName())) {
return entry.getValue();
}
}
return null;
}
示例13: getEJBLocalHome
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
public EJBLocalHome getEJBLocalHome() {
if (getLocalHomeInterface() == null) {
throw new IllegalStateException("This component has no local home interface: " + getDeploymentID());
}
if (getLegacyView().ejbLocalHomeRef == null) {
getLegacyView().ejbLocalHomeRef = (EJBLocalHome) EjbHomeProxyHandler.createHomeProxy(this, InterfaceType.EJB_LOCAL_HOME);
}
return getLegacyView().ejbLocalHomeRef;
}
示例14: containerMethod
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
private static boolean containerMethod(final Method method) {
return (method.getDeclaringClass() == EJBObject.class ||
method.getDeclaringClass() == EJBHome.class ||
method.getDeclaringClass() == EJBLocalObject.class ||
method.getDeclaringClass() == EJBLocalHome.class) &&
!method.getName().equals("remove");
}
示例15: getEJBLocalHome
import javax.ejb.EJBLocalHome; //导入依赖的package包/类
@Override
public EJBLocalHome getEJBLocalHome() throws EJBException {
logger.info("getEJBLocalHome");
return null;
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:6,代码来源:Ejb21StateEngineLocalBean.java