Package org.apache.tuscany.sca.monitor

Examples of org.apache.tuscany.sca.monitor.Monitor


    }

    private void processComponentServices(Composite composite, BuilderContext context) {

        Monitor monitor = context.getMonitor();
       
        for (Component component : composite.getComponents()) {

            try {
                monitor.pushContext("Component: " + component.getName().toString());
   
                // recurse for composite implementations
                Implementation implementation = component.getImplementation();
                if (implementation instanceof Composite) {
                    processComponentServices((Composite)implementation, context);
                }
   
                // create an endpoint for each component service binding
                for (ComponentService service : component.getServices()) {
                    try {
                        monitor.pushContext("Service: " + service.getName());
                       
                        //verify JAX-WS async assertions as in JavaCAA section 11.1
                        List<Operation> asyncOperations = null;
                        try {
                            asyncOperations = (List<Operation>) service.getInterfaceContract().getInterface().getAttributes().get("JAXWS-ASYNC-OPERATIONS");
                        }catch(Exception e) {
                            //ignore
                        }
                       
                        if(asyncOperations != null) {
                            if( ! asyncOperations.isEmpty()) {
       
                                //error JCA100006
       
                                //FIXME create a java validation message resource bundle
                                Monitor.error(monitor,
                                              this,
                                              BUILDER_VALIDATION_BUNDLE,
                                              "JaxWSClientAsyncMethodsNotAllowed",
                                              service,
                                              service.getName());                 
                            }
                        }
       
                        // We maintain all endpoints at the right level now
                        // but endpoints for promoting services must point down
                        // to the services they promote. This is not actually done
                        // until the wire is created though in order that the
                        // uri is calculated correctly
                        // Callback endpoints may not be added here in the case that the
                        // forward reference is not yet resolved.
                        for (Binding binding : service.getBindings()) {
                            Endpoint endpoint = assemblyFactory.createEndpoint();
                            endpoint.setComponent(component);
                            endpoint.setService(service);
                            endpoint.setBinding(binding);
                            endpoint.setUnresolved(false);
                            service.getEndpoints().add(endpoint);
                        } // end for
                    } finally {
                        monitor.popContext();
                    }                  
                }
            } finally {
                monitor.popContext();
            }                 
        }
    }
