当前位置: 首页>>代码示例>>Java>>正文


Java EJBContext类代码示例

本文整理汇总了Java中javax.ejb.EJBContext的典型用法代码示例。如果您正苦于以下问题:Java EJBContext类的具体用法?Java EJBContext怎么用?Java EJBContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EJBContext类属于javax.ejb包,在下文中一共展示了EJBContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BusinessObjectHelper

import javax.ejb.EJBContext; //导入依赖的package包/类
/** Creates a new instance of BusinessObjectHelper */
public BusinessObjectHelper(
        SessionContext ctx, 
        UserService userService,
        EJBContext context) {
  
  this.ctx = ctx;
  this.userService = userService;
  this.context = context;
  
  // 05.02..2013, krane, Client application crashes server, when selecting a large collection.
  // So for entities in this List, the collections are not initialized to show in rich-client
  // TODO: make this customizable or make a client application, which not automatically requests everything
  collectionVetoList.add("nirwana");
  collectionVetoList.add("shipped");
  collectionVetoList.add("shipping");
  collectionVetoList.add("versand");
  collectionVetoList.add("papierkorb");
  collectionVetoList.add("trash");
  collectionVetoList.add("goods-in");
  collectionVetoList.add("wareneingang");
  collectionVetoList.add("goods-out");
  collectionVetoList.add("warenausgang");
  
}
 
开发者ID:salimvanak,项目名称:myWMS,代码行数:26,代码来源:BusinessObjectHelper.java

示例2: lookupSessionContext

import javax.ejb.EJBContext; //导入依赖的package包/类
public void lookupSessionContext() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);

            // lookup in enc
            final SessionContext sctx = (SessionContext) ctx.lookup("java:comp/env/sessioncontext");
            Assert.assertNotNull("The SessionContext got from java:comp/env/sessioncontext is null", sctx);

            // lookup using global name
            final EJBContext ejbCtx = (EJBContext) ctx.lookup("java:comp/EJBContext");
            Assert.assertNotNull("The SessionContext got from java:comp/EJBContext is null ", ejbCtx);

            // verify context was set via legacy set method
            Assert.assertNotNull("The SessionContext is null from setter method", ejbContext);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }

}
 
开发者ID:apache,项目名称:tomee,代码行数:25,代码来源:ContextLookupStatefulPojoBean.java

示例3: lookupSessionContext

import javax.ejb.EJBContext; //导入依赖的package包/类
public void lookupSessionContext() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);

            // lookup in enc
            final SessionContext sctx = (SessionContext) ctx.lookup("java:comp/env/sessioncontext");
            Assert.assertNotNull("The SessionContext got from java:comp/env/sessioncontext is null", sctx);

            // lookup using global name
            final EJBContext ejbCtx = (EJBContext) ctx.lookup("java:comp/EJBContext");
            Assert.assertNotNull("The SessionContext got from java:comp/EJBContext is null ", ejbCtx);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }

}
 
开发者ID:apache,项目名称:tomee,代码行数:22,代码来源:ContextLookupStatelessPojoBean.java

示例4: lookupMessageDrivenContext

import javax.ejb.EJBContext; //导入依赖的package包/类
@Override
public void lookupMessageDrivenContext() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);

            // lookup in enc
            final MessageDrivenContext sctx = (MessageDrivenContext) ctx.lookup("java:comp/env/mdbcontext");
            Assert.assertNotNull("The MessageDrivenContext got from java:comp/env/mdbcontext is null", sctx);

            // lookup using global name
            final EJBContext ejbCtx = (EJBContext) ctx.lookup("java:comp/EJBContext");
            Assert.assertNotNull("The MessageDrivenContext got from java:comp/EJBContext is null ", ejbCtx);

            // verify context was set via legacy set method
            Assert.assertNotNull("The MessageDrivenContext is null from setter method", mdbContext);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }

}
 
开发者ID:apache,项目名称:tomee,代码行数:26,代码来源:ContextLookupMdbBean.java

