Package org.apache.tuscany.sca.core.scope

Examples of org.apache.tuscany.sca.core.scope.ScopeContainer


                if (runtimeComponent instanceof ScopedRuntimeComponent) {

                    ScopedRuntimeComponent component = (ScopedRuntimeComponent) runtimeComponent;

                    ScopeContainer oldScopeContainer = component.getScopeContainer();
                    component.setScopeContainer(null);
                    ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(runtimeComponent);

                    if (oldScopeContainer != null && oldScopeContainer.getLifecycleState() == ScopeContainer.RUNNING) {
                        scopeContainer.start();
                    }
               
                    component.setScopeContainer(scopeContainer);
                }
View Full Code Here


                if (interfaze != null) {
                    if (!interfaze.isConversational()) {
                        throw new IllegalArgumentException(
                                                           "Callback object for stateless callback is not a ServiceReference");
                    } else {
                        ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
                        if (scopeContainer != null) {
                            InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
                            scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
                        }
                        parameters.setCallbackObjectID(callbackObject);
                    }
                }
            }
View Full Code Here

        // the conversation will already have been stopped when we get back to the client
        if ((sequence == ConversationSequence.CONVERSATION_END) &&
            (conversation.getState()!= ConversationState.ENDED)) {

            // remove conversation id from scope container
            ScopeContainer scopeContainer = getConversationalScopeContainer(wire);

            if (scopeContainer != null) {
                scopeContainer.remove(conversation.getConversationID());
            }
           
            conversation.end();           
        }
    }
View Full Code Here

    private void addScopeContainer(Component component) {
        if (!(component instanceof ScopedRuntimeComponent)) {
            return;
        }
        ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
        ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(runtimeComponent);
        if (scopeContainer != null && scopeContainer.getScope() == Scope.CONVERSATION) {
            conversationManager.addListener((ConversationalScopeContainer)scopeContainer);
        }
        runtimeComponent.setScopeContainer(scopeContainer);
    }
View Full Code Here

    private void removeScopeContainer(Component component) {
        if (!(component instanceof ScopedRuntimeComponent)) {
            return;
        }
        ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
        ScopeContainer scopeContainer = runtimeComponent.getScopeContainer();
        if(scopeContainer != null && scopeContainer.getScope() == Scope.CONVERSATION) {
            conversationManager.removeListener((ConversationalScopeContainer) scopeContainer);
        }       
        runtimeComponent.setScopeContainer(null);
    }
View Full Code Here

        // new conversation id so that stateful callbacks will be
        // able to find it
        if (conversational && callbackObject == null) {
            // the component instance is already registered
            // so add another registration
            ScopeContainer scopeContainer = getConversationalScopeContainer(msg);

            if (scopeContainer != null) {
                scopeContainer.addWrapperReference(currentConversationID, parameters.getConversationID());
            }
        }

        Interface interfaze = msg.getOperation().getInterface();
        if (callbackObject != null) {
            if (callbackObject instanceof ServiceReference) {
                EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
                parameters.setCallbackReference(callbackRef);
            } else {
                if (interfaze != null) {
                    if (!interfaze.isConversational()) {
                        throw new IllegalArgumentException(
                                                           "Callback object for stateless callback is not a ServiceReference");
                    } else {
                        ScopeContainer scopeContainer = getConversationalScopeContainer(msg);
                        if (scopeContainer != null) {
                            InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
                            scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
                        }
                        parameters.setCallbackObjectID(callbackObject);
                    }
                }
            }
View Full Code Here

                    conversationID = convID;
                }
                conversation = conversationManager.getConversation(conversationID);           
   
                // remove conversation id from scope container
                ScopeContainer scopeContainer = getConversationalScopeContainer(msg);
   
                if (scopeContainer != null) {
                    scopeContainer.remove(conversation.getConversationID());
                }
               
                conversation.end();
            }
        }
View Full Code Here

        }
    }

    @SuppressWarnings("unchecked")
    private ScopeContainer getConversationalScopeContainer(Message msg) {
        ScopeContainer scopeContainer = null;

        RuntimeComponent component = msg.getTo().getComponent();

        if (component instanceof ScopedRuntimeComponent) {
            ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
            ScopeContainer container = scopedRuntimeComponent.getScopeContainer();

            if ((container != null) && (container.getScope() == Scope.CONVERSATION)) {
                scopeContainer = container;
            }
        }

        return scopeContainer;
View Full Code Here

                if (interfaze != null) {
                    if (!interfaze.isConversational()) {
                        throw new IllegalArgumentException(
                                                           "Callback object for stateless callback is not a ServiceReference");
                    } else {
                        ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
                        if (scopeContainer != null) {
                            InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
                            scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
                        }
                        parameters.setCallbackObjectID(callbackObject);
                    }
                }
            }
View Full Code Here

        // conversation manager in the runtime and so, in the case of remote bindings,
        // the conversation will already have been stopped when we get back to the client
        if ((sequence == ConversationSequence.CONVERSATION_END) && (conversation.getState() != ConversationState.ENDED)) {

            // remove conversation id from scope container
            ScopeContainer scopeContainer = getConversationalScopeContainer(wire);

            if (scopeContainer != null) {
                scopeContainer.remove(conversation.getConversationID());
            }

            conversation.end();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.core.scope.ScopeContainer

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.