Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

1

...

) Add a contribution to the SCA domain

The contribution process is about adding Types to the domain (composites, classes, XSD  complexTypes, etc).

1. An SCA application is developed and packaged as a jar or another archive format

...

3. The ContributionProcessor introspects the contribution to create a list of artifacts of interest for SCA. Each artifact is classified by ContentTypes.

4. The artifacts are parsed by the content type.  we provide parsers for SCDL (StAXElementLoader) and we can reuse existing parsers for XSD and WSDL (XmlSchema, wsdl4j, woden). So the WSDL introspector would parse the document using, say, wsdl4j and then store the interesting things that it finds.

5. The interesting definitions are added to the contribution store and that is the end of the contribution operation. We keep the contribution and cache the introspection results.

The following diagram is created to illustrate the key players that interacts with the ContributionService.

Image Added

Note

We could merge the ContributionProcessor and ArtifactProcessor concepts into one. If so, the processor for the jar will be called first, it scans the files in the jar and delegate the processors which can handle the content types, for example, WSDLProcessor to load WSDLs, XSDProcessor to load XSDs, JavaAnnotationProcessor to introspect java classes and SCDL loaders to load SCDL files.

Contribution Services Implementation

The contribution services is available in multiple modules at java/sca/runtime/services

Contribution Modules

Image Added

Note

Note that the Contribution Services Implementation have dependencies on the Kernel SPI
-> LooaderRegistry
-> SCA Model objects

The Kernel will have dependency on Contribution-Framework once things get integrated

The ContributionService interface

Code Block


/**
 * Service interface that manages artifacts contributed to a Tuscany runtime.
 *
 * @version $Rev: 523009 $ $Date: 2007-03-27 10:38:24 -0700 (Tue, 27 Mar 2007) $
 */
public interface ContributionService {
    /**
     * Contribute an artifact to the SCA Domain. The type of the contribution is
     * determined by the Content-Type of the resource or, if that is undefined,
     * by some implementation-specific means (such as mapping an extension in
     * the URL's path).
     * 
     * @param contributionURI The URI that is used as the contribution unique ID. 
     * @param sourceURL the location of the resource containing the artifact
     * @param storeInRepository flag that identifies if you want to copy the
     *            contribution to the repository
     * @throws DeploymentException if there was a problem with the contribution
     * @throws IOException if there was a problem reading the resource
     */
    void contribute(URI contributionURI, URL sourceURL, boolean storeInRepository) throws ContributionException,
        IOException;

    /**
     * Contribute an artifact to the SCA Domain.
     * 
     * @param contributionURI The URI that is used as the contribution unique ID.
     * @param contributionContent a stream containing the resource being
     *            contributed; the stream will not be closed but the read
     *            position after the call is undefined
     * @throws DeploymentException if there was a problem with the contribution
     * @throws IOException if there was a problem reading the stream
     */
    void contribute(URI contributionURI, InputStream contributionContent)
        throws ContributionException, IOException;

    /**
     * Get the model for an installed contribution
     * 
     * @param contribution The URI of an installed contribution
     * @return The model for the contribution or null if there is no such
     *         contribution
     */
    Contribution getContribution(URI contribution);

    /**
     * Adds or updates a deployment composite using a supplied composite
     * ("composite by value" - a data structure, not an existing resource in the
     * domain) to the contribution identified by a supplied contribution URI.
     * The added or updated deployment composite is given a relative URI that
     * matches the "name" attribute of the composite, with a ".composite"
     * suffix.
     */
    void addDeploymentComposite(URI contribution, Object composite);

    /**
     * Remove a contribution from the SCA domain
     * 
     * @param contribution The URI of the contribution
     * @throws DeploymentException
     */
    void remove(URI contribution) throws ContributionException;

    /**
     * Resolve an artifact by QName within the contribution
     * 
     * @param <T> The java type of the artifact such as javax.wsdl.

...

Definition
     * @param contribution The URI of the contribution
     * @param definitionType The java type of the artifact
     * @param namespace The namespace of the artifact
     * @param name The name of the artifact
     * @return The resolved artifact
     */
    <T> T resolve(URI contribution, Class<T> definitionType, String namespace, String name);

    /**
     * Resolve the reference to an artifact by the location URI within the given
     * contribution. Some typical use cases are:
     * <ul>
     * <li>Reference a XML schema using
     * {http://www.w3.org/2001/XMLSchema-instance}schemaLocation or
     * <li>Reference a list of WSDLs using
     * {http://www.w3.org/2004/08/wsdl-instance}wsdlLocation
     * </ul>
     * 
     * @param contribution The URI of the contribution
     * @param namespace The namespace of the artifact. This is for validation
     *            purpose. If the namespace is null, then no check will be
     *            performed.
     * @param uri The location URI
     * @param baseURI The URI of the base artifact where the reference is
     *            declared
     * @return The URL of the resolved artifact
     */
    URL resolve(URI contribution, String namespace, URI uri, URI baseURI);
}

Contribution Services UML Diagrams

Contribution Services

Image Added

Contribution Processors

Image Added

Artifact Resolver

Image Added

2) Apply Changes to the Assembly

The assembly is about creating/modifying/ removing instances of things (primarily components).

...

1. User calls "addToDomainComosite" or "applyChanges" aginst the AssemblyService. There is a changeSet which represents an atomic modification to the domain, for example, adding an "include" to the domain composite.

...