示例5: lookupMessageDrivenContext

import javax.ejb.EJBContext; //导入依赖的package包/类
public void lookupMessageDrivenContext() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);

            // lookup in enc
            final MessageDrivenContext sctx = (MessageDrivenContext) ctx.lookup("java:comp/env/mdbcontext");
            Assert.assertNotNull("The MessageDrivenContext got from java:comp/env/mdbcontext is null", sctx);

            // lookup using global name
            final EJBContext ejbCtx = (EJBContext) ctx.lookup("java:comp/EJBContext");
            Assert.assertNotNull("The MessageDrivenContext got from java:comp/EJBContext is null ", ejbCtx);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }

}
 
开发者ID:apache,项目名称:tomee,代码行数:22,代码来源:ContextLookupMdbPojoBean.java

示例6: lookupMessageDrivenContext

import javax.ejb.EJBContext; //导入依赖的package包/类
@Override
public void lookupMessageDrivenContext() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);

            // lookup in enc
            final MessageDrivenContext messageDrivenContext = (MessageDrivenContext) ctx.lookup("java:comp/env/mdbcontext");
            Assert.assertNotNull("The SessionContext got from java:comp/env/mdbcontext is null", messageDrivenContext);

            // lookup using global name
            final EJBContext ejbCtx = (EJBContext) ctx.lookup("java:comp/EJBContext");
            Assert.assertNotNull("The SessionContext got from java:comp/EJBContext is null ", ejbCtx);

            // verify context was set via legacy set method
            Assert.assertNotNull("The MdbContext is null from setter method", mdbContext);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }

}
 
开发者ID:apache,项目名称:tomee,代码行数:26,代码来源:EncMdbBean.java

示例7: deploy

