Examples of OperationState


Examples of org.ow2.easybeans.api.OperationState

     * @return True if the caller has the specified role.
     */
    public boolean isCallerInRole(final String roleName) {
        // Disallowed from dependency injection and from stateless lifecycle
        // callbacks
        OperationState operationState = getFactory().getOperationState();
        if (DEPENDENCY_INJECTION == operationState
                || (LIFECYCLE_CALLBACK_INTERCEPTOR == operationState && getFactory() instanceof StatelessSessionFactory)) {
            throw new IllegalStateException("The isCallerInRole() method cannot be called within the operation state '"
                    + operationState + "'.");
        }
View Full Code Here

Examples of org.ow2.easybeans.api.OperationState

     *         exception if the instance is not allowed to use the
     *         UserTransaction interface (i.e. the instance is of a bean with
     *         container-managed transactions).
     */
    public UserTransaction getUserTransaction() throws IllegalStateException {
        OperationState operationState = getFactory().getOperationState();
        if (DEPENDENCY_INJECTION == operationState) {
            throw new IllegalStateException("The getUserTransaction() method cannot be called within the operation state '"
                    + operationState + "'.");
        }

View Full Code Here

Examples of org.ow2.easybeans.api.OperationState

     * @throws java.lang.IllegalStateException - The Container throws the
     *         exception if the instance is not allowed to use this method (i.e.
     *         the instance is of a bean with bean-managed transactions).
     */
    public void setRollbackOnly() throws IllegalStateException {
        OperationState operationState = getFactory().getOperationState();
        if (DEPENDENCY_INJECTION == operationState || LIFECYCLE_CALLBACK_INTERCEPTOR == operationState
                || AFTER_COMPLETION == operationState) {
            throw new IllegalStateException("The setRollbackOnly() method cannot be called within the operation state '"
                    + operationState + "'.");
        }
View Full Code Here

Examples of org.ow2.easybeans.api.OperationState

     * @throws java.lang.IllegalStateException - The Container throws the
     *         exception if the instance is not allowed to use this method (i.e.
     *         the instance is of a bean with bean-managed transactions).
     */
    public boolean getRollbackOnly() throws IllegalStateException {
        OperationState operationState = getFactory().getOperationState();
        if (DEPENDENCY_INJECTION == operationState || LIFECYCLE_CALLBACK_INTERCEPTOR == operationState
                || AFTER_COMPLETION == operationState) {
            throw new IllegalStateException("The getRollbackOnly() method cannot be called within the operation state '"
                    + operationState + "'.");
        }
View Full Code Here

Examples of org.ow2.easybeans.api.OperationState

        // Disallowed from stateful
        if (getFactory() instanceof StatefulSessionFactory) {
            throw new IllegalStateException("The getTimerService() method cannot be called from a stateful session bean.");
        }

        OperationState operationState = getFactory().getOperationState();
        if (DEPENDENCY_INJECTION == operationState) {
            throw new IllegalStateException("The getTimerService() method cannot be called within the operation state '"
                    + operationState + "'.");
        }
        return getInternalTimerService();
View Full Code Here

Examples of org.ow2.easybeans.api.OperationState

                logger.error("preEasyBeansInject() for {0} failed", injector.getClass().getName(), t);
            }
        }

        // Call dependency injection
        OperationState oldState = getOperationState();
        getOperationStateThreadLocal().set(OperationState.DEPENDENCY_INJECTION);
        try {
            instance.injectedByEasyBeans();
        } catch (EasyBeansInjectionException e) {
            throw new PoolException("Cannot inject resources in the created bean", e);
View Full Code Here

Examples of org.ow2.easybeans.api.OperationState

    /**
     * Call the predestroy lifecycle interceptors on the given instance.
     * @param instance the given instance
     */
    protected void preDestroy(final PoolType instance) {
        OperationState oldState = getOperationState();
        getOperationStateThreadLocal().set(OperationState.LIFECYCLE_CALLBACK_INTERCEPTOR);
        try {
            instance.preDestroyEasyBeansLifeCycle();
        } finally {
            getOperationStateThreadLocal().set(oldState);
View Full Code Here

Examples of org.ow2.easybeans.api.OperationState

    /**
     * Call the postconstruct lifecycle interceptors on the given instance.
     * @param instance the given instance
     */
    protected void postConstruct(final PoolType instance) {
        OperationState oldState = getOperationState();
        getOperationStateThreadLocal().set(OperationState.LIFECYCLE_CALLBACK_INTERCEPTOR);
        try {
            instance.postConstructEasyBeansLifeCycle();
        } finally {
            getOperationStateThreadLocal().set(oldState);
View Full Code Here

Examples of org.ow2.easybeans.api.OperationState

        EZBContainer container = embedded.getContainer(containerID);
        // get the factory
        Factory<?, ?> factory = container.getFactory(factoryName);

        // Ensure operation state is valid
        OperationState operationState = factory.getOperationState();
        if (DEPENDENCY_INJECTION == operationState || LIFECYCLE_CALLBACK_INTERCEPTOR == operationState
                || AFTER_COMPLETION == operationState) {
            throw new IllegalStateException("The getTimer() method cannot be called within the operation state '"
                    + operationState + "'.");
        }
View Full Code Here

Examples of org.ow2.easybeans.api.OperationState

     * executed with the transaction context of the transaction that is being
     * committed.
     */
    public void beforeCompletion() {
        // Set the operation state
        OperationState oldState = this.factory.getOperationState();
        this.factory.getOperationStateThreadLocal().set(OperationState.BEFORE_COMPLETION);
        try {
            this.synchronizedBean.beforeCompletion();
        } catch (EJBException e) {
            throw e;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.