Package org.apache.tuscany.sca.monitor

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


        intent.getConstrainedTypes().clear();
        intent.getConstrainedTypes().addAll(resolvedTypes);
    }

    private void resolveProfileIntent(Intent intent, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
        Monitor monitor = context.getMonitor();
        // FIXME: Need to check for cyclic references first i.e an A requiring B
        // and then B requiring A...
        if (intent != null && !intent.getRequiredIntents().isEmpty()) {
            // resolve all required intents
            List<Intent> requiredIntents = new ArrayList<Intent>();
View Full Code Here


    public Monitor getMonitor() {
        return monitor;
    }

    public Monitor setMonitor(Monitor monitor) {
        Monitor old = this.monitor;
        this.monitor = monitor;
        return old;
    }
View Full Code Here

    }

    public PolicySet read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException,
        XMLStreamException {
        PolicySet policySet = null;
        Monitor monitor = context.getMonitor();
        String policySetName = reader.getAttributeValue(null, NAME);
        String appliesTo = reader.getAttributeValue(null, APPLIES_TO);
        if (policySetName == null || appliesTo == null) {
            if (policySetName == null)
                error(monitor, "PolicySetNameMissing", reader);
View Full Code Here

        return "__sca";
    }

  public void readIntentMap(XMLStreamReader reader, PolicySet policySet, Intent mappedIntent, ProcessorContext context)
        throws ContributionReadException {
        Monitor monitor = context.getMonitor();
        QName name = reader.getName();
        if (POLICY_INTENT_MAP_QNAME.equals(name)) {

            IntentMap intentMap = policyFactory.createIntentMap();
            QName intentName = getQName(reader, INTENT_MAP);
View Full Code Here

        }
    }

    private void resolveIntentsInMappedPolicies(PolicySet policySet, ModelResolver resolver, ProcessorContext context)
        throws ContributionResolveException {
        Monitor monitor = context.getMonitor();
        for (IntentMap intentMap : policySet.getIntentMaps()) {
            Intent intent = intentMap.getProvidedIntent();
            if (intent.isUnresolved()) {
                Intent resolved = resolver.resolveModel(Intent.class, intent, context);
                if (!resolved.isUnresolved() || resolved != intent) {
View Full Code Here

        }
    }

    public Definitions read(URL contributionURL, final URI uri, final URL url, ProcessorContext context) throws ContributionReadException {
        InputStream urlStream = null;
        Monitor monitor = context.getMonitor();
        monitor.pushContext("Definitions: " + url);
        try {
            // Allow privileged access to open URL stream. Add FilePermission to added to security
            // policy file.
            try {
                urlStream = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
                    public InputStream run() throws IOException {
                        return IOHelper.openStream(url);
                    }
                });
            } catch (PrivilegedActionException e) {
                error(monitor, "PrivilegedActionException", url, (IOException)e.getException());
                throw (IOException)e.getException();
            }

            //urlStream = createInputStream(url);
            XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
            ValidatingXMLInputFactory.setMonitor(reader, context.getMonitor());
            Definitions definitions = definitionsFactory.createDefinitions();
            int event = reader.getEventType();
            while (reader.hasNext()) {
                event = reader.next();

                // We only deal with the root element
                if (event == XMLStreamConstants.START_ELEMENT) {
                    // QName name = reader.getName();
                    Object model = extensionProcessor.read(reader, context);
                    if (model instanceof Definitions) {
                        DefinitionsUtil.aggregate((Definitions)model, definitions, monitor);
                        return definitions;
                    } else {
                        error(monitor, "ContributionReadException", model, null);
                    }
                }
            }

            return definitions;
        } catch (XMLStreamException e) {
            ContributionReadException ce = new ContributionReadException(e);
            error(monitor, "ContributionReadException", inputFactory, ce);
            throw ce;
        } catch (IOException e) {
            ContributionReadException ce = new ContributionReadException(e);
            error(monitor, "ContributionReadException", inputFactory, ce);
            throw ce;
        } finally {

            try {
                if (urlStream != null) {
                    urlStream.close();
                    urlStream = null;
                }
            } catch (IOException ioe) {
                //ignore
            }
           
            monitor.popContext();
        }
    }
View Full Code Here

        writer.writeEndElement();
    }

    public void resolve(JavaImplementation javaImplementation, ModelResolver resolver, ProcessorContext context)
        throws ContributionResolveException {
        Monitor monitor = context.getMonitor();
      try {
          ClassReference classReference = new ClassReference(javaImplementation.getName());
          classReference = resolver.resolveModel(ClassReference.class, classReference, context);
          Class<?> javaClass = classReference.getJavaClass();
          if (javaClass == null) {
View Full Code Here

    }

    public PolicySet read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException,
        XMLStreamException {
        PolicySet policySet = null;
        Monitor monitor = context.getMonitor();
        String policySetName = reader.getAttributeValue(null, NAME);
        String appliesTo = reader.getAttributeValue(null, APPLIES_TO);
        if (policySetName == null || appliesTo == null) {
            if (policySetName == null)
                error(monitor, "PolicySetNameMissing", reader);
View Full Code Here

        return "__sca";
    }

  public void readIntentMap(XMLStreamReader reader, PolicySet policySet, Intent mappedIntent, ProcessorContext context)
        throws ContributionReadException {
        Monitor monitor = context.getMonitor();
        QName name = reader.getName();
        if (POLICY_INTENT_MAP_QNAME.equals(name)) {

            IntentMap intentMap = policyFactory.createIntentMap();
            QName intentName = getQName(reader, INTENT_MAP);
View Full Code Here

        }
    }

    private void resolveIntentsInMappedPolicies(PolicySet policySet, ModelResolver resolver, ProcessorContext context)
        throws ContributionResolveException {
        Monitor monitor = context.getMonitor();
        for (IntentMap intentMap : policySet.getIntentMaps()) {
            Intent intent = intentMap.getProvidedIntent();
            if (intent.isUnresolved()) {
                Intent resolved = resolver.resolveModel(Intent.class, intent, context);
                if (!resolved.isUnresolved() || resolved != intent) {
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.