javax.ejb.MessageDrivenContext Java Examples

The following examples show how to use javax.ejb.MessageDrivenContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContextLookupMdbBean.java    From tomee with Apache License 2.0 6 votes vote down vote up
@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);
    }

}
 
Example #2
Source File: ContextLookupMdbPojoBean.java    From tomee with Apache License 2.0 6 votes vote down vote up
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);
    }

}
 
Example #3
Source File: EncMdbBean.java    From tomee with Apache License 2.0 6 votes vote down vote up
@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);
    }

}
 
Example #4
Source File: ContextLookupMdbBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void setMessageDrivenContext(final MessageDrivenContext ctx) throws EJBException {
    this.mdbContext = ctx;
    try {
        final ConnectionFactory connectionFactory = (ConnectionFactory) new InitialContext().lookup("java:comp/env/jms");
        mdbInvoker = new MdbInvoker(connectionFactory, this);
    } catch (final Exception e) {
        throw new EJBException(e);
    }
}
 
Example #5
Source File: BasicMdbBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void setMessageDrivenContext(final MessageDrivenContext ctx) throws EJBException {
    this.mdbContext = ctx;
    testAllowedOperations("setMessageDrivenContext");
    try {
        final ConnectionFactory connectionFactory = (ConnectionFactory) new InitialContext().lookup("java:comp/env/jms");
        mdbInvoker = new MdbInvoker(connectionFactory, this);
    } catch (final Exception e) {
        throw new EJBException(e);
    }
}
 
Example #6
Source File: InterceptorMdbBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void setMessageDrivenContext(final MessageDrivenContext ctx) throws EJBException {
    this.mdbContext = ctx;
    try {
        mdbInvoker = new MdbInvoker(connectionFactory, this);
    } catch (final Exception e) {
        throw new EJBException(e);
    }
}
 
Example #7
Source File: SetterInjectionMdbBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void setMessageDrivenContext(final MessageDrivenContext ctx) throws EJBException {
    this.mdbContext = ctx;
    try {
        final ConnectionFactory connectionFactory = (ConnectionFactory) new InitialContext().lookup("java:comp/env/jms");
        mdbInvoker = new MdbInvoker(connectionFactory, this);
    } catch (final Exception e) {
        throw new EJBException(e);
    }
}
 
Example #8
Source File: MergeWebappJndiContext.java    From tomee with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #9
Source File: FieldInjectionMdbBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void setMessageDrivenContext(final MessageDrivenContext ctx) throws EJBException {
    this.mdbContext = ctx;
    try {
        final ConnectionFactory connectionFactory = (ConnectionFactory) new InitialContext().lookup("java:comp/env/jms");
        mdbInvoker = new MdbInvoker(connectionFactory, this);
    } catch (final Exception e) {
        throw new EJBException(e);
    }
}
 
Example #10
Source File: EncMdbBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void setMessageDrivenContext(final MessageDrivenContext ctx) throws EJBException {
    this.mdbContext = ctx;
    try {
        final ConnectionFactory connectionFactory = (ConnectionFactory) new InitialContext().lookup("java:comp/env/jms");
        mdbInvoker = new MdbInvoker(connectionFactory, this);
    } catch (final Exception e) {
        throw new EJBException(e);
    }
}
 
Example #11
Source File: EJBMessageDrivenNotInEJBXML.java    From windup with Eclipse Public License 1.0 4 votes vote down vote up
public void setMessageDrivenContext(javax.ejb.MessageDrivenContext context)
{
}
 
Example #12
Source File: TestMDBQueueBean.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * @see javax.ejb.MessageDrivenBean#setMessageDrivenContext(javax.ejb.MessageDrivenContext)
 */
public void setMessageDrivenContext(MessageDrivenContext aContext) {
    context = aContext;
}
 
Example #13
Source File: NoMessageDeliveryTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Resource
public void setMessageDrivenContext(final MessageDrivenContext messageDrivenContext) {
    lifecycle.push(Lifecycle.INJECTION);
}
 
Example #14
Source File: JmsMdbContainerTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Resource
public void setMessageDrivenContext(final MessageDrivenContext messageDrivenContext) {
    lifecycle.push(Lifecycle.INJECTION);
}
 
Example #15
Source File: QuartzMdbContainerTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Resource
public void setMessageDrivenContext(final MessageDrivenContext messageDrivenContext) {
    lifecycle.push(Lifecycle.INJECTION);
}
 
Example #16
Source File: CustomMdbContainerTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Resource
public void setMessageDrivenContext(final MessageDrivenContext messageDrivenContext) {
    lifecycle.push(Lifecycle.INJECTION);
}
 
Example #17
Source File: SetterInjectionMdbBean.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void setEjbContext(final MessageDrivenContext ejbContext) {
    this.ejbContextField = ejbContext;
}
 
Example #18
Source File: SetterInjectionMdbBean.java    From tomee with Apache License 2.0 4 votes vote down vote up
public MessageDrivenContext getEjbContext() {
    return ejbContextField;
}
 
Example #19
Source File: GenericMDB.java    From iaf with Apache License 2.0 4 votes vote down vote up
@Override
public void setMessageDrivenContext(MessageDrivenContext ejbContext) throws EJBException {
       log.info("Received EJB-MDB Context");
       this.ejbContext = ejbContext;
   }
 
Example #20
Source File: CustomIfsaReceiverMDBAbstractBase.java    From iaf with Apache License 2.0 4 votes vote down vote up
public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException {
    ejbContext = ctx;
}
 
Example #21
Source File: CustomIfsaReceiverMDBAbstractBase.java    From iaf with Apache License 2.0 4 votes vote down vote up
public MessageDrivenContext getMessageDrivenContext() {
    return ejbContext;
}
 
Example #22
Source File: DispatchMDBMessageListenerImpl.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void setMessageDrivenContext(MessageDrivenContext mdc) {
}
 
Example #23
Source File: TestMDBTopicBean.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * @see javax.ejb.MessageDrivenBean#setMessageDrivenContext(javax.ejb.MessageDrivenContext)
 */
public void setMessageDrivenContext(MessageDrivenContext aContext) {
    context = aContext;
}