Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

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.

The ContributionService interface

Code Block
/**
 * Service interface that manages artifacts contributed to a Tuscany runtime.
 *
 * @version $Rev: 499649 $ $Date: 2007-01-24 18:40:55 -0800 (Wed, 24 Jan 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 contribution the location of the resource containing the artifact
     * @return a URI that uniquely identifies this contribution within the SCA Domain
     * @throws DeploymentException if there was a problem with the contribution
     * @throws IOException         if there was a problem reading the resource
     */
    URI contribute(URL contribution) throws DeploymentException, IOException;

    /**
     * Contribute an artifact to the SCA Domain.
     *
     * @param source       an identifier for the source of this contribution
     * @param contribution a stream containing the resource being contributed; the stream will not be closed but the
     *                     read position after the call is undefined
     * @param contentType  the type of contribution being made; must be a valid Content-Type value as specified by <a
     *                     href="http://www.ietf.org/rfc/rfc2045.txt">RFC2045</a> and must not be null @return a URI
     *                     that uniquely identifies this contribution within the SCA Domain
     * @throws DeploymentException if there was a problem with the contribution
     * @throws IOException         if there was a problem reading the stream
     */
    URI contribute(URI source, InputStream contribution, String contentType) throws DeploymentException, IOException;
    
    /**
     * Remove a contribution from the SCA domain
     * @param contribution The URI of the contribution
     * @throws DeploymentException
     */
    void remove(URI contribution) throws DeploymentException;
    
    /**
     * 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
     */
    <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);
}

...