View Full Code Here


        buildPolicies(composite, context);
        return composite;
    }

    protected void computePolicies(Composite composite, BuilderContext context) {
        Monitor monitor = context.getMonitor();
        monitor.pushContext("Composite: " + composite.getName().toString());

        try {
            resolveAndCheck(composite, context);

            // compute policies recursively
            for (Component component : composite.getComponents()) {
                monitor.pushContext("Component: " + component.getName());

                //resolve component level
                resolveAndCheck(component, context);
               
                try {
                    Implementation implementation = component.getImplementation();
                   
                    for (ComponentService componentService : component.getServices()) {
                        monitor.pushContext("Service: " + componentService.getName());

                        try {
                            resolveAndCheck(componentService, context);

                            if (componentService.getInterfaceContract() != null) {
                                resolveAndCheck(componentService.getInterfaceContract().getInterface(), context);

                                resolveAndCheck(componentService.getInterfaceContract().getCallbackInterface(), context);

                            }

                            for (Endpoint ep : componentService.getEndpoints()) {
                             
                               
                                // Inherit from binding
                                inherit(ep, null, true, ep.getBinding());
                               
                                // Inherit from composite/component/service
                                inherit(ep, null, true, ep.getService(), ep.getComponent(), composite );
                               
                                if (componentService.getInterfaceContract() != null) {
                                    // Inherit from the component.service.interface
                                  // Do not check mutual exclusion here.. interfaces do not follow normal rules
                                  // of the structural hierarchy (Policy spec 4.10)
                                    inherit(ep, null, false, componentService.getInterfaceContract().getInterface());
                                }

                                // Replace profile intents with their required intents
                                // Replace unqualified intents if there is a qualified intent in the list
                                // Replace qualifiable intents with the default qualied intent
                                resolveAndNormalize(ep, context);
                               
                                // Replace qualifiable intents with their default qualifier
                                expandDefaultIntents(ep, context);
                               
                                // Remove the intents whose @contraints do not include the current element
                                removeConstrainedIntents(ep, context);
                               
                                // Remove any direct policy sets if an external one has been applied
                                removeDirectPolicySetsIfExternalExists(ep, context);
                               
                                // Validate that noListener is not specified on a service endpoint
                                checkForNoListenerIntent(ep, context);
                               
                                // check that all intents are resolved
                                checkIntentsResolved(ep, context);

                                // check that the resulting endpoint has no mutually exclusive intents
                                checkMutualExclusion(ep, context);
                            }
                        } finally {
                            monitor.popContext();
                        }
                    }

                    for (ComponentReference componentReference : component.getReferences()) {
                        monitor.pushContext("Reference: " + componentReference.getName().toString());

                        try {

                            if (componentReference.getInterfaceContract() != null) {
                                resolveAndCheck(componentReference.getInterfaceContract().getInterface(), context);

                                resolveAndCheck(componentReference.getInterfaceContract().getCallbackInterface(),
                                                context);
                            }

                            for (EndpointReference epr : componentReference.getEndpointReferences()) {
                                                            
                                // Inherit from binding
                                inherit(epr, null, true, epr.getBinding());

                                // Inherit from composite/component/reference
                                inherit(epr, null, true,  epr.getReference(), epr.getComponent(),  composite);
                               
                                // Inherit from the component.reference.interface
                                if (componentReference.getInterfaceContract() != null) {
                                  // Do not check mutual exclusion here.. interfaces do not follow normal rules
                                  // of the structural hierarchy (Policy spec 4.10)
                                    inherit(epr, null, true, componentReference.getInterfaceContract().getInterface());
                               

                                // Replace profile intents with their required intents
                                // Replace unqualified intents if there is a qualified intent in the list
                                // Replace qualifiable intents with the default qualified intent
                                resolveAndNormalize(epr, context);
                               
                                // Replace qualifiable intents with their default qualifier
                                expandDefaultIntents(epr, context);
                               
                                // Remove the intents whose @contraints do not include the current element
                                removeConstrainedIntents(epr, context);
                               
                                removeDirectPolicySetsIfExternalExists(epr, context);
                               
                                // check that all intents are resolved
                                checkIntentsResolved(epr, context);

                                // check that the resulting endpoint reference has no mutually exclusive intents
                                checkMutualExclusion(epr, context);
                            }
                        } finally {
                            monitor.popContext();
                        }
                    }

                    if (implementation instanceof Composite) {                                              
                      resolveAndCheck(implementation, context);
                        inherit(implementation, Intent.Type.implementation, true, component, composite);                                            
                        computePolicies((Composite)implementation, context);
                        expandDefaultIntents(implementation,context);
                        checkIntentsResolved(implementation,context);
                    } else {
                        resolveAndCheck(implementation, context);
                        if (implementation != null) {
                            inherit(implementation, Intent.Type.implementation, true, component, composite);
                           
                            // Remove the intents whose @contraints do not include the current element
                            removeConstrainedIntents(implementation, context);
                           
                            removeDirectPolicySetsIfExternalExists(implementation, context);
                           
                         // Replace qualifiable intents with their default qualifier
                            expandDefaultIntents(implementation, context);
                           
                            // check that all intents are resolved
                            checkIntentsResolved(implementation, context);
                        }
                    }
                } finally {
                    monitor.popContext();
                }
            }
            removeConstrainedIntents(composite, context);
        } finally {
            monitor.popContext();
        }
    }
View Full Code Here

        if (contributions == null) {
            // Load contributions
            contributions = loadContributions(configuration, context);
        }
       
        Monitor monitor = context.getMonitor();
        Map<QName, List<String>> bindingBaseURIs = new HashMap<QName, List<String>>();
        for (BindingConfiguration config : configuration.getBindings()) {
            bindingBaseURIs.put(config.getBindingType(), config.getBaseURIs());
        }
        List<Contribution> allContributions = getAllContributions(configuration.getDomainURI());
View Full Code Here

    public String installContribution(String uri, String contributionURL, String metaDataURL, List<String> dependentContributionURIs, boolean runDeployables) throws ContributionReadException, ActivationException, ValidationException {
        if (uri == null) {
            uri = getDefaultContributionURI(contributionURL);
        }
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(IOHelper.createURI(uri), IOHelper.getLocationAsURL(contributionURL), monitor);
        monitor.analyzeProblems();
        if (metaDataURL != null) {
            mergeContributionMetaData(metaDataURL, contribution);
        }
        installContribution(contribution, dependentContributionURIs, runDeployables);
        return uri;
View Full Code Here

        return uri;
    }

    private void mergeContributionMetaData(String metaDataURL, Contribution contribution) throws ValidationException {
        ContributionMetadata metaData;
        Monitor monitor = deployer.createMonitor();
        try {
            metaData = deployer.loadXMLDocument(IOHelper.getLocationAsURL(metaDataURL), monitor);
        } catch (Exception e) {
            throw new ValidationException(e);
        }
        monitor.analyzeProblems();
        contribution.getDeployables().addAll(metaData.getDeployables());
        contribution.getImports().addAll(metaData.getImports());
        contribution.getExports().addAll(metaData.getExports());
    }
View Full Code Here

        } else {
            contribution.getDeployables().clear();
           
            List<Contribution> dependentContributions = calculateDependentContributions(ic);

            Monitor monitor = deployer.createMonitor();
            try {
                deployer.resolve(contribution, dependentContributions, monitor);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            monitor.analyzeProblems();
        }
        return ic.getURI();
    }
