Package org.apache.tuscany.sca.definitions

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


        InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
        DocumentBuilderFactory documentBuilderFactory = factories.getFactory(DocumentBuilderFactory.class);
        TransformerFactory transformerFactory = factories.getFactory(TransformerFactory.class);
       
        //Create a composite builder
        SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
        for ( SCADefinitions definition : ((List<SCADefinitions>)policyDefinitions) ) {
            SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
        }
        compositeBuilder = ReallySmallRuntimeBuilder.createCompositeBuilder(monitor,
                                                                            assemblyFactory,
View Full Code Here


        try {
            URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
            URLArtifactProcessor<SCADefinitions> definitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
            SCADefinitionsProviderExtensionPoint scaDefnProviders = registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);
           
            SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
            SCADefinitions aSCADefn = null;
            for ( SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders() ) {
               aSCADefn = aProvider.getSCADefinition();
               SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
            }
           
View Full Code Here

        TransformerFactory transformerFactory = factories.getFactory(TransformerFactory.class);
        UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
        InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);

        //Create a composite builder
        SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
        for (SCADefinitions definition : ((List<SCADefinitions>)policyDefinitions)) {
            SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
        }
        compositeBuilder =
            RuntimeBuilder.createCompositeBuilder(monitor,
View Full Code Here

            URLArtifactProcessor<SCADefinitions> definitionsProcessor =
                documentProcessors.getProcessor(SCADefinitions.class);
            SCADefinitionsProviderExtensionPoint scaDefnProviders =
                registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);

            SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
            SCADefinitions aSCADefn = null;
            for (SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders()) {
                aSCADefn = aProvider.getSCADefinition();
                SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
            }
View Full Code Here

            registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
        urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
    }

    public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
        SCADefinitions scaDefns = null;
        SCADefinitions tuscanyDefns = null;
        try {
            // Allow privileged access to load resource. Requires
            // RuntimePermssion in security policy.
            URL definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction<URL>() {
                public URL run() {
View Full Code Here

        this.monitor = monitor;
    }

    public SCADefinitions read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        QName name = null;
        SCADefinitions definitions = null;
        String targetNamespace = null;

        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT: {
                    name = reader.getName();
                    if ( SCA_DEFINITIONS_QNAME.equals(name)) {
                        definitions = new SCADefinitionsImpl();
                        targetNamespace = reader.getAttributeValue(null, TARGET_NAMESPACE);
                        definitions.setTargetNamespace(targetNamespace);
                    } else {
                        Object extension = extensionProcessor.read(reader);
                        if (extension != null) {
                            if ( extension instanceof Intent ) {
                                Intent intent = (Intent)extension;
                                intent.setName(new QName(targetNamespace,
                                                                      intent.getName().getLocalPart()));
                                if ( intent instanceof QualifiedIntent ) {
                                    QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
                                    qualifiedIntent.getQualifiableIntent().
                                            setName(new QName(targetNamespace,
                                                              qualifiedIntent.getQualifiableIntent().getName().getLocalPart()));
                                }
                               
                                // FIXME: Workaround for TUSCANY-2499
                                intent.setUnresolved(false);
                               
                                definitions.getPolicyIntents().add(intent);
                            } else if ( extension instanceof PolicySet ) {
                                PolicySet policySet = (PolicySet)extension;
                                policySet.setName(new QName(targetNamespace,
                                                            policySet.getName().getLocalPart()));
                                definitions.getPolicySets().add(policySet);
                            } else if ( extension instanceof Binding ) {
                                Binding binding = (Binding)extension;
                                if (binding instanceof DefinitionElement)
                                    ((DefinitionElement)binding).setTargetNamespace(targetNamespace);
                                definitions.getBindings().add(binding);
                            } else if ( extension instanceof IntentAttachPointType ) {
                                IntentAttachPointType type = (IntentAttachPointType)extension;
                                if ( type.getName().getLocalPart().startsWith(BINDING)) {
                                    definitions.getBindingTypes().add((IntentAttachPointType)extension);
                                } else if ( type.getName().getLocalPart().startsWith(IMPLEMENTATION)) {
                                    definitions.getImplementationTypes().add((IntentAttachPointType)extension);
                                }
                            }
                        }
                        break;
                    }
View Full Code Here

                    // Add policy definitions to the list of policy definitions
                    if (model instanceof SCADefinitions) {
                        policyDefinitions.add(model);

                        SCADefinitions definitions = (SCADefinitions)model;
                        for (Intent intent : definitions.getPolicyIntents() ) {
                            policyDefinitionsResolver.addModel(intent);
                        }

                        for (PolicySet policySet : definitions.getPolicySets() ) {
                            policyDefinitionsResolver.addModel(policySet);
                        }

                        for (IntentAttachPointType attachPointType : definitions.getBindingTypes() ) {
                            policyDefinitionsResolver.addModel(attachPointType);
                        }

                        for (IntentAttachPointType attachPointType : definitions.getImplementationTypes() ) {
                            policyDefinitionsResolver.addModel(attachPointType);
                        }
                        for (Object binding : definitions.getBindings() ) {
                            policyDefinitionsResolver.addModel(binding);
                        }
                    }
                }
            }
View Full Code Here

            }
           
            //urlStream = createInputStream(url);
            XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
           
            SCADefinitions definitions = new SCADefinitionsImpl();
            QName name = null;
            int event;
            while ( reader.hasNext() ) {
                event = reader.next();
               
                if ( event == XMLStreamConstants.START_ELEMENT  ||
                    event == XMLStreamConstants.END_ELEMENT ) {
                    name = reader.getName();
                    if ( name.equals(DEFINITIONS_QNAME) ) {
                        if ( event == XMLStreamConstants.END_ELEMENT ) {
                            return definitions;
                        }
                    } else {
                        SCADefinitions aDefn = (SCADefinitions)extensionProcessor.read(reader);
                        SCADefinitionsUtil.aggregateSCADefinitions(aDefn, definitions);
                    }
                }
            }
           
