Package org.apache.tuscany.sca.contribution.updater

Examples of org.apache.tuscany.sca.contribution.updater.ComponentNotFoundException


        // 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")) {
                 * Clazz cget } implementationProvider.getClass(). if
                 * (implementationProvider instanceof
                 * JavaImplementationProvider) { ((JavaImplementationProvider)
                 * implementationProvider). startReference(targetReference); }
                 */
            }
            return targetReference;
        } else {
            throw new ComponentNotFoundException("Not found component "
                    + componentName + " for update");
        }
    }
View Full Code Here


        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;
                }
            }
            if (toRemove != null) {
                CompositeActivatorImpl activator = (CompositeActivatorImpl) compositeActivator;
                activator.stop(source, toRemove);
                activator.deactivate(source,
                        (RuntimeComponentReference) toRemove);
                compositeBuilder.detachWire(composite, source, toRemove);
            } else {
                throw new ComponentNotFoundException("Not found component "
                        + componentName + " for update");
            }

        }
        return toRemove;
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.updater.ComponentNotFoundException

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.