View Full Code Here

        }
        return dependentContributions;
    }

    public String addDeploymentComposite(String contributionURI, Reader compositeXML) throws ContributionReadException, XMLStreamException, ActivationException, ValidationException {
        Monitor monitor = deployer.createMonitor();
        Composite composite = deployer.loadXMLDocument(compositeXML, monitor);
        monitor.analyzeProblems();
        return addDeploymentComposite(contributionURI, composite);
    }
View Full Code Here

        List<Contribution> contribution = new ArrayList<Contribution>();
        contribution.add(installedContribution.getContribution());
        contribution.get(0).getDeployables().clear();
        contribution.get(0).getDeployables().add(composite);
       
        Monitor monitor = deployer.createMonitor();
// TODO: is the ContextMonitor neccessary here?        
//        Monitor tcm = monitorFactory.setContextMonitor(monitor);
//        try {
           
            domainComposite = deployer.build(contribution, dependedOnContributions, new HashMap<QName, List<String>>(), monitor);
            monitor.analyzeProblems();

//        } finally {
//            monitorFactory.setContextMonitor(tcm);
//        }
       
View Full Code Here

    }
   
    private JavaInterface resolveJavaInterface(JavaInterface javaInterface, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
       
        if (javaInterface != null && javaInterface.isUnresolved()) {
            Monitor monitor = context.getMonitor();
            // Resolve the Java interface
            javaInterface = resolver.resolveModel(JavaInterface.class, javaInterface, context);
            if (javaInterface.isUnresolved()) {

                // If the Java interface has never been resolved yet, do it now
View Full Code Here

    }

    public void resolve(JavaInterfaceContract javaInterfaceContract, ModelResolver resolver, ProcessorContext context)
        throws ContributionResolveException {
        try {
            Monitor monitor = context.getMonitor();
            // Resolve the interface and callback interface
            JavaInterface javaInterface =
                resolveJavaInterface((JavaInterface)javaInterfaceContract.getInterface(), resolver, context);
            javaInterfaceContract.setInterface(javaInterface);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.monitor.Monitor

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.