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

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


                implementationProvider.start();
            }
        }

        if (component instanceof ScopedRuntimeComponent) {
            ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
            if (scopedRuntimeComponent.getScopeContainer() != null) {
                scopedRuntimeComponent.getScopeContainer().start();
            }
        }

        runtimeComponent.setStarted(true);
    }
View Full Code Here


                });                      
            }
        }

        if (component instanceof ScopedRuntimeComponent) {
            ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
            if (runtimeComponent.getScopeContainer() != null &&
                runtimeComponent.getScopeContainer().getLifecycleState() != ScopeContainer.STOPPED) {
                runtimeComponent.getScopeContainer().stop();
            }
        }

        ((RuntimeComponent)component).setStarted(false);
    }
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

        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;
            }
        }
View Full Code Here

    private void addScopeContainer(Component component) {
        if (!(component instanceof ScopedRuntimeComponent)) {
            return;
        }
        ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
        ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(runtimeComponent);
        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();
        runtimeComponent.setScopeContainer(null);
    }
View Full Code Here

               
            }
        }

        if (component instanceof ScopedRuntimeComponent) {
            ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
            if (runtimeComponent.getScopeContainer() != null &&
                    runtimeComponent.getScopeContainer().getLifecycleState() != ScopeContainer.STOPPED) {
                try {
                    runtimeComponent.getScopeContainer().stop();
                } catch (Throwable ex){
                    logger.log(Level.SEVERE, ex.getMessage(), ex);
                }                     
            }
        }
View Full Code Here

    public ScopeContainer getScopeContainer(RuntimeComponent runtimeComponent) {
        if (!(runtimeComponent instanceof ScopedRuntimeComponent)) {
            return null;
        }
        ScopedRuntimeComponent component = (ScopedRuntimeComponent)runtimeComponent;
        if (component.getScopeContainer() != null) {
            return component.getScopeContainer();
        }
        ImplementationProvider implementationProvider = component.getImplementationProvider();
        if (implementationProvider instanceof ScopedImplementationProvider) {
            ScopedImplementationProvider provider = (ScopedImplementationProvider)implementationProvider;
            Scope scope = provider.getScope();
            if (scope == null) {
                scope = Scope.STATELESS;
            } else if (scope.equals(Scope.INVALID)) {
              return null;
            }
            ScopeContainerFactory factory = scopeCache.get(scope);
            ScopeContainer container = factory.createScopeContainer(component);
            component.setScopeContainer(container);
            return container;
        }
        return null;
    }
View Full Code Here

            // Nothing
        } else {

            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);
            }

            // Check for conversational contract if conversational scope
//            if (scope.equals(Scope.CONVERSATION)) {
//                boolean hasConversationalContract = false;
View Full Code Here

TOP

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

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.