Package org.apache.tuscany.sca.monitor

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


    public void validateContribution(String contributionURI) throws ContributionReadException, ValidationException {
        ContributionDescription cd = getInstalledContribution(contributionURI);
        Contribution contribution = loadContribution(cd);

        Monitor monitor = deployer.createMonitor();
        try {
            deployer.resolve(contribution, calculateDependentContributions(cd), monitor);
        } catch (Exception e) {
            loadedContributions.remove(cd.getURI());
            throw new RuntimeException(e);
        }
        try {
            monitor.analyzeProblems();
        } catch (ValidationException e) {
            loadedContributions.remove(cd.getURI());
            throw e;
        }
    }
View Full Code Here


    }

    protected Contribution loadContribution(ContributionDescription cd) throws ContributionReadException, ValidationException {
        Contribution contribution = loadedContributions.get(cd.getURI());
        if (contribution == null) {
            Monitor monitor = deployer.createMonitor();
            contribution = deployer.loadContribution(IOHelper.createURI(cd.getURI()), IOHelper.getLocationAsURL(cd.getURL()), monitor);
           
            // TODO: should the monitor be checked? If it is then the peek in to get the metadata doesn't work if there's a problem
            // monitor.analyzeProblems();
            if (cd.getAdditionalDeployables().size() > 0) {
View Full Code Here

            configure(compositeReference, reference, null, context);
        }
    }

    public void configure(Component component, BuilderContext context) {
        Monitor monitor = context.getMonitor();
       
        // fix up the component type by copying all implementation level
        // interaction intents to *all* the component type services
        for (ComponentService componentService : component.getServices()) {
            monitor.pushContext("Service: " + componentService.getName());
            try {
                configure(componentService, component.getImplementation(), Intent.Type.interaction, context);
                removeConstrainedIntents(componentService, context);
            } finally {
                monitor.popContext();
            }           
        }
       
        // Inherit the intents and policySets from the componentType
        for (ComponentReference componentReference : component.getReferences()) {
            monitor.pushContext("Reference: " + componentReference.getName());
            try {
                configure(componentReference, context);
                removeConstrainedIntents(componentReference, context);
            } finally {
                monitor.popContext();
            }
        }
       
        for (ComponentService componentService : component.getServices()) {
            monitor.pushContext("Service: " + componentService.getName());
            try {
                configure(componentService, context);
                removeConstrainedIntents(componentService, context);
            } 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

     * @Param parentComposite the composite that contains the component being configured. Required for property processing
     * @param component the component to be configured
     */
    public void configureComponentFromComponentType(Component outerComponent, Composite parentComposite, Component component, BuilderContext context) {

        Monitor monitor = context.getMonitor();
        monitor.pushContext("Component: " + component.getName().toString());
       
        try {
            // do any work we need to do before we calculate the component type
            // for this component. Anything that needs to be pushed down the promotion
            // hierarchy must be done before we calculate the component type
           
            // check that the implementation is present
            if (!isComponentImplementationPresent(component, monitor)){
                return;
            }
   
            // carry out any implementation specific builder processing
            Implementation impl = component.getImplementation();
            if (impl != null) {
                ImplementationBuilder builder = builders.getImplementationBuilder(impl.getType());
                if (builder != null) {
                    builder.build(component, impl, context);
                }
            }
   
            // Properties on the composite component type are not affected by the components
            // that the composite contains. Instead the child components might source 
            // composite level property values. Hence we have to calculate whether the component
            // type property value should be overridden by this component's property value
            // before we go ahead and calculate the component type
            configureProperties(outerComponent, parentComposite, component, monitor);
   
            // create the component type for this component
            // taking any nested composites into account
            createComponentType(component, context);
   
            // configure services based on the calculated component type
            configureServices(component, context);
   
            // configure services based on the calculated component type
            configureReferences(component, context);
           
            // NOTE: configureServices/configureReferences may add callback references and services
           
            // inherit the intents and policy sets from the component type
            policyBuilder.configure(component, context);
           
        } finally {
            monitor.popContext();
        }        
    }
View Full Code Here

     * component type and the configuration from the composite file
     *
     * @param component
     */
    private void configureServices(Component component, BuilderContext context) {
        Monitor monitor = context.getMonitor();

        // If the component type has services that are not described in this
        // component then create services for this component
        addServicesFromComponentType(component, monitor);

View Full Code Here

     * component type and the configuration from the composite file
     *
     * @param component
     */
    private void configureReferences(Component component, BuilderContext context) {
        Monitor monitor = context.getMonitor();
       
        // If the component type has references that are not described in this
        // component then create references for this component
        addReferencesFromComponentType(component, monitor);

View Full Code Here

     *
     * @param componentService the top service
     * @param componentTypeService the bottom service
     */
    private void calculateBindings(Component component, Service componentService, Service componentTypeService, BuilderContext context) {
      Monitor monitor = context.getMonitor();
     
        // forward bindings
        if (componentService.getBindings().isEmpty()) {
            componentService.getBindings().addAll(componentTypeService.getBindings());
        }
View Full Code Here

    public Class<JMSBinding> getModelType() {
        return JMSBinding.class;
    }

    public JMSBinding read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        Monitor monitor = context.getMonitor();
        JMSBinding jmsBinding = new JMSBinding();
        // Reset validation message to keep track of validation issues.

        // Read policies
        policyProcessor.readPolicies(jmsBinding, reader);
View Full Code Here

      error(monitor, "InvalidCreate", reader, create);
  }

    private void parseResponse(XMLStreamReader reader, JMSBinding jmsBinding, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        // Read sub-elements of response
        Monitor monitor = context.getMonitor();
        while (true) {
            switch (reader.next()) {
                case START_ELEMENT:
                    String elementName = reader.getName().getLocalPart();
                    if ("destination".equals(elementName)) {
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.