View Full Code Here

        this.monitor = monitor;
    }

    public SCADefinitions read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        QName name = null;
        SCADefinitions definitions = null;
        String targetNamespace = null;

        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT: {
                    name = reader.getName();
                    if ( SCA_DEFINITIONS_QNAME.equals(name)) {
                        definitions = new SCADefinitionsImpl();
                        targetNamespace = reader.getAttributeValue(null, TARGET_NAMESPACE);
                        definitions.setTargetNamespace(targetNamespace);
                    } else {
                        Object extension = extensionProcessor.read(reader);
                        if (extension != null) {
                            if ( extension instanceof Intent ) {
                                Intent intent = (Intent)extension;
                                intent.setName(new QName(targetNamespace,
                                                                      intent.getName().getLocalPart()));
                                if ( intent instanceof QualifiedIntent ) {
                                    QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
                                    qualifiedIntent.getQualifiableIntent().
                                            setName(new QName(targetNamespace,
                                                              qualifiedIntent.getQualifiableIntent().getName().getLocalPart()));
                                }
                               
                                definitions.getPolicyIntents().add(intent);
                            } else if ( extension instanceof PolicySet ) {
                                PolicySet policySet = (PolicySet)extension;
                                policySet.setName(new QName(targetNamespace,
                                                            policySet.getName().getLocalPart()));
                                definitions.getPolicySets().add(policySet);
                            } else if ( extension instanceof IntentAttachPointType ) {
                                IntentAttachPointType type = (IntentAttachPointType)extension;
                                if ( type.getName().getLocalPart().startsWith(BINDING)) {
                                    definitions.getBindingTypes().add((IntentAttachPointType)extension);
                                } else if ( type.getName().getLocalPart().startsWith(IMPLEMENTATION)) {
                                    definitions.getImplementationTypes().add((IntentAttachPointType)extension);
                                }
                            }
                        }
                        break;
                    }
View Full Code Here

            public URL run() {
                return getClass().getClassLoader().getResource(definitionsFile);
            }
        });

        SCADefinitions scaDefn = null;
        try {
            final URI uri = new URI(definitionsFile);
            // Allow bindings to read properties. Requires PropertyPermission read in security policy.
            scaDefn = AccessController.doPrivileged(new PrivilegedExceptionAction<SCADefinitions>() {
                public SCADefinitions run() throws ContributionReadException {
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.definitions.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.