Package org.apache.tuscany.sca.definitions

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


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

    public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
        final URL definitionsFileUrl = 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


        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

    public void fixmeTestPolicyIntents() throws Exception {
        ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
       
        URL url = getClass().getResource("definitions.xml");
        URI uri = URI.create("definitions.xml");
        SCADefinitions scaDefns = policyDefinitionsProcessor.read(null, uri, url);
               
        InputStream is = getClass().getResourceAsStream("Calculator.composite");
        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
        Composite composite = (Composite)staxProcessor.read(reader);
        assertNotNull(composite);
View Full Code Here

    public void testPolicySets() throws Exception {
        ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
       
        URL url = getClass().getResource("definitions_with_policysets.xml");
        URI uri = URI.create("definitions_with_policysets.xml");
        SCADefinitions policyDefinitions = policyDefinitionsProcessor.read(null, uri, url);
               
        InputStream is = getClass().getResourceAsStream("Calculator.composite");
        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
        Composite composite = (Composite)staxProcessor.read(reader);
        assertNotNull(composite);
       
        for ( Component component : composite.getComponents() ) {
            for ( PolicySet policySet : policyDefinitions.getPolicySets() ) {
                component.getApplicablePolicySets().add(policySet);
            }
        }
       
        staxProcessor.resolve(policyDefinitions, resolver);
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;
                                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

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

    public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
        final URL definitionsFileUrl = 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

        URLArtifactProcessorExtensionPoint documentProcessors = 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() {
                    return getClass().getClassLoader().getResource(definitionsFile);
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

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.