Package org.apache.tuscany.sca.policy

Examples of org.apache.tuscany.sca.policy.SCADefinitions


        InputStream urlStream = null;
        try {
            urlStream = url.openStream();
            XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
            reader.nextTag();
            SCADefinitions scaDefns = (SCADefinitions)extensionProcessor.read(reader);
           
            return scaDefns;
        } catch (XMLStreamException e) {
            throw new ContributionReadException(e);
        } catch (IOException e) {
View Full Code Here


        return getQNameValue(reader, qname);
    }
   
    public SCADefinitions read(XMLStreamReader reader) throws ContributionReadException {
        QName name = null;
        SCADefinitions scaDefns = null;
        try {
            // Read the composite document
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
                    case START_ELEMENT: {
                        name = reader.getName();
                        if ( SCA_DEFNS_QNAME.equals(name)) {
                            scaDefns = new SCADefinitionsImpl();
                            try {
                                scaDefns.setTargetNamespace(new URI(reader.getAttributeValue(null, TARGET_NAMESPACE)));
                            } catch ( URISyntaxException e ) {
                                throw new ContributionReadException(e);
                            }
                        } else {
                            Object extension = extensionProcessor.read(reader);
                            if (extension != null) {
                                if ( extension instanceof Intent ) {
                                    scaDefns.getPolicyIntents().add((Intent)extension);
                                } else if ( extension instanceof PolicySet ) {
                                    scaDefns.getPolicySets().add((PolicySet)extension);
                                } else if ( extension instanceof IntentAttachPointType ) {
                                    IntentAttachPointType type = (IntentAttachPointType)extension;
                                    if ( type.getName().getLocalPart().startsWith(BINDING)) {
                                        scaDefns.getBindingTypes().add((IntentAttachPointType)extension);
                                    } else if ( type.getName().getLocalPart().startsWith(IMPLEMENTATION)) {
                                        scaDefns.getImplementationTypes().add((IntentAttachPointType)extension);
                                    }
                                }
                               
                                if ( getDefinitionsResolver() != null ) {
                                    getDefinitionsResolver().addModel(extension);
View Full Code Here

    private void loadDomainDefinitions(SCADefinitionsDocumentProcessor scaDocDefnProcessor) throws ActivationException {
        URL url = this.classLoader.getResource("definitions.xml");
       
        if ( url != null ) {
            try {
                SCADefinitions scaDefinitions = scaDocDefnProcessor.read(null, null, url);
                scaDocDefnProcessor.resolve(scaDefinitions, scaDocDefnProcessor.getDomainModelResolver());
            } catch ( ContributionReadException e ) {
                throw new ActivationException(e);
            } catch ( ContributionResolveException e ) {
                throw new ActivationException(e);
View Full Code Here

        Composite composite = (Composite)documentProcessor.read(null, uri, url);
        assertNotNull(composite);
       
        url = getClass().getResource("definitions.xml");
        uri = URI.create("definitions.xml");
        SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
        assertNotNull(scaDefns);
       
        preResolvePolicyTests(composite);
        documentProcessor.resolve(scaDefns, resolver);
        documentProcessor.resolve(composite, resolver);
View Full Code Here

        composite = (Composite)documentProcessor.read(null, uri, url);
        assertNotNull(composite);
       
        url = getClass().getResource("AnotherDefinitions.xml");
        uri = URI.create("AnotherDefinitions.xml");
        SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
        assertNotNull(scaDefns);
       
        //preResolvePolicyTests(composite);
        documentProcessor.resolve(scaDefns, resolver);
        documentProcessor.resolve(composite, resolver);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.policy.SCADefinitions

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.