Package org.ow2.easybeans.api

Examples of org.ow2.easybeans.api.OperationState


     *         never returns null.
     */
    public Principal getCallerPrincipal() {
        // 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 getCallerPrincipal() method cannot be called within the operation state '"
                    + operationState + "'.");
        }
View Full Code Here


     * @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

     *         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

     * @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

     * @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

        // 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

                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

    /**
     * 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

    /**
     * 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

        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

TOP

Related Classes of org.ow2.easybeans.api.OperationState

Copyright © 2018 www.massapicom. 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.