Package org.apache.tuscany.sca.assembly.xml

Examples of org.apache.tuscany.sca.assembly.xml.MetaComponentProcessor


            String className, Class<?> interfaceName, String targetComponent)
            throws ComponentUpdaterException, ComponentNotFoundException {

        StAXArtifactProcessorExtensionPoint staxProcessors = registry
                .getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
        MetaComponentProcessor processor = (MetaComponentProcessor) staxProcessors
                .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..");
            }
View Full Code Here


    public Component addComponent(MetaComponent c)
            throws CompositeUpdaterException {
        StAXArtifactProcessorExtensionPoint staxProcessors = registry
                .getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
        MetaComponentProcessor processor = (MetaComponentProcessor) staxProcessors
                .getProcessor(Component.class);
        Contribution contrib = contribService.getContribution(contribURI);
        List<DeployedArtifact> artifacts = contrib.getArtifacts();
        Composite composite = ArtifactsFinder.findComposite(compositeURI,
                artifacts);
        boolean found = false;

        if (composite == null)
            throw new CompositeUpdaterException(
                    "Composite not found in contribution" + contribURI);
        else {
            processor.setComposite(composite);
            try {
                processor.read(c.build());
            } catch (Exception e) {
                throw new CompositeUpdaterException(
                        "Component error parsing in contribution" + contribURI);

            }
            found = true;
        }

        if (found) {
            Component component = processor.getParsedComponent();
            Composite augmentedComposite = processor.getParsedComposite();
            try {
                processor.resolve(component, contrib.getModelResolver());
                compositeBuilder.attach(augmentedComposite, component);
                ((CompositeActivatorImpl) compositeActivator)
                        .activateComponent(component);
            } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.assembly.xml.MetaComponentProcessor

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.