tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject svn commit: r400236 - in /incubator/tuscany/java/sca: containers/container.java/src/main/java/org/apache/tuscany/container/java/config/ containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/ containers/container.java/src...
Date Sat, 06 May 2006 04:35:49 GMT
Author: jmarino
Date: Fri May  5 21:35:48 2006
New Revision: 400236

URL: http://svn.apache.org/viewcvs?rev=400236&view=rev
Log:
fix for TUSCANY-299

Modified:
    incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java
    incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
    incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java
    incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java

Modified: incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java?rev=400236&r1=400235&r2=400236&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java
(original)
+++ incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java
Fri May  5 21:35:48 2006
@@ -214,7 +214,6 @@
      * responsible for injecting them into the reference
      */
     private Injector createReferenceInjector(String refName, List<SourceWireFactory>
wireFactories, boolean multiplicity) {
-        assert wireFactories.size() > 0;
         Class refClass = wireFactories.get(0).getBusinessInterface(); //reference.getPort().getServiceContract().getInterface();
         // iterate through the targets
         List<ObjectFactory> objectFactories = new ArrayList<ObjectFactory>();

Modified: incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java?rev=400236&r1=400235&r2=400236&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
(original)
+++ incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
Fri May  5 21:35:48 2006
@@ -29,8 +29,15 @@
     @Property
     public String locale;
 
+    public void setGreetingProvider(GreetingProvider greetingProvider) {
+        this.greetingProvider2 = greetingProvider;
+    }
+
     @Reference(name="greetingProvider")
     public GreetingProvider greetingProvider2;
+
+    @Reference(required=false)
+    public GreetingProvider foo;
 
     public String getGreetings(String name) {
         return greetingProvider2.getGreeting(name, locale);

Modified: incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java?rev=400236&r1=400235&r2=400236&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java
(original)
+++ incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java
Fri May  5 21:35:48 2006
@@ -45,6 +45,7 @@
 import org.apache.tuscany.container.java.mock.components.SourceImpl;
 import org.apache.tuscany.container.java.mock.components.Target;
 import org.apache.tuscany.container.java.mock.components.TargetImpl;
+import org.apache.tuscany.container.java.mock.components.ModuleScopeComponent;
 import org.apache.tuscany.core.builder.BuilderException;
 import org.apache.tuscany.core.builder.ContextFactory;
 import org.apache.tuscany.core.builder.ContextFactoryBuilder;
@@ -175,7 +176,7 @@
         return sc;
     }
 
-    public static AtomicComponent createNonIntrospectedComponent(String name, Class type,
Scope scope) throws ConfigurationLoadException {
+    public static AtomicComponent createNonIntrospectedComponent(String name, Class service,
 Class type, Scope scope) throws ConfigurationLoadException {
          AtomicComponent sc = factory.createSimpleComponent();
          JavaImplementation impl = factory.createJavaImplementation();
          impl.setComponentInfo(factory.createComponentInfo());
@@ -183,7 +184,7 @@
          sc.setImplementation(impl);
          Service s = factory.createService();
          JavaServiceContract ji = factory.createJavaServiceContract();
-         ji.setInterface(type);
+         ji.setInterface(service);
          s.setServiceContract(ji);
          ji.setScope(scope);
          impl.getComponentInfo().getServices().add(s);
@@ -302,8 +303,8 @@
      * Creates a module with a Java-based "target" component wired to a "source"
      */
     public static Module createModule(Scope sourceScope, Scope targetScope) throws ConfigurationLoadException
{
-        Component sourceComponent = createNonIntrospectedComponent("source", ModuleScopeComponentImpl.class,
sourceScope);
-        Component targetComponent = createNonIntrospectedComponent("target", ModuleScopeComponentImpl.class,
targetScope);
+        Component sourceComponent = createNonIntrospectedComponent("source", ModuleScopeComponent.class,
ModuleScopeComponentImpl.class, sourceScope);
+        Component targetComponent = createNonIntrospectedComponent("target", ModuleScopeComponent.class,
ModuleScopeComponentImpl.class, targetScope);
 
         Service targetService = factory.createService();
         JavaServiceContract targetContract = factory.createJavaServiceContract();

Modified: incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java?rev=400236&r1=400235&r2=400236&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java
(original)
+++ incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java
Fri May  5 21:35:48 2006
@@ -23,7 +23,9 @@
  */
 @Scope("MODULE")
 public interface ModuleScopeComponent extends GenericComponent {
+    public GenericComponent getGenericComponent();
 
+    public String getString();
     //public boolean isInit();
 }
 

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java?rev=400236&r1=400235&r2=400236&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java
(original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java
Fri May  5 21:35:48 2006
@@ -78,6 +78,7 @@
      * @throws ConfigurationException if there was a problem loading the SCA configuration
      */
     public TuscanyRuntime(String name, String uri, MonitorFactory monitorFactory) throws
ConfigurationException {
+        assert(monitorFactory != null): "monitor factory was null";
         this.monitor = monitorFactory.getMonitor(Monitor.class);
 
         // Create an assembly model context

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java?rev=400236&r1=400235&r2=400236&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java
(original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java
Fri May  5 21:35:48 2006
@@ -20,7 +20,6 @@
 import org.osoa.sca.RequestContext;
 import org.osoa.sca.ServiceReference;
 import org.osoa.sca.ServiceUnavailableException;
-import org.osoa.sca.ServiceRuntimeException;
 
 import org.apache.tuscany.core.context.AutowireContext;
 import org.apache.tuscany.core.context.CompositeContext;

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java?rev=400236&r1=400235&r2=400236&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java
(original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java
Fri May  5 21:35:48 2006
@@ -126,6 +126,11 @@
             List<ConfiguredReference> configuredReferences = component.getConfiguredReferences();
             if (configuredReferences != null) {
                 for (ConfiguredReference reference : configuredReferences) {
+                    if (reference.getPort().getMultiplicity() == Multiplicity.ZERO_N || reference.getPort().getMultiplicity()
== Multiplicity.ZERO_ONE){
+                        if (reference.getTargetConfiguredServices().size() < 1 &&
reference.getTargets().size() <1 ){
+                            continue; // not required, not configured fix TUSCANY-299 
+                        }
+                    }
                     List<SourceWireFactory> wireFactories = wireFactoryService.createSourceFactory(reference);
                     String refName = reference.getPort().getName();
                     Class refClass = reference.getPort().getServiceContract().getInterface();



Mime
View raw message