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/28 01:19:48 UTC
svn commit: r512518 - in
/incubator/tuscany/branches/sca-java-integration/sca:
kernel/api/src/main/java/org/apache/tuscany/api/
kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/
kernel/core/src/main/java/org/apache/tuscany/core/deployer/ ker...
Author: lresende
Date: Tue Feb 27 16:19:47 2007
New Revision: 512518
URL: http://svn.apache.org/viewvc?view=rev&rev=512518
Log:
Integration of the Contribution services with DefaultSCAContainer.
All samples and unit test cases are now using the contribution services to process itself and make available in the Domain.
Modified:
incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCAContainer.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java
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/ContributionServiceImpl.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessor.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/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/AssemblyServiceImplTestCase.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/AssemblyService.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionService.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java
incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java Tue Feb 27 16:19:47 2007
@@ -127,7 +127,7 @@
*/
public static void start() {
try {
- getInstance().startup(null, null, null);
+ getInstance().startup(null, null, null, null);
} catch (Exception e) {
throw new IllegalStateException(e);
}
@@ -140,9 +140,9 @@
* @param extensions An array of URLs for extensions
* @param application The URL for the application SCDL
*/
- public static void start(URL system, URL[] extensions, URL application) {
+ public static void start(URL system, URL[] extensions, URL application, String compositePath) {
try {
- getInstance().startup(system, extensions, application);
+ getInstance().startup(system, extensions, application, compositePath);
} catch (Exception e) {
throw new IllegalStateException(e);
}
@@ -153,9 +153,9 @@
*
* @param application The URL for the application SCDL
*/
- public static void start(URL application) {
+ public static void start(URL application, String compositePath) {
try {
- getInstance().startup(null, null, application);
+ getInstance().startup(null, null, application, compositePath);
} catch (Exception e) {
throw new IllegalStateException(e);
}
@@ -164,13 +164,13 @@
/**
* Start the Tuscany container with the given SCDL
*
- * @param application The path of the application SCDL
+ * @param compositePath The path of the application SCDL
*/
- public static void start(String application) {
+ public static void start(String compositePath) {
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- URL applicationURL = cl.getResource(application);
- getInstance().startup(null, null, applicationURL);
+ URL applicationURL = cl.getResource(compositePath);
+ getInstance().startup(null, null, applicationURL, compositePath);
} catch (Exception e) {
throw new IllegalStateException(e);
}
@@ -179,15 +179,15 @@
/**
* Start the Tuscany container with the given SCDL
*
- * @param application The path of the system SCDL
- * @param application The path of the application SCDL
+ * @param compositePath The path of the system SCDL
+ * @param compositePath The path of the application SCDL
*/
- public static void start(String system, String application) {
+ public static void start(String system, String compositePath) {
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URL systemURL = cl.getResource(system);
- URL applicationURL = cl.getResource(application);
- getInstance().startup(systemURL, null, applicationURL);
+ URL applicationURL = cl.getResource(compositePath);
+ getInstance().startup(systemURL, null, applicationURL, compositePath);
} catch (Exception e) {
throw new IllegalStateException(e);
}
@@ -226,9 +226,10 @@
* @param system
* @param extensions
* @param application
+ * @param compositePath TODO
* @throws Exception
*/
- protected abstract void startup(URL system, URL[] extensions, URL application) throws Exception;
+ protected abstract void startup(URL system, URL[] extensions, URL application, String compositePath) throws Exception;
/**
* Shutdown the container
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCAContainer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCAContainer.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCAContainer.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCAContainer.java Tue Feb 27 16:19:47 2007
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.core.bootstrap;
+import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
@@ -32,7 +33,10 @@
import org.apache.tuscany.core.launcher.CompositeContextImpl;
import org.apache.tuscany.core.launcher.LauncherImpl;
import org.apache.tuscany.core.monitor.JavaLoggingMonitorFactory;
+import org.apache.tuscany.core.services.deployment.AssemblyServiceImpl;
+import org.apache.tuscany.core.util.FileHelper;
import org.apache.tuscany.host.MonitorFactory;
+import org.apache.tuscany.host.deployment.AssemblyService;
import org.apache.tuscany.host.deployment.ContributionService;
import org.apache.tuscany.host.runtime.InitializationException;
import org.apache.tuscany.spi.bootstrap.ComponentNames;
@@ -57,13 +61,15 @@
*/
@SuppressWarnings("deprecation")
public class DefaultSCAContainer extends SCAContainer {
- private CompositeComponent component;
- private CompositeContextImpl context;
- private LauncherImpl launcher;
- private MonitorFactory monitorFactory;
- private ContributionService contributionService;
+ protected CompositeComponent component;
+ protected CompositeContextImpl context;
+ protected LauncherImpl launcher;
+ protected MonitorFactory monitorFactory;
+ //lresende - contribution
+ protected AssemblyService assemblyService;
+ protected ContributionService contributionService;
- protected void startup(URL system, URL[] exts, URL applicationSCDL) throws Exception {
+ protected void startup(URL system, URL[] exts, URL applicationSCDL, String compositePath) throws Exception {
if (monitorFactory == null) {
monitorFactory = new JavaLoggingMonitorFactory();
}
@@ -80,9 +86,14 @@
try {
CompositeComponent composite = launcher.bootRuntime(system, monitorFactory);
+ //lresende - contribution
AtomicComponent csComponent =
(AtomicComponent)composite.getSystemChild(ComponentNames.TUSCANY_CONTRIBUTION_SERVICE);
contributionService = (ContributionService) csComponent.getTargetInstance();
+
+ this.assemblyService = new AssemblyServiceImpl(contributionService, composite);
+ composite.registerJavaObject(ComponentNames.TUSCANY_ASSEMBLY_SERVICE, AssemblyService.class, assemblyService);
+
List<URL> extensions = new ArrayList<URL>();
Enumeration<URL> urls = cl.getResources(SCAContainer.SERVICE_SCDL);
extensions.addAll(Collections.list(urls));
@@ -117,12 +128,15 @@
throw new RuntimeException("application SCDL not found: " + SCAContainer.APPLICATION_SCDL);
}
}
-
- //URL contributionLocation = new URL( applicationSCDL.toExternalForm().replace(SCAContainer.APPLICATION_SCDL, ""));
- //URI appURI = this.contributionService.contribute(contributionLocation, false);
- component = launcher.bootApplication("application", applicationSCDL);
- component.start();
+ //lresende - contribution
+ URL contributionLocation = getContributionLocation(applicationSCDL, compositePath);
+ URI contributionId = this.contributionService.contribute(contributionLocation, false);
+ URI compositeDefinitionId = new URI(contributionId + FileHelper.getName(applicationSCDL.toString()));
+
+
+ component = (CompositeComponent) this.assemblyService.addCompositeToDomain(contributionId, compositeDefinitionId);
+
context = new CompositeContextImpl(component, wireService);
CurrentCompositeContext.setContext(context);
} catch (TuscanyException e) {
@@ -131,6 +145,35 @@
throw e;
}
+ }
+
+ private URL getContributionLocation(URL applicationSCDL, String compositePath) {
+ URL root = null;
+
+ // "jar:file://....../something.jar!/a/b/c/app.composite"
+
+ try {
+ String scdlUrl = applicationSCDL.toExternalForm();
+ String protocol = applicationSCDL.getProtocol();
+ if(protocol.equals("file")){
+ //directory contribution
+ if(scdlUrl.endsWith( compositePath )) {
+ String location = scdlUrl.substring(0, scdlUrl.lastIndexOf((compositePath)));
+ //workaround from evil url/uri form maven
+ root = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+
+ } else if( protocol.equals("jar")) {
+ //jar contribution
+ String location = scdlUrl.substring(4, scdlUrl.lastIndexOf("!/"));
+ //workaround from evil url/uri form maven
+ root = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+ } catch (MalformedURLException mfe) {
+
+ }
+
+ return root;
}
/**
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java Tue Feb 27 16:19:47 2007
@@ -113,6 +113,37 @@
}
return component;
}
+
+ public <I extends Implementation<?>> Component deployFromContribution(CompositeComponent parent,
+ ComponentDefinition<I> componentDefinition) throws BuilderException, PrepareException {
+ final ScopeContainer scopeContainer = new CompositeScopeContainer(monitor);
+ scopeContainer.start();
+ DeploymentContext deploymentContext = new RootDeploymentContext(null, xmlFactory, scopeContainer, null);
+// try {
+// load(parent, componentDefinition, deploymentContext);
+// } catch (LoaderException e) {
+// e.addContextName(componentDefinition.getName());
+// throw e;
+// }
+ Component component = (Component) build(parent, componentDefinition, deploymentContext);
+ // create a listener so the scope container is shutdown when the top-level composite stops
+ RuntimeEventListener listener = new RuntimeEventListener() {
+ public void onEvent(Event event) {
+ scopeContainer.onEvent(event);
+ if (event instanceof CompositeStop) {
+ scopeContainer.stop();
+ }
+ }
+ };
+ component.addListener(listener);
+ component.prepare();
+ try {
+ parent.register(component);
+ } catch (ComponentRegistrationException e) {
+ throw new BuilderInstantiationException("Error registering component", e);
+ }
+ return component;
+ }
/**
* Load the componentDefinition type information for the componentDefinition being deployed. For a typical
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.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/AssemblyServiceImpl.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java Tue Feb 27 16:19:47 2007
@@ -20,22 +20,81 @@
import java.io.IOException;
import java.io.InputStream;
+import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
-import java.util.Map;
import java.util.HashMap;
+import java.util.Map;
import org.apache.tuscany.host.deployment.AssemblyService;
+import org.apache.tuscany.host.deployment.ContributionService;
import org.apache.tuscany.host.deployment.DeploymentException;
import org.apache.tuscany.host.deployment.UnsupportedContentTypeException;
-import org.apache.tuscany.spi.deployer.ChangeSetHandlerRegistry;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.bootstrap.ComponentNames;
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetResolutionException;
import org.apache.tuscany.spi.deployer.ChangeSetHandler;
+import org.apache.tuscany.spi.deployer.ChangeSetHandlerRegistry;
+import org.apache.tuscany.spi.deployer.Deployer;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+import org.osoa.sca.annotations.Constructor;
/**
* @version $Rev$ $Date$
*/
public class AssemblyServiceImpl implements AssemblyService, ChangeSetHandlerRegistry {
private final Map<String, ChangeSetHandler> registry = new HashMap<String, ChangeSetHandler>();
+
+ private final ContributionService contributionService;
+
+ private final CompositeComponent domain;
+
+ @Constructor
+ public AssemblyServiceImpl(@Autowire
+ ContributionService contributionService, CompositeComponent domain) {
+ this.contributionService = contributionService;
+ this.domain = domain;
+ }
+
+ public Object addCompositeToDomain(URI contribution, URI composite) throws DeploymentException, IOException {
+
+ Contribution contributionMetadata = (Contribution) this.contributionService
+ .getContributionMetaData(contribution);
+ DeployedArtifact scdlArtifact = contributionMetadata.getArtifacts().get(composite);
+ ComponentDefinition model = (ComponentDefinition) scdlArtifact.getModelObject(CompositeComponentType.class,
+ null);
+
+ Component component = null;
+ Deployer deployer = null;
+
+ SCAObject child = this.domain.getSystemChild(ComponentNames.TUSCANY_DEPLOYER);
+ assert (child instanceof AtomicComponent) : "Deployer must be an atomic component";
+
+ try {
+
+ deployer = (Deployer) ((AtomicComponent) child).getTargetInstance();
+ component = deployer.deployFromContribution(this.domain, model);
+
+ } catch (TargetResolutionException e) {
+ throw new DomainUpdateException(e);
+ } catch (BuilderException e) {
+ throw new DomainUpdateException(e);
+ } catch (ComponentException e) {
+ throw new DomainUpdateException(e);
+ }
+ component.start();
+
+ return component;
+ }
public void applyChanges(URL changeSet) throws DeploymentException, IOException {
if (changeSet == null) {
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=512518&r1=512517&r2=512518
==============================================================================
--- 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 Tue Feb 27 16:19:47 2007
@@ -79,7 +79,7 @@
URLConnection connection = null;
String contentType = defaultContentType;
- if (FileHelper.toFile(resourceURL).isDirectory()) {
+ if (resourceURL.getProtocol().equals("file") && FileHelper.toFile(resourceURL).isDirectory()) {
contentType = this.contentTypeRegistry.get("FOLDER");
} else {
contentType = resolveContentyTypeByExtension(resourceURL);
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=512518&r1=512517&r2=512518
==============================================================================
--- 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 Tue Feb 27 16:19:47 2007
@@ -93,7 +93,7 @@
}
// store the contribution in the contribution repository
- URI contributionURI = URI.create("sca://contribution/" + UUID.randomUUID());
+ URI contributionURI = URI.create("sca://contribution/" + UUID.randomUUID() + "/");
URL locationURL;
if (storeInRepository) {
locationURL = this.contributionRepository.store(source, contributionStream);
@@ -114,7 +114,7 @@
return contribution.getUri();
}
- public Contribution getContribution(URI id) {
+ public Object getContributionMetaData(URI id) {
return this.contributionRegistry.get(id);
}
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessor.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/FolderContributionProcessor.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessor.java Tue Feb 27 16:19:47 2007
@@ -46,6 +46,12 @@
}
+ /**
+ * Recursively traverse a root directory
+ * @param fileList
+ * @param root
+ * @throws IOException
+ */
private void traverse(List<URL> fileList, File root) throws IOException {
if (root.isFile()) {
fileList.add(root.toURL());
@@ -95,14 +101,14 @@
throw new IllegalArgumentException("Invalid null source uri.");
}
- URL sourceURL = contribution.getArtifact(source).getLocation();
+ URL contributionURL = contribution.getArtifact(source).getLocation();
- for (URL artifactURL : getArtifacts(sourceURL, inputStream)) {
+ for (URL artifactURL : getArtifacts(contributionURL, inputStream)) {
URI artifactURI;
try {
- artifactURI = new URI(contribution.getUri().toString() + "/" + FileHelper.getName(artifactURL.getPath()));
+ artifactURI = new URI(contribution.getUri().toString() + FileHelper.getName(artifactURL.getPath()));
DeployedArtifact artifact = new DeployedArtifact(artifactURI);
artifact.setLocation(artifactURL);
contribution.addArtifact(artifact);
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=512518&r1=512517&r2=512518
==============================================================================
--- 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 Tue Feb 27 16:19:47 2007
@@ -109,7 +109,7 @@
URI artifactURI;
try {
- artifactURI = new URI(source.toString() + "/" + FileHelper.getName(artifactURL.getPath()));
+ artifactURI = new URI(source.toString() + FileHelper.getName(artifactURL.getPath()));
DeployedArtifact artifact = new DeployedArtifact(artifactURI);
artifact.setLocation(artifactURL);
contribution.addArtifact(artifact);
Modified: 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=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/ScdlContributionProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/ScdlContributionProcessor.java Tue Feb 27 16:19:47 2007
@@ -80,8 +80,10 @@
implementation.setComponentType(componentType);
ComponentDefinition<CompositeImplementation> componentDefinition =
new ComponentDefinition<CompositeImplementation>(implementation);
+
+ componentDefinition.setName(source.toString());
- contribution.getArtifact(source).addModelObject(null, null, componentDefinition);
+ contribution.getArtifact(source).addModelObject(CompositeComponentType.class, null, componentDefinition);
} catch (LoaderException le) {
throw new InvalidComponentDefinitionlException(contribution.getArtifact(source).getLocation()
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImplTestCase.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/AssemblyServiceImplTestCase.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImplTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImplTestCase.java Tue Feb 27 16:19:47 2007
@@ -90,7 +90,7 @@
protected void setUp() throws Exception {
super.setUp();
- service = new AssemblyServiceImpl();
+ service = new AssemblyServiceImpl(null, null);
}
private static class MockURLStreamHandler extends URLStreamHandler {
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/AssemblyService.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/AssemblyService.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/AssemblyService.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/AssemblyService.java Tue Feb 27 16:19:47 2007
@@ -20,6 +20,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.net.URI;
import java.net.URL;
/**
@@ -28,6 +29,9 @@
* @version $Rev$ $Date$
*/
public interface AssemblyService {
+
+ Object addCompositeToDomain(URI contribution, URI composite) throws DeploymentException, IOException;
+
/**
* Apply a set of changes to the SCA Domain's logical assembly.
*
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionService.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/ContributionService.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionService.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionService.java Tue Feb 27 16:19:47 2007
@@ -56,6 +56,12 @@
URI contribute(URI source, InputStream contribution, boolean storeInRepository) throws DeploymentException, IOException;
/**
+ * @param contribution
+ * @return
+ */
+ Object getContributionMetaData(URI contribution);
+
+ /**
* Remove a contribution from the SCA domain
* @param contribution The URI of the contribution
* @throws DeploymentException
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java Tue Feb 27 16:19:47 2007
@@ -28,21 +28,35 @@
/**
* Interface that can be used to deploy SCA bundles to a runtime.
- *
+ *
* @version $Rev$ $Date$
*/
public interface Deployer {
/**
- * Deploy a component as a child of the supplied parent. This operation creates a new component in the runtime to
- * represent the supplied component definition. The type of component created will depend on the component
- * definition implementation; for example, if the implementation of the component definition is a composite then
- * typically a CompositeComponent would be returned.
- *
- * @param parent the parent context
- * @param componentDefinition the component definition as parsed from an assembly
+ * Deploy a component as a child of the supplied parent. This operation creates a new component in the runtime to represent the supplied component
+ * definition. The type of component created will depend on the component definition implementation; for example, if the implementation of the
+ * component definition is a composite then typically a CompositeComponent would be returned.
+ *
+ * @param parent
+ * the parent context
+ * @param componentDefinition
+ * the component definition as parsed from an assembly
* @return the newly deployed component
*/
- <I extends Implementation<?>> Component deploy(CompositeComponent parent,
- ComponentDefinition<I> componentDefinition)
- throws LoaderException, BuilderException, ComponentException;
+ <I extends Implementation<?>> Component deploy(CompositeComponent parent, ComponentDefinition<I> componentDefinition)
+ throws LoaderException, BuilderException, ComponentException;
+
+ /**
+ * Deploy a component as a child of the supplied parent. This operation creates a new component in the runtime to represent the supplied component
+ * definition. The type of component created will depend on the component definition implementation; for example, if the implementation of the
+ * component definition is a composite then typically a CompositeComponent would be returned.
+ *
+ * @param parent
+ * the parent context
+ * @param componentDefinition
+ * the component definition as parsed from an assembly
+ * @return the newly deployed component
+ */
+ <I extends Implementation<?>> Component deployFromContribution(CompositeComponent parent,
+ ComponentDefinition<I> componentDefinition) throws BuilderException, ComponentException;
}
Modified: incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java?view=diff&rev=512518&r1=512517&r2=512518
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java Tue Feb 27 16:19:47 2007
@@ -38,13 +38,15 @@
private Map<String, URL> extensions = new HashMap<String, URL>();
private URL applicationSCDL;
private URL systemSCDL;
+ private String compositePath = "META-INF/sca/application.composite";
+
protected CompositeComponent component;
protected void setUp() throws Exception {
super.setUp();
SCAContainer.start(systemSCDL, extensions == null || extensions.isEmpty() ? null :
- extensions.values().toArray(new URL[0]), applicationSCDL);
+ extensions.values().toArray(new URL[0]), applicationSCDL, compositePath);
// FIXME: How to expose the composite component?
this.component = ((DefaultSCAContainer)SCAContainer.getInstance()).getCompsiteComponent();
@@ -69,6 +71,7 @@
*/
protected void setApplicationSCDL(String applicationSCDL) {
this.applicationSCDL = Thread.currentThread().getContextClassLoader().getResource(applicationSCDL);
+ this.compositePath = applicationSCDL;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org