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/02/21 19:27:58 UTC

svn commit: r510137 - in /incubator/tuscany/branches/sca-java-integration/sca/kernel: core/src/main/java/org/apache/tuscany/core/services/deployment/ core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/ core/src/main/resources/o...

Author: lresende
Date: Wed Feb 21 10:27:57 2007
New Revision: 510137

URL: http://svn.apache.org/viewvc?view=rev&rev=510137
Log:
Updates to contribution service. SCDL and Java contributionProcessors

Added:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/ScdlContributionProcessor.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/sample-calculator.jar   (with props)
    incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.java
Modified:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.java

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java?view=diff&rev=510137&r1=510136&r2=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java Wed Feb 21 10:27:57 2007
@@ -52,6 +52,7 @@
     private void init() {
         contentTypeRegistry.put("SCDL", "application/v.tuscany.scdl");
         contentTypeRegistry.put("WSDL", "application/v.tuscany.wsdl");
+        contentTypeRegistry.put("JAR", "application/x-compressed");
     }
 
     protected String resolveContentyTypeByExtension(URL resourceURL) {

Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.java?view=auto&rev=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.java Wed Feb 21 10:27:57 2007
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.core.services.deployment;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.tuscany.host.deployment.ContributionService;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+
+@EagerInit
+public class ContributionDirectoryWatcher {
+    private final String path;
+    private final ContributionService contributionService;
+    
+    public ContributionDirectoryWatcher(@Autowire ContributionService contributionService, @Property(name = "path")String path) {
+        this.path = path;
+        this.contributionService = contributionService;
+    }
+    
+    @Init
+    public void init() {
+        File extensionDir = new File(path);
+        if (!extensionDir.isDirectory()) {
+            // we don't have an extension directory, there's nothing to do
+            return;
+        }
+
+        File[] files = extensionDir.listFiles();
+        for (File file : files) {
+            try{
+                this.contributionService.contribute(file.toURL());
+            }catch(DeploymentException de){
+                //FIXME handle this
+                de.printStackTrace();
+            }catch(IOException ioe){
+                //FIXME handle this
+                ioe.printStackTrace();
+            }
+        }
+    }
+}

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java?view=diff&rev=510137&r1=510136&r2=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java Wed Feb 21 10:27:57 2007
@@ -45,13 +45,13 @@
 @Service(ContributionProcessorRegistry.class)
 public class ContributionProcessorRegistryImpl implements ContributionProcessorRegistry {
     private Map<String, ContributionProcessor> registry = new HashMap<String, ContributionProcessor>();
-    private ContentTypeDescriber contentTypeBuilder;
+    private ContentTypeDescriber contentTypeDescriber;
 
-    public ContributionProcessorRegistryImpl(@Autowire ContentTypeDescriber contentTypeBuilder) {
-        if (contentTypeBuilder == null) {
-            this.contentTypeBuilder = new ContentTypeDescriberImpl();
+    public ContributionProcessorRegistryImpl(@Autowire ContentTypeDescriber contentTypeDescriber) {
+        if (contentTypeDescriber == null) {
+            this.contentTypeDescriber = new ContentTypeDescriberImpl();
         } else {
-            this.contentTypeBuilder = contentTypeBuilder;
+            this.contentTypeDescriber = contentTypeDescriber;
         }
     }
 
@@ -65,8 +65,9 @@
 
     public void processContent(Contribution contribution, URI source, InputStream inputStream)
         throws DeploymentException, IOException {
+        
         URL sourceURL = contribution.getArtifact(source).getLocation();
-        String contentType = this.contentTypeBuilder.getContentType(sourceURL, null);
+        String contentType = this.contentTypeDescriber.getContentType(sourceURL, null);
         if (contentType == null) {
             throw new UnsupportedContentTypeException("Invalid contentType: null");
         }

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java?view=diff&rev=510137&r1=510136&r2=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java Wed Feb 21 10:27:57 2007
@@ -84,13 +84,14 @@
         }
 
         // store the contribution in the contribution repository
+        URI contributionURI = URI.create("sca://contribution/" + UUID.randomUUID());
         URL storedURL = this.contributionRepository.store(source, contributionStream);
+        
         Contribution contribution = null;
-        // start processing valid contribution
-        contribution = new Contribution(URI.create("sca://contribution/" + UUID.randomUUID()));
+        contribution = new Contribution(contributionURI);
         contribution.setLocation(storedURL);
 
-        this.processorRegistry.processContent(contribution, contribution.getUri(), contributionStream);
+        this.processorRegistry.processContent(contribution, contributionURI, storedURL.openStream());
 
         if (contribution == null) {
             // FIXME throw exception

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java?view=diff&rev=510137&r1=510136&r2=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java Wed Feb 21 10:27:57 2007
@@ -29,7 +29,9 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarInputStream;
 
+import org.apache.tuscany.core.services.deployment.ContentTypeDescriberImpl;
 import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.deployer.ContentTypeDescriber;
 import org.apache.tuscany.spi.deployer.ContributionProcessor;
 import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
 import org.apache.tuscany.spi.model.Contribution;
@@ -37,6 +39,7 @@
 public class JarContributionProcessor extends ContributionProcessorExtension implements ContributionProcessor {
     public static final String CONTENT_TYPE = "application/x-compressed";
 
+    @Override
     public String getContentType() {
         return CONTENT_TYPE;
     }
@@ -75,13 +78,17 @@
         if (sourceURL.toString().startsWith("jar:")) {
             return sourceURL;
         } else {
-            return new URL("jar:" + sourceURL.toString() + "!/");
+            return new URL("jar:" + sourceURL.toExternalForm() + "!/");
         }
 
     }
 
     public void processContent(Contribution contribution, URI source, InputStream inputStream)
         throws DeploymentException, IOException {
+        if(contribution == null){
+            throw new IllegalArgumentException("Invalid null contribution.");
+        }
+
         if (source == null) {
             throw new IllegalArgumentException("Invalid null source uri.");
         }
@@ -91,26 +98,24 @@
         }
 
         URL sourceURL = contribution.getArtifact(source).getLocation();
+
         sourceURL = forceJarURL(sourceURL);
 
         for (URL artifactURL : getArtifacts(sourceURL, inputStream)) {
             // FIXME
             // contribution.addArtifact(artifact)
-
-            URL aURL = new URL(artifactURL.toString());
-            if (aURL.openConnection() != null) {
-                // TODO
+            
+            ContentTypeDescriber contentTypeDescriber = new ContentTypeDescriberImpl();
+            String contentType = contentTypeDescriber.getContentType(artifactURL, null);
+            System.out.println("Type : " + contentType);
+            
+
+            //just process scdl for now
+            if("application/v.tuscany.scdl".equals(contentType) || "application/java-vm".equals(contentType) ){
+                this.registry.processContent(contribution, source, inputStream);
             }
-
-            // is default jar
-            URL manifestURL = new URL(sourceURL, "!/META-INF/Manifest.mf");
-            if (manifestURL.openConnection() == null) {
-                // does not exists
-            }
-
             // process each artifact
-            // this.registry.processContent(contribution, artifactURL,
-            // inputStream);
+            //this.registry.processContent(contribution, artifactURL, inputStream);
 
         }
 

Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java?view=auto&rev=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java Wed Feb 21 10:27:57 2007
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.core.services.deployment.contribution;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
+import org.apache.tuscany.spi.implementation.java.Introspector;
+import org.apache.tuscany.spi.model.Contribution;
+import org.osoa.sca.annotations.Constructor;
+
+public class JavaContributionProcessor extends ContributionProcessorExtension implements ContributionProcessor{
+    public static final String CONTENT_TYPE = "application/java-vm";
+    private Introspector introspector;
+    
+    @Override
+    public String getContentType() {
+        return CONTENT_TYPE;
+    }
+    
+    @Constructor({"introspector"})
+    public JavaContributionProcessor(@Autowire IntrospectionRegistry introspector){
+        this.introspector = introspector;
+    }
+    
+    private String getClazzName(URL clazzURL){
+        String clazzName;
+        
+        clazzName = clazzURL.toExternalForm().substring(clazzURL.toExternalForm().lastIndexOf("!/") + 2, 
+                                                        clazzURL.toExternalForm().length() - ".class".length());
+        clazzName = clazzName.replace("/", ".");
+        
+        return clazzName;
+    }
+    
+
+    public void processContent(Contribution contribution, URI source, InputStream inputStream) 
+       throws DeploymentException, IOException {
+        if (source == null) {
+            throw new IllegalArgumentException("Invalid null source uri.");
+        }
+
+        if (inputStream == null) {
+            throw new IllegalArgumentException("Invalid null source inputstream.");
+        }        
+        
+        // TODO Auto-generated method stub
+        
+        try{
+           CompositeClassLoader cl = new CompositeClassLoader(getClass().getClassLoader());
+           cl.addURL(contribution.getLocation());
+           
+           String clazzName = getClazzName(contribution.getArtifact(source).getLocation());
+           System.out.println(clazzName);
+           
+           Class clazz = cl.loadClass(clazzName);
+                      
+//            PojoComponentType javaInfo = introspector.introspect(null, clazz, null, null);
+        }catch(ClassNotFoundException cnfe){
+            String msg = cnfe.getMessage();
+            
+        }
+//      catch(ProcessingException pe){
+//            String msg = pe.getMessage();
+        
+        
+
+
+    }
+
+    public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException, IOException {
+        // TODO Auto-generated method stub
+
+    }
+
+}

Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/ScdlContributionProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/ScdlContributionProcessor.java?view=auto&rev=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/ScdlContributionProcessor.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/ScdlContributionProcessor.java Wed Feb 21 10:27:57 2007
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.core.services.deployment.contribution;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.apache.tuscany.host.deployment.ContributionProcessorException;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.model.Contribution;
+
+public class ScdlContributionProcessor extends ContributionProcessorExtension implements ContributionProcessor{
+    public static final String CONTENT_TYPE = "application/v.tuscany.scdl";
+    private final LoaderRegistry registry;
+    
+    protected XMLInputFactory xmlFactory;
+    
+    @Override
+    public String getContentType() {
+        return CONTENT_TYPE;
+    }
+    
+    public ScdlContributionProcessor(@Autowire LoaderRegistry registry){
+        super();
+        this.registry = registry;
+        this.xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+    }
+    
+
+    public void processContent(Contribution contribution, URI source, InputStream inputStream) 
+       throws DeploymentException, IOException {
+        if (source == null) {
+            throw new IllegalArgumentException("Invalid null source uri.");
+        }
+
+        if (inputStream == null) {
+            throw new IllegalArgumentException("Invalid null source inputstream.");
+        }        
+        
+        try{
+            CompositeClassLoader cl = new CompositeClassLoader(getClass().getClassLoader());
+            cl.addURL(contribution.getLocation());
+            DeploymentContext deploymentContext = new RootDeploymentContext(cl, this.xmlFactory, null, contribution.getArtifact(source).getLocation());
+
+            CompositeComponentType componentType = this.registry.load(null, null, contribution.getArtifact(source).getLocation(), CompositeComponentType.class, deploymentContext);
+
+            //FIXME add this to artifact
+            CompositeImplementation implementation = new CompositeImplementation();
+            ComponentDefinition<CompositeImplementation> componentDefinition = new ComponentDefinition<CompositeImplementation>(implementation);
+            
+        }catch(LoaderException le){
+            le.printStackTrace();
+            throw new ContributionProcessorException("Error processing SCDL", contribution.getArtifact(source).getLocation().toExternalForm(), le);
+        }
+    }
+
+    public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException, IOException {
+        // TODO Auto-generated method stub
+
+    }
+
+}

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl?view=diff&rev=510137&r1=510136&r2=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl Wed Feb 21 10:27:57 2007
@@ -26,7 +26,11 @@
     name="org.apache.tuscany.core.Deployment">
 
     <!-- Contribution Service -->
-    <component name="contributionService">
+    <component name="contributionDirectoryWatcher" initLevel="100">
+        <system:implementation.system class="org.apache.tuscany.core.services.deployment.ContributionDirectoryWatcher" />
+        <property name="path">target/deployables</property>        
+    </component>
+    <component name="contributionService" initLevel="90">
         <system:implementation.system class="org.apache.tuscany.core.services.deployment.ContributionServiceImpl" />
     </component>
     <component name="contributionRepository" initLevel="40">
@@ -34,14 +38,20 @@
         <property name="repository">target/repository</property>
     </component>
 
-    <component name="contributionProcessorRepository" initLevel="35">
+    <component name="contributionProcessorRegistry" initLevel="35">
         <system:implementation.system class="org.apache.tuscany.core.services.deployment.ContributionProcessorRegistryImpl" />
     </component>
     <component name="contentTypeDescriber" initLevel="30">
         <system:implementation.system class="org.apache.tuscany.core.services.deployment.ContentTypeDescriberImpl" />
     </component>
-    <component name="jarContributionProcessor">
+    <component name="JarContributionProcessor" initLevel="30">
         <system:implementation.system class="org.apache.tuscany.core.services.deployment.contribution.JarContributionProcessor" />
     </component>
+    <component name="JavaContributionProcessor" initLevel="30">
+        <system:implementation.system class="org.apache.tuscany.core.services.deployment.contribution.JavaContributionProcessor" />
+    </component>
+    <component name="ScdlContributionProcessor" initLevel="30">
+        <system:implementation.system class="org.apache.tuscany.core.services.deployment.contribution.ScdlContributionProcessor" />
+    </component>    
 
 </composite>

Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.java?view=auto&rev=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.java Wed Feb 21 10:27:57 2007
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.core.services.deployment;
+
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.services.deployment.contribution.JarContributionProcessor;
+import org.apache.tuscany.core.services.deployment.contribution.JavaContributionProcessor;
+import org.apache.tuscany.host.deployment.ContributionService;
+import org.apache.tuscany.spi.deployer.ContentTypeDescriber;
+import org.apache.tuscany.spi.deployer.ContributionProcessorRegistry;
+import org.apache.tuscany.spi.deployer.ContributionRepository;
+
+/**
+ * This is more intended to be a integration test then a unit test. *
+ */
+public class ContributionServiceImplTestCase extends TestCase {
+    private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+    private ContributionRepository repository; 
+    private ContentTypeDescriber contentTypeDescriber;
+    private ContributionProcessorRegistry registry;
+    private ContributionService contributionService;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+//        this.repository = new ContributionRepositoryImpl("target/repository");
+//        
+//        this.contentTypeDescriber = new ContentTypeDescriberImpl();
+//        
+//        this.registry = new ContributionProcessorRegistryImpl(contentTypeDescriber);
+//        
+//        JarContributionProcessor jarProcessor = new JarContributionProcessor();
+//        jarProcessor.setContributionProcessorRegistry(this.registry);
+//        this.registry.register(JarContributionProcessor.CONTENT_TYPE, jarProcessor);
+//        
+//        JavaContributionProcessor javaProcessor = new JavaContributionProcessor(null);
+//        javaProcessor.setContributionProcessorRegistry(this.registry);
+//        this.registry.register(JavaContributionProcessor.CONTENT_TYPE, javaProcessor);
+//        
+//        
+//        contributionService = new ContributionServiceImpl(repository, registry);
+    }
+
+    public void testContributeURL() throws Exception {
+//        URL contribution = getClass().getResource(JAR_CONTRIBUTION);
+//
+//        URI contributionURI = contributionService.contribute(contribution);
+//        assertNotNull(contributionURI);
+    }
+
+}

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.java?view=diff&rev=510137&r1=510136&r2=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.java Wed Feb 21 10:27:57 2007
@@ -33,7 +33,7 @@
     protected void setUp() throws Exception {
         super.setUp();
     }
-
+    
     public final void testProcessJarArtifacts() throws Exception {
         JarContributionProcessor jarContribution = new JarContributionProcessor();
         ContributionProcessorRegistry mockRegistry = EasyMock.createMock(ContributionProcessorRegistry.class);

Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java?view=auto&rev=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java Wed Feb 21 10:27:57 2007
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.core.services.deployment.contribution;
+
+import java.net.URL;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl;
+import org.apache.tuscany.core.implementation.processor.DestroyProcessor;
+import org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl;
+import org.apache.tuscany.core.implementation.processor.InitProcessor;
+import org.apache.tuscany.core.implementation.processor.PropertyProcessor;
+import org.apache.tuscany.core.implementation.processor.ReferenceProcessor;
+import org.apache.tuscany.core.implementation.processor.ResourceProcessor;
+import org.apache.tuscany.core.implementation.processor.ScopeProcessor;
+import org.apache.tuscany.core.monitor.NullMonitorFactory;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+
+public class JavaContributionProcessorTestCase extends TestCase {
+    private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+    private static final String JAVA_ARTIFACT_URL = "jar:file://repository/sample-calculator.jar!/calculator/AddService.class" ;
+    private IntrospectionRegistryImpl registry;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        registry = new IntrospectionRegistryImpl();
+        registry.setMonitor(new NullMonitorFactory().getMonitor(IntrospectionRegistryImpl.Monitor.class));
+        registry.registerProcessor(new DestroyProcessor());
+        registry.registerProcessor(new InitProcessor());
+        registry.registerProcessor(new ScopeProcessor());
+        JavaInterfaceProcessorRegistryImpl interfaceProcessorRegistry = new JavaInterfaceProcessorRegistryImpl();
+        ImplementationProcessorService service = new ImplementationProcessorServiceImpl(interfaceProcessorRegistry);
+        registry.registerProcessor(new PropertyProcessor(service));
+        registry.registerProcessor(new ReferenceProcessor(interfaceProcessorRegistry));
+        registry.registerProcessor(new ResourceProcessor());
+    }
+    
+    protected URL getClassURL() throws Exception{
+        URL jarURL = getClass().getResource(JAR_CONTRIBUTION);
+        JarInputStream jar = new JarInputStream(getClass().getResourceAsStream(JAR_CONTRIBUTION));
+        URL rootURL =  new URL("jar:" + jarURL.toString() + "!/");
+        URL classURL = null;
+        
+        try {
+            while (true) {
+                JarEntry entry = jar.getNextJarEntry();
+                if(entry.getName().endsWith(".class")){
+
+                    classURL = new URL(rootURL, entry.getName());
+                    break;
+                }
+            }
+        } finally {
+            jar.close();
+        }
+        return classURL;
+    }
+
+    public final void testProcessJarArtifacts() throws Exception {
+        //ContributionProcessor javaContributionProcessor = new JavaContributionProcessor(registry);
+        
+        //URL jarURL = this.getClassURL();
+        //javaContributionProcessor.processContent(null, jarURL, jarURL.openStream());
+    }
+}

Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/sample-calculator.jar
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/sample-calculator.jar?view=auto&rev=510137
==============================================================================
Binary file - no diff available.

Propchange: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/sample-calculator.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.java?view=auto&rev=510137
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.java Wed Feb 21 10:27:57 2007
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.host.deployment;
+
+/**
+ * Exception thrown to indicate that a Content-Type is not supported by this SCA Domain.
+ * The Content-Type value supplied will be returned as the message text for this exception.
+ *
+ * @version $Rev: 490357 $ $Date: 2006-12-26 11:06:27 -0800 (Tue, 26 Dec 2006) $
+ */
+public class ContributionProcessorException extends DeploymentException {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -5187793020502900879L;
+
+    /**
+     * @param message the exception message
+     */
+    public ContributionProcessorException(String message) {
+        super(message);
+    }
+
+    /**
+     * 
+     * @param message     the exception message
+     * @param identifier  an identifier for this exception
+     */
+    public ContributionProcessorException(String message, String identifier) {
+        super(message, identifier);
+    }
+    
+    /**
+     * @param message the exception message
+     * @param cause   a cause for the exception
+     */
+    public ContributionProcessorException(String message, Throwable cause) {
+        super(message, cause);
+    }
+    
+    /**
+     * @param message
+     * @param identifier
+     * @param cause
+     */
+    public ContributionProcessorException(String message, String identifier, Throwable cause) {
+        super(message, identifier, cause);
+    }
+
+    /**
+     * @param cause
+     */
+    public ContributionProcessorException(Throwable cause) {
+        super(cause);
+    }
+
+    
+
+}



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