Examples of RuntimeComponent


Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    }

    private ScopeContainer<Object> getConversationalScopeContainer(RuntimeWire wire) {
        ScopeContainer<Object> scopeContainer = null;

        RuntimeComponent runtimeComponent = wire.getSource().getComponent();

        if (runtimeComponent instanceof ScopedRuntimeComponent) {
            ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)runtimeComponent;
            ScopeContainer<Object> tmpScopeContainer = scopedRuntimeComponent.getScopeContainer();
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

                chains.add(chain);
            }
        } else {
            // It's the service wire
            RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
            RuntimeComponent serviceComponent = wireTarget.getComponent();
            Binding serviceBinding = wireTarget.getBinding();
            for (Operation operation : sourceContract.getInterface().getOperations()) {
                Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
                if (targetOperation == null) {
                    throw new ServiceRuntimeException("No matching operation for " + operation.getName()
                        + " is found in service "
                        + serviceComponent.getURI()
                        + "#"
                        + service.getName());
                }
                InvocationChain chain = new InvocationChainImpl(operation, targetOperation, false);
                if (operation.isNonBlocking()) {
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

                .getProcessor(Component.class);

        Contribution contrib = contributionService.getContribution(contribURI);

        List<DeployedArtifact> artifacts = contrib.getArtifacts();
        RuntimeComponent source = null;
        Composite composite = ArtifactsFinder.findComposite(compositeURI,
                artifacts);
        // TODO error handling
        if (composite != null)
            source = (RuntimeComponent) ArtifactsFinder.findComponent(
                    composite, componentName);
        else {
            throw new ComponentNotFoundException("Not found component "
                    + componentName + " for update");
        }
        if (source != null) {
            // Debig this
            RuntimeComponentReference targetReference = (RuntimeComponentReference) assemblyFactory
                    .createComponentReference();
            targetReference.setName(referenceName);
            targetReference.setUnresolved(true);
            Reference reference = null;
            try {
                reference = buildReference(referenceName, className,
                        interfaceName, true);
            } catch (Exception e) {
                throw new ComponentUpdaterException(e.getMessage());
            }
            source.getImplementation().getReferences().add(reference);

            // targetService.
            ComponentService targetService = assemblyFactory
                    .createComponentService();
            targetService.setUnresolved(true);
            targetService.setName(targetComponent);
            targetReference.getTargets().add(targetService);

            // reconciliate
            reconcileReference(reference, targetReference, componentName);
            // create component reference for the reference
            source.getReferences().add(targetReference);
            try {
                processor.resolveReference(targetReference, contrib
                        .getModelResolver());
            } catch (ContributionResolveException e) {
                throw new ComponentUpdaterException(
                        "Contribution Resolving Exception while updating..");
            }

            CompositeActivatorImpl activator = (CompositeActivatorImpl) compositeActivator;
            compositeBuilder.attachWire(source, composite, targetReference);
            activator.activate(source, targetReference);
            synchronized (source) {
                activator.configureComponentContext(source);
            }
            // RuntimeComponentReference runtimeRef =
            // ((RuntimeComponentReference)ref);
            // runtimeRef.setComponent(component);
            for (Binding binding : targetReference.getBindings()) {
                ReferenceBindingProvider bindingProvider = targetReference
                        .getBindingProvider(binding);
                if (bindingProvider != null) {
                    bindingProvider.start();
                }

            }

            ImplementationProvider implementationProvider = source
                    .getImplementationProvider();
            if (implementationProvider != null) {
                /*
                 * con la reflection cosi tolgo la dipendneza if
                 * ((implementationProvider.getClass().getName().equals("JavaImplementationProvider")) {
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public ComponentReference removeReferenceWire(String referenceName,
            String targetComponent) throws ComponentUpdaterException,
            ComponentNotFoundException {
        List<DeployedArtifact> artifacts = contributionService.getContribution(
                contribURI).getArtifacts();
        RuntimeComponent source = null;
        Composite composite = ArtifactsFinder.findComposite(compositeURI,
                artifacts);
        ComponentReference toRemove = null;

        if (composite != null) {
            source = (RuntimeComponent) ArtifactsFinder.findComponent(
                    composite, this.componentName);
        } else {
            throw new ComponentNotFoundException("Not found component "
                    + componentName + " for update");
        }
        if ((source != null) && (targetComponent != null)) {
            /* source target refenence */

            List<ComponentReference> references = source.getReferences();
            for (ComponentReference ref : references) {
                if (ref.getName().equals(targetComponent)) {
                    toRemove = ref;
                    break;
                }
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public RuntimeComponent read(XMLStreamReader streamReader) throws IOException {
        try {
            StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
            Composite composite = processor.read(streamReader);
            RuntimeComponent component = (RuntimeComponent)composite.getComponents().get(0);
            return component;
        } catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

        if (message != null) {
            EndpointReference to = message.getTo();
            if (to == null) {
                return null;
            }
            RuntimeComponent component = message.getTo().getComponent();
            return component;
        }
        return null;
    }
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

        }
        return null;
    }

    public static CompositeActivator getCurrentCompositeActivator() {
        RuntimeComponent component = getCurrentComponent();
        if (component != null) {
            ComponentContextImpl context = (ComponentContextImpl)component.getComponentContext();
            return context.getCompositeActivator();
        }
        return null;
    }
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public <B> CallableReference<B> getServiceReference() {
        Message msgContext = ThreadMessageContext.getMessageContext();
        // FIXME: [rfeng] Is this the service reference matching the caller side?
        EndpointReference to = msgContext.getTo();
        RuntimeComponentService service = (RuntimeComponentService) to.getContract();
        RuntimeComponent component = (RuntimeComponent) to.getComponent();
       
        CallableReference<B> callableReference = component.getComponentContext().getCallableReference(null, component, service);
        ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
        ((CallableReferenceImpl<B>) callableReference).attachCallbackID(parameters.getCallbackID());
        if (callableReference.getConversation() != null) {
            ((CallableReferenceImpl<B>) callableReference).attachConversationID(parameters.getConversationID());
        }
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public void start(Component component) {
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("Starting component: " + component.getURI());
        }
        RuntimeComponent runtimeComponent = ((RuntimeComponent)component);
        if(runtimeComponent.isStarted()) {
          return;
        }
       
        configureComponentContext(runtimeComponent);

        for (ComponentReference reference : component.getReferences()) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
            }
            RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
            runtimeRef.setComponent(runtimeComponent);
            for (Binding binding : reference.getBindings()) {
                ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
                if (bindingProvider != null) {
                    bindingProvider.start();
                }
            }
        }

        for (ComponentService service : component.getServices()) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Starting component service: " + component.getURI() + "#" + service.getName());
            }
            RuntimeComponentService runtimeService = (RuntimeComponentService)service;
            for (Binding binding : service.getBindings()) {
                ServiceBindingProvider bindingProvider = runtimeService.getBindingProvider(binding);
                if (bindingProvider != null) {
                    bindingProvider.start();
                }
            }
        }

        Implementation implementation = component.getImplementation();
        if (implementation instanceof Composite) {
            start((Composite)implementation);
        } else {
            ImplementationProvider implementationProvider = runtimeComponent.getImplementationProvider();
            if (implementationProvider != null) {
                implementationProvider.start();
            }
        }

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

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

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    @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();
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.