import javax.ejb.EJBContext; //导入依赖的package包/类
@Override
public void deploy(final BeanContext beanContext) throws OpenEJBException {
    synchronized (this) {
        final Object deploymentId = beanContext.getDeploymentID();

        cmpEngine.deploy(beanContext);
        beanContext.setContainerData(cmpEngine);
        beanContext.set(EJBContext.class, new EntityContext(securityService));
        // try to set deploymentInfo static field on bean implementation class
        try {
            final Field field = beanContext.getCmpImplClass().getField("deploymentInfo");
            field.set(null, beanContext);
        } catch (final Exception e) {
            // ignore
        }

        // add to indexes
        deploymentsById.put(deploymentId, beanContext);
        beansByClass.put(beanContext.getCmpImplClass(), beanContext);
        beanContext.setContainer(this);
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:23,代码来源:CmpContainer.java

示例8: MdbInstanceFactory

import javax.ejb.EJBContext; //导入依赖的package包/类
/**
 * Creates a MdbInstanceFactory for a single specific deployment.
 *
 * @param beanContext     the deployment for which instances will be created
 * @param securityService the transaction manager for this container system
 * @param instanceLimit   the maximal number of instances or <= 0 if unlimited
 */
public MdbInstanceFactory(final BeanContext beanContext, final SecurityService securityService, final int instanceLimit) throws OpenEJBException {
    this.beanContext = beanContext;
    this.instanceLimit = instanceLimit;
    mdbContext = new MdbContext(securityService);

    try {
        final Context context = beanContext.getJndiEnc();
        context.bind("comp/EJBContext", mdbContext);
        context.bind("comp/TimerService", new TimerServiceWrapper());
    } catch (final NamingException e) {
        throw new OpenEJBException("Failed to bind EJBContext/TimerService", e);
    }

    beanContext.set(EJBContext.class, this.mdbContext);
}
 
开发者ID:apache,项目名称:tomee,代码行数:23,代码来源:MdbInstanceFactory.java

示例9: SecurityContext

import javax.ejb.EJBContext; //导入依赖的package包/类
/** Create a SecurityContext based on a EJB Context
 * @param ctx The EJB Context to use
 */
SecurityContext(EJBContext ctx) {
    if(ctx == null) {
        log.error("Trying to create a Security Context with a null value");
        throw new IllegalArgumentException("Context can't be null");
    }
    ejb = ctx;
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:11,代码来源:SecurityContext.java

示例10: EjbSecurityContext

import javax.ejb.EJBContext; //导入依赖的package包/类
public EjbSecurityContext() {
    try {
        InitialContext initialContext = new InitialContext();
        context = (EJBContext)initialContext.lookup("java:comp/EJBContext");
    } catch (NamingException e) {
        throw new IllegalStateException("EJBContext not found", e);
    }
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:9,代码来源:EjbSecurityContext.java

示例11: autodetectEjbSecurityContext

import javax.ejb.EJBContext; //导入依赖的package包/类
@Test
public void autodetectEjbSecurityContext() throws Exception {
    ClassLoader mockClassLoader = mock(ClassLoader.class);
    when(mockClassLoader.loadClass("org.jpasecurity.spring.authentication.SpringSecurityContext"))
        .thenThrow(new ClassNotFoundException());
    when(mockClassLoader.loadClass("org.jpasecurity.security.authentication.CdiSecurityContext"))
        .thenThrow(new ClassNotFoundException());
    when(mockClassLoader.loadClass("org.jpasecurity.jsf.authentication.JsfSecurityContext"))
        .thenThrow(new ClassNotFoundException());
    when(mockClassLoader.loadClass("org.jpasecurity.security.authentication.EjbSecurityContext"))
        .thenReturn((Class)EjbSecurityContext.class);
    when(mockClassLoader.getResources("jndi.properties")).thenReturn(Collections.<URL>emptyEnumeration());
    when(mockClassLoader.loadClass(javaURLContextFactory.class.getName()))
        .thenReturn((Class)javaURLContextFactory.class);

    System.setProperty(Context.INITIAL_CONTEXT_FACTORY, javaURLContextFactory.class.getName());
    System.setProperty(Context.URL_PKG_PREFIXES, NamingContext.class.getPackage().getName());

    InitialContext initialContext = new InitialContext();
    initialContext.createSubcontext("java:comp");

    EJBContext ejbContext = mock(EJBContext.class);
    initialContext.bind("java:comp/EJBContext", ejbContext);

    AutodetectingSecurityContext securityContext = new AutodetectingSecurityContext();

    Thread.currentThread().setContextClassLoader(mockClassLoader);
    SecurityContext authenticationProvider = securityContext.autodetectSecurityContext();
    assertTrue(authenticationProvider instanceof EjbSecurityContext);
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:31,代码来源:AutodetectingSecurityContextTest.java

示例12: isPrivateReference

import javax.ejb.EJBContext; //导入依赖的package包/类
private <R extends JndiReference> boolean isPrivateReference(final R a) {
    if (!isResourceRef(a)) {
        return false;
    }

    final Class[] types = {EJBContext.class, EntityContext.class, SessionContext.class, MessageDrivenContext.class, UserTransaction.class};

    for (final Class type : types) {
        if (type.getName().equals(a.getType())) {
            return true;
        }
    }

    return false;
}
 
开发者ID:apache,项目名称:tomee,代码行数:16,代码来源:MergeWebappJndiContext.java

示例13: getEjbContext

import javax.ejb.EJBContext; //导入依赖的package包/类
public EJBContext getEjbContext() {
    return ejbContext;
}
 
开发者ID:dajudge,项目名称:testee.fi-examples,代码行数:4,代码来源:SessionBean.java

示例14: EjbJpaTxnManager

import javax.ejb.EJBContext; //导入依赖的package包/类
public EjbJpaTxnManager(EJBContext context) {
	super();
	this.context = context;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:5,代码来源:EjbJpaTxnManager.java

示例15: getEJBContext

import javax.ejb.EJBContext; //导入依赖的package包/类
protected EJBContext getEJBContext() {
    return this.ejbContext;
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:4,代码来源:IfsaEjbBeanBase.java


注:本文中的javax.ejb.EJBContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。