You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/04/13 17:19:37 UTC

[1/2] zest-java git commit: Fixed compile errors that has snuck in.

Repository: zest-java
Updated Branches:
  refs/heads/ZEST-105 15f156d50 -> e5c57f95e


Fixed compile errors that has snuck in.


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/be492ed6
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/be492ed6
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/be492ed6

Branch: refs/heads/ZEST-105
Commit: be492ed63de48807389ae0e69073774476771262
Parents: 15f156d
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Wed Apr 13 22:42:52 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Wed Apr 13 22:42:52 2016 +0800

----------------------------------------------------------------------
 .../apache/zest/library/groovy/GroovyMixinTest.java |  4 ++--
 .../zest/library/groovy/HelloSpeakerTest.java       |  2 +-
 .../apache/zest/library/scala/ScalaTraitMixin.java  | 16 ++++++++++++----
 3 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/be492ed6/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/GroovyMixinTest.java
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/GroovyMixinTest.java b/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/GroovyMixinTest.java
index f5f6e9d..6f42453 100644
--- a/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/GroovyMixinTest.java
+++ b/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/GroovyMixinTest.java
@@ -29,8 +29,8 @@ public class GroovyMixinTest extends AbstractZestTest
     @Test
     public void testInvoke()
     {
-        GroovyComposite domain1 = module.newTransient( GroovyComposite.class );
-        GroovyComposite domain2 = module.newTransient( GroovyComposite.class );
+        GroovyComposite domain1 = transientBuilderFactory.newTransient( GroovyComposite.class );
+        GroovyComposite domain2 = transientBuilderFactory.newTransient( GroovyComposite.class );
         Assert.assertEquals( "do1() in Groovy:1", domain1.do1() );
         Assert.assertEquals( "do1() in Groovy:2", domain1.do1() );
         Assert.assertEquals( "do1() in Groovy:3", domain1.do1() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/be492ed6/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java b/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
index ac36ec7..3f3e384 100644
--- a/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
+++ b/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
@@ -35,7 +35,7 @@ public class HelloSpeakerTest extends AbstractZestTest
     @Test
     public void testHello()
     {
-        HelloSpeaker speaker = module.newTransient( HelloSpeaker.class );
+        HelloSpeaker speaker = transientBuilderFactory.newTransient( HelloSpeaker.class );
         Assert.assertEquals( "Hello World!", speaker.sayHello( "World" ) );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/be492ed6/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/ScalaTraitMixin.java
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/ScalaTraitMixin.java b/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/ScalaTraitMixin.java
index 95dbc5c..493b6f9 100644
--- a/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/ScalaTraitMixin.java
+++ b/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/ScalaTraitMixin.java
@@ -30,9 +30,12 @@ import org.apache.zest.api.common.AppliesToFilter;
 import org.apache.zest.api.composite.Composite;
 import org.apache.zest.api.composite.CompositeInstance;
 import org.apache.zest.api.injection.scope.Service;
+import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.This;
 import org.apache.zest.api.service.ServiceReference;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.util.Classes;
+import org.apache.zest.spi.ZestSPI;
 
 import static org.apache.zest.api.util.Classes.interfacesOf;
 
@@ -45,6 +48,9 @@ public class ScalaTraitMixin
 {
     private static Map<Class<?>, Map<Method, InvocationHandler>> methods = new HashMap<>();
 
+    @Structure
+    private ZestSPI spi;
+
     private Class<?> compositeType;
 
     public ScalaTraitMixin( @This Composite composite )
@@ -79,8 +85,9 @@ public class ScalaTraitMixin
                             public Object invoke( Object composite, Method method, Object[] objects )
                                 throws Throwable
                             {
-                                return ( (CompositeInstance) Proxy.getInvocationHandler( composite ) ).module()
-                                    .findService( method.getReturnType() );
+                                CompositeInstance compositeInstance = (CompositeInstance) Proxy.getInvocationHandler( composite );
+                                ModuleDescriptor moduleDescriptor = compositeInstance.module();
+                                return moduleDescriptor.instance().findService( method.getReturnType() );
                             }
                         };
                         getHandlers( compositeType ).put( method, handler );
@@ -93,8 +100,9 @@ public class ScalaTraitMixin
                             public Object invoke( Object composite, Method method, Object[] objects )
                                 throws Throwable
                             {
-                                return ( (CompositeInstance) Proxy.getInvocationHandler( composite ) ).module()
-                                    .findService( method.getReturnType() ).get();
+                                CompositeInstance compositeInstance = (CompositeInstance) Proxy.getInvocationHandler( composite );
+                                ModuleDescriptor moduleDescriptor = compositeInstance.module();
+                                return moduleDescriptor.instance().findService( method.getReturnType() ).get();
                             }
                         };
                         getHandlers( compositeType ).put( method, handler );


[2/2] zest-java git commit: Fixed missing inclusion for finding importedServices in TypeLookup and findServiceReferences()

Posted by ni...@apache.org.
Fixed missing inclusion for finding importedServices in TypeLookup and findServiceReferences()


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/e5c57f95
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/e5c57f95
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/e5c57f95

Branch: refs/heads/ZEST-105
Commit: e5c57f95e199f8a79763debb2e101028f8e8f896
Parents: be492ed
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Wed Apr 13 23:14:44 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Wed Apr 13 23:14:44 2016 +0800

----------------------------------------------------------------------
 .../zest/runtime/service/ImportedServicesInstance.java      | 6 ++++++
 .../org/apache/zest/runtime/structure/ModuleInstance.java   | 9 +++++----
 .../org/apache/zest/runtime/structure/TypeLookupImpl.java   | 2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/e5c57f95/core/runtime/src/main/java/org/apache/zest/runtime/service/ImportedServicesInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/service/ImportedServicesInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/service/ImportedServicesInstance.java
index 4178dc7..6952df7 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/service/ImportedServicesInstance.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/service/ImportedServicesInstance.java
@@ -114,4 +114,10 @@ public class ImportedServicesInstance
     {
         return servicesModel.models();
     }
+
+    public Stream<ServiceReference<?>> references()
+    {
+        return serviceReferences.stream();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e5c57f95/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java
index ce458c9..54500e5 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java
@@ -23,7 +23,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.NoSuchElementException;
 import java.util.Optional;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -85,6 +84,7 @@ import org.apache.zest.spi.entitystore.EntityStore;
 import org.apache.zest.spi.metrics.MetricsProviderAdapter;
 import org.apache.zest.spi.module.ModuleSpi;
 
+import static java.util.stream.Stream.concat;
 import static org.apache.zest.functional.Iterables.iterable;
 
 /**
@@ -400,9 +400,10 @@ public class ModuleInstance
     private <T> ServiceReference<T> findServiceReferenceInstance( ModelDescriptor model )
     {
         ModuleInstance moduleInstanceOfModel = (ModuleInstance) model.module().instance();
-        Optional<ServiceReference<?>> candidate = moduleInstanceOfModel.services.references()
-            .filter( ref -> ref.model().equals( model ) )
-            .findAny();
+        Optional<ServiceReference<?>> candidate =
+            concat( moduleInstanceOfModel.services.references(), moduleInstanceOfModel.importedServices.references() )
+                .filter( ref -> ref.model().equals( model ) )
+                .findAny();
         if( candidate.isPresent() )
         {
             ServiceReference<?> serviceReference = candidate.get();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e5c57f95/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java
index aba9b22..3e04d57 100755
--- a/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java
@@ -355,7 +355,7 @@ class TypeLookupImpl
                     )
             );
         Stream<? extends ModelDescriptor> importedServices =
-            concat( moduleModel.serviceComposites(),
+            concat( moduleModel.importedServices(),
                     concat(
                         concat(
                             moduleModel.layer()