You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/04/06 09:17:45 UTC

svn commit: r526079 - in /incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution: ./ extension/

Author: lresende
Date: Fri Apr  6 00:17:44 2007
New Revision: 526079

URL: http://svn.apache.org/viewvc?view=rev&rev=526079
Log:
Simplifying packageProcessor interfaces

Added:
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/TypeDescriber.java
      - copied, changed from r525992, incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContentTypeDescriber.java
Removed:
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContentTypeDescriber.java
Modified:
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessor.java
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessorRegistry.java
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/extension/ContributionPackageProcessorExtension.java

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessor.java?view=diff&rev=526079&r1=526078&r2=526079
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessor.java Fri Apr  6 00:17:44 2007
@@ -20,9 +20,8 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URI;
-
-import org.apache.tuscany.services.contribution.model.Contribution;
+import java.net.URL;
+import java.util.List;
 
 /**
  * Interface for services that can process contributions.
@@ -30,20 +29,19 @@
  * @version $Rev: 522653 $ $Date: 2007-03-26 15:30:21 -0700 (Mon, 26 Mar 2007) $
  */
 public interface ContributionPackageProcessor {
+//    /**
+//     * Returns the type of package handled by this package processor. 
+//     * @return the type of package handled by this package processor
+//     */    
+//    String getPackageType();
+    
     /**
-     * Process a contribution from the input stream. 
-     * The processor will then scan each artifact and invoke 
-     * the respective artifactProcessor to handle the artifact
-     * 
-     * @param contribution The contribution model that will be used to hold the
-     *            results from the processing
-     * @param source The URI for the contribution/artifact
-     * @param inputStream The input stream for the contribution. 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
+     * Retrieve a list of artifacts for the specific package type
+     * @param packageSourceURL location of the artifact
+     * @param inputStream optional content of the package
+     * @return
+     * @throws ContributionException
+     * @throws IOException
      */
-    void processContent(Contribution contribution, URI source, InputStream inputStream) throws ContributionException,
-        IOException;
+    List<URL> getArtifacts(URL packageSourceURL,InputStream inputStream) throws ContributionException, IOException;
 }

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessorRegistry.java?view=diff&rev=526079&r1=526078&r2=526079
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessorRegistry.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContributionPackageProcessorRegistry.java Fri Apr  6 00:17:44 2007
@@ -23,14 +23,14 @@
  */
 public interface ContributionPackageProcessorRegistry extends ContributionPackageProcessor {
     /**
-     * Register a ContributionProcessor using the content type as the key
+     * Register a ContributionPackageProcessor using the package type as the key
      * @param processor
      */
-    void register(String contentType, ContributionPackageProcessor processor);
+    void register(String packageType, ContributionPackageProcessor processor);
     
     /**
-     * Unregister a ContributionProcessor by content type
-     * @param contentType
+     * Unregister a ContributionProcessor by package type
+     * @param packageType
      */
-    void unregister(String contentType);
+    void unregister(String packageType);
 }

Copied: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/TypeDescriber.java (from r525992, incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContentTypeDescriber.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/TypeDescriber.java?view=diff&rev=526079&p1=incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContentTypeDescriber.java&r1=525992&p2=incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/TypeDescriber.java&r2=526079
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/ContentTypeDescriber.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/TypeDescriber.java Fri Apr  6 00:17:44 2007
@@ -26,11 +26,11 @@
  *
  * @version $Rev$ $Date$
  */
-public interface ContentTypeDescriber {
+public interface TypeDescriber {
     /**
-     * @param resourceURL        the resource url
-     * @param defaultContentType the default content type
+     * @param resourceURL the resource url
+     * @param defaultType the default content type
      * @return the content type
      */
-    String getContentType(URL resourceURL, String defaultContentType);
+    String getType(URL resourceURL, String defaultType);
 }

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/extension/ContributionPackageProcessorExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/extension/ContributionPackageProcessorExtension.java?view=diff&rev=526079&r1=526078&r2=526079
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/extension/ContributionPackageProcessorExtension.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/services/spi/contribution/extension/ContributionPackageProcessorExtension.java Fri Apr  6 00:17:44 2007
@@ -32,34 +32,20 @@
      * The ContributionProcessorRegistry that this processor should register with; usually set by injection. This
      * registry may also be used to process other sub-artifacts.
      */
-    protected ContributionPackageProcessorRegistry registry;
+    protected final ContributionPackageProcessorRegistry registry;
 
     /**
      * @param registry the registry to set
      */
-    public void setContributionProcessorRegistry(ContributionPackageProcessorRegistry registry) {
+    public ContributionPackageProcessorExtension(ContributionPackageProcessorRegistry registry){
         this.registry = registry;
+        this.registry.register(this.getPackageType(), this);
     }
-
-    /**
-     * Initialize the processor. It registers itself to the registry by content type it supports.
-     */
-    public void start() {
-        registry.register(this.getContentType(), this);
-    }
-
+    
     /**
-     * Destroy the processor. It unregisters itself from the registry.
-     */
-    public void stop() {
-        registry.unregister(this.getContentType());
-    }
-
-    /**
-     * Returns the content type that this implementation can handle.
-     *
-     * @return the content type that this implementation can handle
-     */
-    public abstract String getContentType();
+     * Returns the type of package handled by this package processor. 
+     * @return the type of package handled by this package processor
+     */    
+    public abstract String getPackageType();
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org