You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/04/27 22:09:35 UTC
svn commit: r533206 - in /incubator/tuscany/java/sca/modules:
assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/
assembly/src/main/java/org/apache/tuscany/assembly/
assembly/src/main/java/org/apache/tuscany/assembly/impl/
assembly/src/main/jav...
Author: jsdelfino
Date: Fri Apr 27 13:09:34 2007
New Revision: 533206
URL: http://svn.apache.org/viewvc?view=rev&rev=533206
Log:
Added logic to instanciate composite definitions in the presence of nested composites. Simplified SimpleRuntime and TuscanyRuntime a bit.
Removed:
incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/services/classloading/
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/services/classloading/
Modified:
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java
incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/SimpleRuntimeImpl.java
incubator/tuscany/java/sca/modules/host-spi/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java
incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java
incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/interfacedef/java/xml/ReadTestCase.java
incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/interfacedef/wsdl/xml/ReadTestCase.java
Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java Fri Apr 27 13:09:34 2007
@@ -498,7 +498,7 @@
public void wire(Composite composite) throws ContributionWireException {
// Process the composite configuration
- CompositeUtil compositeUtil = new CompositeUtil(factory, interfaceContractMapper, composite);
+ CompositeUtil compositeUtil = new CompositeUtil(factory, interfaceContractMapper);
List<Base> problems = new ArrayList<Base>() {
private static final long serialVersionUID = 4819831446590718923L;
@@ -520,14 +520,14 @@
// Collect and fuse includes
- compositeUtil.fuseIncludes(problems);
+ compositeUtil.fuseIncludes(composite, problems);
// Configure all components
- compositeUtil.configureComponents(problems);
+ compositeUtil.configureComponents(composite, problems);
//FIXME this should be done only on top level deployable composites
// Wire references
- compositeUtil.wireReferences(problems);
+ compositeUtil.wireReferences(composite, problems);
// Uncommenting the following three lines can be useful to detect
// and troubleshoot SCA assembly XML composite configuration
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java Fri Apr 27 13:09:34 2007
@@ -20,6 +20,7 @@
import java.util.List;
+import org.apache.tuscany.assembly.util.Visitable;
import org.apache.tuscany.policy.IntentAttachPoint;
import org.apache.tuscany.policy.PolicySetAttachPoint;
@@ -29,7 +30,7 @@
*
* @version $Rev$ $Date$
*/
-public interface Component extends Base, IntentAttachPoint, PolicySetAttachPoint {
+public interface Component extends Base, IntentAttachPoint, PolicySetAttachPoint, Visitable {
/**
* Returns the name of the component.
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java Fri Apr 27 13:09:34 2007
@@ -22,12 +22,14 @@
import javax.xml.namespace.QName;
+import org.apache.tuscany.assembly.util.Visitable;
+
/**
* Represents a composite.
*
* @version $Rev$ $Date$
*/
-public interface Composite extends Implementation {
+public interface Composite extends Implementation, Visitable {
/**
* Returns the name of the composite.
@@ -101,4 +103,13 @@
* @return a copy of the composite.
*/
Composite copy();
+
+ /**
+ * Returns an instance of the composite. Components inside the
+ * composite are copied but the aspects of the componentType
+ * (services, references and properties) are not copied.
+ * @return
+ */
+ Composite instanciate();
+
}
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java Fri Apr 27 13:09:34 2007
@@ -27,7 +27,7 @@
*
* @version $Rev$ $Date$
*/
-public interface Wire extends Base, IntentAttachPoint, PolicySetAttachPoint, Visitable {
+public interface Wire extends Base, IntentAttachPoint, PolicySetAttachPoint {
/**
* Returns the source of the wire.
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java Fri Apr 27 13:09:34 2007
@@ -27,6 +27,7 @@
import org.apache.tuscany.assembly.ComponentService;
import org.apache.tuscany.assembly.ConstrainingType;
import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.assembly.util.Visitable;
import org.apache.tuscany.assembly.util.Visitor;
import org.apache.tuscany.policy.Intent;
import org.apache.tuscany.policy.PolicySet;
@@ -36,7 +37,9 @@
*
* @version $Rev$ $Date$
*/
-public class ComponentImpl extends BaseImpl implements Component {
+public class ComponentImpl implements Component, Visitable {
+ private List<Object> extensions = new ArrayList<Object>();
+ private boolean unresolved;
private ConstrainingType constrainingType;
private Implementation implementation;
private String name;
@@ -54,6 +57,9 @@
}
public ComponentImpl(Component other) {
+ unresolved = other.isUnresolved();
+ extensions.addAll(other.getExtensions());
+
constrainingType = other.getConstrainingType();
implementation = other.getImplementation();
name = other.getName();
@@ -71,6 +77,40 @@
autowire = other.isAutowire();
}
+ public Component instanciate() {
+ ComponentImpl instance = new ComponentImpl();
+ instance.instanciate(this);
+ return instance;
+ }
+
+ private void instanciate(Component other) {
+ unresolved = other.isUnresolved();
+ extensions.addAll(other.getExtensions());
+
+ constrainingType = other.getConstrainingType();
+ implementation = other.getImplementation();
+ name = other.getName();
+ properties = other.getProperties();
+ for (ComponentReference reference: other.getReferences()) {
+ references.add(new ComponentReferenceImpl(reference));
+ }
+ requiredIntents = other.getRequiredIntents();
+ policySets = other.getPolicySets();;
+ autowire = other.isAutowire();
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
public ConstrainingType getConstrainingType() {
return constrainingType;
}
@@ -124,7 +164,7 @@
}
public boolean accept(Visitor visitor) {
- if (!super.accept(visitor)) {
+ if (!visitor.visit(this)) {
return false;
}
for (ComponentProperty property : properties) {
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java Fri Apr 27 13:09:34 2007
@@ -21,11 +21,13 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.tuscany.assembly.Base;
import org.apache.tuscany.assembly.ComponentType;
import org.apache.tuscany.assembly.ConstrainingType;
import org.apache.tuscany.assembly.Property;
import org.apache.tuscany.assembly.Reference;
import org.apache.tuscany.assembly.Service;
+import org.apache.tuscany.assembly.util.Visitable;
import org.apache.tuscany.assembly.util.Visitor;
import org.apache.tuscany.policy.Intent;
import org.apache.tuscany.policy.PolicySet;
@@ -35,7 +37,9 @@
*
* @version $Rev$ $Date$
*/
-public class ComponentTypeImpl extends BaseImpl implements ComponentType {
+public class ComponentTypeImpl implements ComponentType, Visitable {
+ private List<Object> extensions = new ArrayList<Object>();
+ private boolean unresolved;
private String uri;
private ConstrainingType constrainingType;
private List<Property> properties = new ArrayList<Property>();
@@ -55,24 +59,41 @@
* @param other
*/
public ComponentTypeImpl(ComponentType other) {
- super(other);
+ unresolved = other.isUnresolved();
+ extensions.addAll(other.getExtensions());
+
uri = other.getURI();
constrainingType = other.getConstrainingType();
- getServices().clear();
for (Service service: other.getServices()) {
- getServices().add(new ServiceImpl(service));
+ services.add(new ServiceImpl(service));
}
- getReferences().clear();
for (Reference reference: other.getReferences()) {
- getReferences().add(new ReferenceImpl(reference));
+ references.add(new ReferenceImpl(reference));
}
for (Property property: other.getProperties()) {
- getProperties().add(new PropertyImpl(property));
+ properties.add(new PropertyImpl(property));
}
requiredIntents.addAll(other.getRequiredIntents());
policySets.addAll(other.getPolicySets());
}
+ /**
+ * Instanciate...
+ * @param other
+ */
+ protected void instanciate(ComponentType other) {
+ unresolved = other.isUnresolved();
+ extensions = other.getExtensions();
+
+ uri = other.getURI();
+ constrainingType = other.getConstrainingType();
+ services = other.getServices();
+ references = other.getReferences();
+ properties = other.getProperties();
+ requiredIntents = other.getRequiredIntents();
+ policySets = other.getPolicySets();
+ }
+
public String getURI() {
return uri;
}
@@ -109,8 +130,20 @@
return policySets;
}
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
public boolean accept(Visitor visitor) {
- if (!super.accept(visitor)) {
+ if (!visitor.visit(this)) {
return false;
}
for (Property property : properties) {
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java Fri Apr 27 13:09:34 2007
@@ -28,7 +28,6 @@
import org.apache.tuscany.assembly.Composite;
import org.apache.tuscany.assembly.CompositeReference;
import org.apache.tuscany.assembly.CompositeService;
-import org.apache.tuscany.assembly.Property;
import org.apache.tuscany.assembly.Reference;
import org.apache.tuscany.assembly.Service;
import org.apache.tuscany.assembly.Wire;
@@ -54,6 +53,9 @@
*/
public CompositeImpl(Composite other) {
super(other);
+ name = other.getName();
+ autowire = other.isAutowire();
+ local = other.isLocal();
for (Component component: other.getComponents()) {
components.add(new ComponentImpl(component));
}
@@ -65,15 +67,9 @@
for (Reference reference: other.getReferences()) {
getReferences().add(new CompositeReferenceImpl((CompositeReference)reference));
}
- for (Property property: other.getProperties()) {
- getProperties().add(new PropertyImpl(property));
- }
- name = other.getName();
for (Wire wire: other.getWires()) {
wires.add(new WireImpl(wire));
}
- autowire = other.isAutowire();
- local = other.isLocal();
}
public List<Component> getComponents() {
@@ -119,8 +115,14 @@
return false;
}
+ for (Component component: components) {
+ if (!component.accept(visitor)) {
+ return false;
+ }
+ }
+
for (Wire wire: wires) {
- if (!wire.accept(visitor))
+ if (!visitor.visit(wire))
return false;
}
return true;
@@ -129,6 +131,26 @@
public Composite copy() {
CompositeImpl copy = new CompositeImpl(this);
return copy;
+ }
+
+ public Composite instanciate() {
+ CompositeImpl instance = new CompositeImpl();
+ instance.instanciate(this);
+ return instance;
+ }
+
+ protected void instanciate(Composite other) {
+ super.instanciate(other);
+
+ name = other.getName();
+ autowire = other.isAutowire();
+ local = other.isLocal();
+ for (Component component: other.getComponents()) {
+ components.add(new ComponentImpl(component));
+ }
+ for (Wire wire: other.getWires()) {
+ wires.add(new WireImpl(wire));
+ }
}
@Override
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java Fri Apr 27 13:09:34 2007
@@ -53,7 +53,6 @@
private AssemblyFactory assemblyFactory;
private InterfaceContractMapper interfaceContractMapper;
- private Composite composite;
/**
* Constructs a new composite util.
@@ -63,11 +62,9 @@
* @param composite
*/
public CompositeUtil(AssemblyFactory assemblyFactory,
- InterfaceContractMapper interfaceContractMapper,
- Composite composite) {
+ InterfaceContractMapper interfaceContractMapper) {
this.assemblyFactory = assemblyFactory;
this.interfaceContractMapper = interfaceContractMapper;
- this.composite = composite;
}
/**
@@ -75,13 +72,14 @@
*
* @param composite
*/
- public CompositeUtil(Composite composite) {
+ public CompositeUtil() {
this(new DefaultAssemblyFactory(),
- new DefaultInterfaceContractMapper(), composite);
+ new DefaultInterfaceContractMapper());
}
/**
- * Collect all includes in a graph of includes
+ * Collect all includes in a graph of includes.
+ *
* @param composite
* @param includes
*/
@@ -93,11 +91,12 @@
}
/**
- * Copy a list of includes into a composite
+ * Copy a list of includes into a composite.
+ *
* @param composite
* @param includes
*/
- public void fuseIncludes(List<Base> problems) {
+ public void fuseIncludes(Composite composite, List<Base> problems) {
// First collect all includes
List<Composite> includes = new ArrayList<Composite>();
@@ -344,9 +343,11 @@
/**
* Configure components in the composite.
+ *
+ * @param composite
* @param problems
*/
- public void configureComponents(List<Base> problems) {
+ public void configureComponents(Composite composite, List<Base> problems) {
// Initialize all component services and references
Map<String, Component> components = new HashMap<String, Component>();
@@ -443,11 +444,14 @@
/**
* Create SCA bindings for component services and references.
+ *
+ * @param composite
* @param componentServices
* @param componentReferences
* @param problems
*/
- private void createSCABindings(Map<String, ComponentService> componentServices,
+ private void createSCABindings(Composite composite,
+ Map<String, ComponentService> componentServices,
Map<String, ComponentReference> componentReferences,
List<Base> problems) {
@@ -490,10 +494,11 @@
/**
* Resolves promoted services
*
+ * @param composite
* @param componentServices
* @param problems
*/
- private void connectPromotedServices(
+ private void connectPromotedServices(Composite composite,
Map<String, ComponentService> componentServices,
List<Base> problems) {
@@ -523,11 +528,13 @@
}
/**
- * Resolves promoted references
+ * Resolves promoted references.
+ *
+ * @param composite
* @param componentReferences
* @param problems
*/
- private void connectPromotedReferences(
+ private void connectPromotedReferences(Composite composite,
Map<String, ComponentReference> componentReferences,
List<Base> problems) {
@@ -560,12 +567,14 @@
}
/**
- * Connect references to their targets
+ * Connect references to their targets.
+ *
+ * @param composite
* @param componentServices
* @param componentReferences
* @param problems
*/
- private void connectReferenceTargets(
+ private void connectReferenceTargets(Composite composite,
Map<String, ComponentService> componentServices,
Map<String, ComponentReference> componentReferences,
List<Base> problems) {
@@ -646,11 +655,13 @@
/**
* Resolve wires and connect the sources to their targets
+ *
+ * @param composite
* @param componentServices
* @param componentReferences
* @param problems
*/
- private void connectWiredReferences(
+ private void connectWiredReferences(Composite composite,
Map<String, ComponentService> componentServices,
Map<String, ComponentReference> componentReferences,
List<Base> problems) {
@@ -706,24 +717,24 @@
*
* @param problems
*/
- public void wireReferences(List<Base> problems) {
+ public void wireReferences(Composite composite, List<Base> problems) {
// Index and bind all component services and references
Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
// Create SCA bindings on all component services and references
- createSCABindings(componentServices, componentReferences, problems);
+ createSCABindings(composite, componentServices, componentReferences, problems);
// Resolve promoted services and references
- connectPromotedServices(componentServices, problems);
- connectPromotedReferences(componentReferences, problems);
+ connectPromotedServices(composite, componentServices, problems);
+ connectPromotedReferences(composite, componentReferences, problems);
// Connect references to their targets
- connectReferenceTargets(componentServices, componentReferences, problems);
+ connectReferenceTargets(composite, componentServices, componentReferences, problems);
// Connect references as described in wires
- connectWiredReferences(componentServices, componentReferences, problems);
+ connectWiredReferences(composite, componentServices, componentReferences, problems);
// Validate that references are wired or promoted, according
// to their multiplicity
@@ -735,5 +746,23 @@
problems.add(componentReference);
}
}
+ }
+
+ /**
+ * Expand composite component implementations.
+ * @param composite
+ * @param problems
+ */
+ public void expandComposites(Composite composite, List<Base> problems) {
+ for (Component component: composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ Composite compositeImplementation = (Composite)implementation;
+ Composite instance = compositeImplementation.instanciate();
+ component.setImplementation(instance);
+ expandComposites(instance, problems);
+ }
+ }
}
}
Modified: incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java Fri Apr 27 13:09:34 2007
@@ -75,10 +75,10 @@
Composite composite = compositeProcessor.read(reader);
assertNotNull(composite);
- CompositeUtil compositeUtil = new CompositeUtil(composite);
- compositeUtil.fuseIncludes(new ArrayList<Base>());
- compositeUtil.configureComponents(new ArrayList<Base>());
- compositeUtil.wireReferences(new ArrayList<Base>());
+ CompositeUtil compositeUtil = new CompositeUtil();
+ compositeUtil.fuseIncludes(composite, new ArrayList<Base>());
+ compositeUtil.configureComponents(composite, new ArrayList<Base>());
+ compositeUtil.wireReferences(composite, new ArrayList<Base>());
//new PrintUtil(System.out).print(composite);
}
Modified: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java Fri Apr 27 13:09:34 2007
@@ -27,6 +27,7 @@
import org.apache.tuscany.assembly.ComponentService;
import org.apache.tuscany.assembly.ConstrainingType;
import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.assembly.util.Visitor;
import org.apache.tuscany.policy.Intent;
import org.apache.tuscany.policy.PolicySet;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
@@ -157,4 +158,25 @@
this.unresolved = undefined;
}
+ public boolean accept(Visitor visitor) {
+ if (!visitor.visit(this)) {
+ return false;
+ }
+ for (ComponentProperty property : properties) {
+ if (!visitor.visit(property)) {
+ return false;
+ }
+ }
+ for (ComponentReference reference : references) {
+ if (!visitor.visit(reference)) {
+ return false;
+ }
+ }
+ for (ComponentService service : services) {
+ if (!visitor.visit(service)) {
+ return false;
+ }
+ }
+ return true;
+ }
}
Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java Fri Apr 27 13:09:34 2007
@@ -34,12 +34,9 @@
import javax.xml.stream.XMLInputFactory;
-import org.apache.tuscany.contribution.service.ContributionService;
import org.apache.tuscany.core.ExtensionPointRegistry;
import org.apache.tuscany.core.ModuleActivator;
import org.apache.tuscany.core.component.ComponentManagerImpl;
-import org.apache.tuscany.core.monitor.NullMonitorFactory;
-import org.apache.tuscany.core.services.classloading.ClassLoaderRegistryImpl;
import org.apache.tuscany.core.util.IOHelper;
import org.apache.tuscany.core.work.Jsr237WorkScheduler;
import org.apache.tuscany.core.work.ThreadPoolWorkManager;
@@ -53,7 +50,6 @@
import org.apache.tuscany.spi.component.ScopeRegistry;
import org.apache.tuscany.spi.component.WorkContext;
import org.apache.tuscany.spi.deployer.Deployer;
-import org.apache.tuscany.spi.services.classloading.ClassLoaderRegistry;
import org.apache.tuscany.spi.services.management.TuscanyManagementService;
import org.apache.tuscany.spi.services.work.WorkScheduler;
import org.osoa.sca.ComponentContext;
@@ -62,17 +58,15 @@
* @version $Rev$ $Date$
*/
public abstract class AbstractRuntime<I extends RuntimeInfo> implements TuscanyRuntime<I> {
- private static final URI HOST_CLASSLOADER_ID = URI.create("sca://./hostClassLoader");
-
- private static final URI BOOT_CLASSLOADER_ID = URI.create("sca://./bootClassLoader");
protected final XMLInputFactory xmlFactory;
protected String applicationName;
protected URL applicationScdl;
protected Class<I> runtimeInfoType;
protected ManagementService<?> managementService;
+
+ protected ClassLoader hostClassLoader;
- // primorial components automatically registered with the runtime
/**
* Information provided by the host about its runtime environment.
*/
@@ -90,11 +84,6 @@
protected ComponentManager componentManager;
protected ExtensionPointRegistry extensionRegistry;
- /**
- * Registry for ClassLoaders used by this runtime.
- */
- protected ClassLoaderRegistry classLoaderRegistry;
-
protected Component systemComponent;
protected Component tuscanySystem;
@@ -103,24 +92,12 @@
protected ThreadPoolWorkManager workManager;
- protected AbstractRuntime(Class<I> runtimeInfoType) {
- this(runtimeInfoType, new NullMonitorFactory());
- }
-
- protected AbstractRuntime(Class<I> runtimeInfoType, MonitorFactory monitorFactory) {
+ protected AbstractRuntime(Class<I> runtimeInfoType, I runtimeInfo, MonitorFactory monitorFactory, ClassLoader hostClassLoader) {
this.runtimeInfoType = runtimeInfoType;
+ this.runtimeInfo = runtimeInfo;
this.monitorFactory = monitorFactory;
+ this.hostClassLoader = hostClassLoader;
xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
- classLoaderRegistry = new ClassLoaderRegistryImpl();
- classLoaderRegistry.register(BOOT_CLASSLOADER_ID, getClass().getClassLoader());
- }
-
- public String getApplicationName() {
- return applicationName;
- }
-
- public void setApplicationName(String applicationName) {
- this.applicationName = applicationName;
}
public URL getApplicationSCDL() {
@@ -131,22 +108,6 @@
this.applicationScdl = applicationScdl;
}
- public ClassLoader getHostClassLoader() {
- return classLoaderRegistry.getClassLoader(HOST_CLASSLOADER_ID);
- }
-
- public void setHostClassLoader(ClassLoader hostClassLoader) {
- classLoaderRegistry.register(HOST_CLASSLOADER_ID, hostClassLoader);
- }
-
- public I getRuntimeInfo() {
- return runtimeInfo;
- }
-
- public void setRuntimeInfo(I runtimeInfo) {
- this.runtimeInfo = runtimeInfo;
- }
-
public MonitorFactory getMonitorFactory() {
return monitorFactory;
}
@@ -178,7 +139,7 @@
this.scopeRegistry = bootstrapper.getScopeRegistry();
- activators = getInstances(getHostClassLoader(), ModuleActivator.class);
+ activators = getInstances(hostClassLoader, ModuleActivator.class);
for (ModuleActivator activator : activators) {
Map<Class, Object> extensionPoints = activator.getExtensionPoints();
if (extensionPoints != null) {
@@ -228,9 +189,6 @@
protected void registerSystemExtensionPoints() throws InitializationException {
// register the RuntimeInfo provided by the host
extensionRegistry.addExtensionPoint(runtimeInfoType, runtimeInfo);
-
- // register the ClassLoaderRegistry
- extensionRegistry.addExtensionPoint(ClassLoaderRegistry.class, classLoaderRegistry);
// register the ComponentManager to that the fabric can wire to it
extensionRegistry.addExtensionPoint(ComponentManager.class, componentManager);
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/SimpleRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/SimpleRuntimeImpl.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/SimpleRuntimeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/SimpleRuntimeImpl.java Fri Apr 27 13:09:34 2007
@@ -52,6 +52,7 @@
import org.apache.tuscany.core.DefaultExtensionPointRegistry;
import org.apache.tuscany.core.ExtensionPointRegistry;
import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.monitor.NullMonitorFactory;
import org.apache.tuscany.core.runtime.AbstractRuntime;
import org.apache.tuscany.host.runtime.InitializationException;
import org.apache.tuscany.spi.Scope;
@@ -69,13 +70,13 @@
*/
public class SimpleRuntimeImpl extends AbstractRuntime<SimpleRuntimeInfo> implements SimpleRuntime {
private ScopeContainer<URI> container;
+
+ private SimpleRuntimeInfo simpleRuntimeInfo;
public SimpleRuntimeImpl(SimpleRuntimeInfo runtimeInfo) {
- super(SimpleRuntimeInfo.class);
- ClassLoader hostClassLoader = runtimeInfo.getClassLoader();
- setHostClassLoader(hostClassLoader);
+ super(SimpleRuntimeInfo.class, runtimeInfo, new NullMonitorFactory(), runtimeInfo.getClassLoader());
setApplicationSCDL(runtimeInfo.getApplicationSCDL());
- setRuntimeInfo(runtimeInfo);
+ this.simpleRuntimeInfo = runtimeInfo;
}
public void initialize() throws InitializationException {
@@ -145,7 +146,7 @@
// Create contribution service
ContributionRepository repository = new ContributionRepositoryImpl("target");
- DefaultArtifactResolver artifactResolver = new DefaultArtifactResolver(getHostClassLoader());
+ DefaultArtifactResolver artifactResolver = new DefaultArtifactResolver(simpleRuntimeInfo.getClassLoader());
ContributionService contributionService = new ContributionServiceImpl(repository, packageProcessors,
documentProcessors, artifactResolver);
initialize(extensionRegistry);
Modified: incubator/tuscany/java/sca/modules/host-spi/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-spi/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/host-spi/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java (original)
+++ incubator/tuscany/java/sca/modules/host-spi/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java Fri Apr 27 13:09:34 2007
@@ -30,34 +30,6 @@
*/
public interface TuscanyRuntime<I extends RuntimeInfo> {
/**
- * Returns the host ClassLoader that is parent to all Tuscany classloaders.
- *
- * @return the host's ClassLoader
- */
- ClassLoader getHostClassLoader();
-
- /**
- * Sets the host ClassLoader; this will be a parent for all Tuscany classloaders.
- *
- * @param classLoader the host's ClassLoader
- */
- void setHostClassLoader(ClassLoader classLoader);
-
- /**
- * Returns the info this runtime will make available to service components.
- *
- * @return the info this runtime will make available to service components
- */
- I getRuntimeInfo();
-
- /**
- * Sets the info this runtime should make available to service components.
- *
- * @param runtimeInfo the information this runtime should make available to service components
- */
- void setRuntimeInfo(I runtimeInfo);
-
- /**
* Returns the MonitorFactory that this runtime is using.
*
* @return the MonitorFactory that this runtime is using
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java Fri Apr 27 13:09:34 2007
@@ -68,10 +68,10 @@
Composite composite = compositeProcessor.read(reader);
assertNotNull(composite);
- CompositeUtil compositeUtil = new CompositeUtil(composite);
- compositeUtil.fuseIncludes(new ArrayList<Base>());
- compositeUtil.configureComponents(new ArrayList<Base>());
- compositeUtil.wireReferences(new ArrayList<Base>());
+ CompositeUtil compositeUtil = new CompositeUtil();
+ compositeUtil.fuseIncludes(composite, new ArrayList<Base>());
+ compositeUtil.configureComponents(composite, new ArrayList<Base>());
+ compositeUtil.wireReferences(composite, new ArrayList<Base>());
//new PrintUtil(System.out).print(composite);
}
@@ -86,10 +86,10 @@
ArtifactResolver resolver = new DefaultArtifactResolver(getClass().getClassLoader());
staxProcessors.resolve(composite, resolver);
- CompositeUtil compositeUtil = new CompositeUtil(composite);
- compositeUtil.fuseIncludes(new ArrayList<Base>());
- compositeUtil.configureComponents(new ArrayList<Base>());
- compositeUtil.wireReferences(new ArrayList<Base>());
+ CompositeUtil compositeUtil = new CompositeUtil();
+ compositeUtil.fuseIncludes(composite, new ArrayList<Base>());
+ compositeUtil.configureComponents(composite, new ArrayList<Base>());
+ compositeUtil.wireReferences(composite, new ArrayList<Base>());
//new PrintUtil(System.out).print(composite);
}
Modified: incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/interfacedef/java/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/interfacedef/java/xml/ReadTestCase.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/interfacedef/java/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/interfacedef/java/xml/ReadTestCase.java Fri Apr 27 13:09:34 2007
@@ -87,10 +87,10 @@
Composite composite = compositeProcessor.read(reader);
assertNotNull(composite);
- CompositeUtil compositeUtil = new CompositeUtil(composite);
- compositeUtil.fuseIncludes(new ArrayList<Base>());
- compositeUtil.configureComponents(new ArrayList<Base>());
- compositeUtil.wireReferences(new ArrayList<Base>());
+ CompositeUtil compositeUtil = new CompositeUtil();
+ compositeUtil.fuseIncludes(composite, new ArrayList<Base>());
+ compositeUtil.configureComponents(composite, new ArrayList<Base>());
+ compositeUtil.wireReferences(composite, new ArrayList<Base>());
//new PrintUtil(System.out).print(composite);
}
Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/interfacedef/wsdl/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/interfacedef/wsdl/xml/ReadTestCase.java?view=diff&rev=533206&r1=533205&r2=533206
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/interfacedef/wsdl/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/interfacedef/wsdl/xml/ReadTestCase.java Fri Apr 27 13:09:34 2007
@@ -87,10 +87,10 @@
Composite composite = compositeProcessor.read(reader);
assertNotNull(composite);
- CompositeUtil compositeUtil = new CompositeUtil(composite);
- compositeUtil.fuseIncludes(new ArrayList<Base>());
- compositeUtil.configureComponents(new ArrayList<Base>());
- compositeUtil.wireReferences(new ArrayList<Base>());
+ CompositeUtil compositeUtil = new CompositeUtil();
+ compositeUtil.fuseIncludes(composite, new ArrayList<Base>());
+ compositeUtil.configureComponents(composite, new ArrayList<Base>());
+ compositeUtil.wireReferences(composite, new ArrayList<Base>());
//new PrintUtil(System.out).print(composite);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org