You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2007/03/04 00:22:28 UTC
svn commit: r514267 - in
/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core:
deployer/federation/FederatedDeployer.java
marshaller/PhysicalChangeSetMarshaller.java
Author: meerajk
Date: Sat Mar 3 15:22:27 2007
New Revision: 514267
URL: http://svn.apache.org/viewvc?view=rev&rev=514267
Log:
started integrating the marshaller and new builder framework with the commponent manager and connector
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java?view=diff&rev=514267&r1=514266&r2=514267
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java Sat Mar 3 15:22:27 2007
@@ -18,27 +18,30 @@
*/
package org.apache.tuscany.core.deployer.federation;
-import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
-import org.osoa.sca.annotations.Reference;
-
+import org.apache.tuscany.core.component.ComponentManager;
+import org.apache.tuscany.core.marshaller.PhysicalChangeSetMarshaller;
import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.builder.Connector;
import org.apache.tuscany.spi.builder.physical.PhysicalComponentBuilderRegistry;
import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.RegistrationException;
import org.apache.tuscany.spi.marshaller.MarshallException;
import org.apache.tuscany.spi.marshaller.ModelMarshallerRegistry;
+import org.apache.tuscany.spi.model.physical.PhysicalChangeSet;
import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
+import org.apache.tuscany.spi.model.physical.PhysicalWireDefinition;
import org.apache.tuscany.spi.services.discovery.DiscoveryService;
import org.apache.tuscany.spi.services.discovery.RequestListener;
+import org.osoa.sca.annotations.Reference;
/**
* Federated deployer that deploys components in response to asynchronous messages from the federated domain.
*
* @version $Revision$ $Date$
*/
-public abstract class FederatedDeployer<PCD extends PhysicalComponentDefinition, C extends Component> implements
- RequestListener {
+public class FederatedDeployer implements RequestListener {
/**
* Marshaller registry.
@@ -49,6 +52,16 @@
* Physical component builder registry.
*/
private PhysicalComponentBuilderRegistry builderRegistry;
+
+ /**
+ * Component manager.
+ */
+ private ComponentManager componentManager;
+
+ /**
+ * Connector.
+ */
+ private Connector connector;
/**
* Deploys the component.
@@ -62,14 +75,24 @@
try {
- final PCD definition = unmarshallDefinition(content);
- final C component = buildComponent(definition);
- component.start();
+ final PhysicalChangeSet changeSet = (PhysicalChangeSet) marshallerRegistry.unmarshall(content);
+
+ for(PhysicalComponentDefinition pcd : changeSet.getComponentDefinitions()) {
+ final Component component = null;
+ // TODO build the components using builder registry
+ componentManager.register(component);
+ component.start();
+ }
+ for(PhysicalWireDefinition pwd : changeSet.getWireDefinitions()) {
+ connector.connect(pwd);
+ }
} catch (MarshallException ex) {
return null;
} catch (BuilderException ex) {
return null;
+ } catch (RegistrationException ex) {
+ return null;
}
return null;
@@ -77,18 +100,15 @@
/**
* Injects the discovery service.
- *
* @param discoveryService Discovery service to be injected.
*/
@Reference
public void setDiscoveryService(DiscoveryService discoveryService) {
- QName messageType = getQualifiedName();
- discoveryService.registerRequestListener(messageType, this);
+ discoveryService.registerRequestListener(PhysicalChangeSetMarshaller.QNAME, this);
}
/**
* Injects the model marshaller registry.
- *
* @param marshallerRegistry Marshaller registry.
*/
@Reference
@@ -98,7 +118,6 @@
/**
* Injects the builder registry.
- *
* @param builderRegistry Builder registry.
*/
@Reference
@@ -107,47 +126,21 @@
}
/**
- * Gets the builder registry.
- *
- * @return Return the builder registry.
+ * Injects the component manager.
+ * @param componentManager Component manager.
*/
- protected PhysicalComponentBuilderRegistry getBuilderRegistry() {
- return builderRegistry;
+ @Reference
+ public void setComponentManager(ComponentManager componentManager) {
+ this.componentManager = componentManager;
}
/**
- * Gets the marshaller registry.
- *
- * @return Return the marshaller registry.
+ * Injects the connector.
+ * @param connector Connector.
*/
- protected ModelMarshallerRegistry getMarshallerRegistry() {
- return marshallerRegistry;
+ @Reference
+ public void setConnector(Connector connector) {
+ this.connector = connector;
}
-
- /**
- * Returns the qualified name of the root element of the marshalled component definition this deployer is interested
- * in.
- *
- * @return The qualified name of the document element.
- */
- protected abstract QName getQualifiedName();
-
- /**
- * Unmarshalls the XML stream to a component definition.
- *
- * @param content XML content stream.
- * @return Physical component definition.
- * @throws MarshallException If unable to marshall the component definition.
- */
- protected abstract PCD unmarshallDefinition(XMLStreamReader content) throws MarshallException;
-
- /**
- * Builds the component from the physical component definition.
- *
- * @param componentDefinition Component definition.
- * @return Component instance.
- * @throws BuilderException If unable to build the component.
- */
- protected abstract C buildComponent(PCD componentDefinition) throws BuilderException;
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java?view=diff&rev=514267&r1=514266&r2=514267
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java Sat Mar 3 15:22:27 2007
@@ -41,7 +41,7 @@
public class PhysicalChangeSetMarshaller extends AbstractMarshallerExtension<PhysicalChangeSet> {
// QName for the root element
- private static final QName QNAME = new QName("http://tuscany.apache.org/xmlns/marshaller/1.0-SNAPSHOT", "changeSet");
+ public static final QName QNAME = new QName("http://tuscany.apache.org/xmlns/marshaller/1.0-SNAPSHOT", "changeSet");
// Local part for wire
private static final String WIRE = "wire";
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org