polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject zest-java git commit: Renamed EntityTypeNotFoundException to NoSuchEntityTypeException, to better match the other NoSuchCompositeExcpetion subclasses. Also made it into the same class hierarchy as the rest for unity.
Date Fri, 15 Apr 2016 03:20:44 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop 6f5313e89 -> def7765f4


Renamed EntityTypeNotFoundException to NoSuchEntityTypeException, to better match the other NoSuchCompositeExcpetion subclasses. Also made it into the same class hierarchy as the rest for unity.


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

Branch: refs/heads/develop
Commit: def7765f4a21a8ead434a7599c75f6bffd2c165e
Parents: 6f5313e
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Fri Apr 15 11:19:55 2016 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Fri Apr 15 11:19:55 2016 +0800

----------------------------------------------------------------------
 .../api/composite/NoSuchCompositeException.java | 11 +++-
 .../api/composite/NoSuchTransientException.java | 14 ++++-
 .../zest/api/configuration/Configuration.java   |  4 +-
 .../api/service/NoSuchServiceException.java     | 15 ++++-
 .../org/apache/zest/api/structure/Module.java   |  2 +
 .../unitofwork/EntityTypeNotFoundException.java | 56 ------------------
 .../unitofwork/NoSuchEntityTypeException.java   | 40 +++++++++++++
 .../apache/zest/api/unitofwork/UnitOfWork.java  | 32 +++++-----
 .../zest/api/value/NoSuchValueException.java    | 13 +++-
 .../zest/runtime/structure/ModuleInstance.java  | 13 ++--
 .../runtime/unitofwork/ModuleUnitOfWork.java    | 38 ++++++------
 .../runtime/unitofwork/UnitOfWorkInstance.java  |  6 +-
 .../runtime/value/ValueBuilderInstance.java     |  3 +-
 .../runtime/entity/EntityVisibilityTest.java    | 62 ++++++++++----------
 .../unitofwork/PrivateEntityUnitOfWorkTest.java |  4 +-
 .../helpers/JSONMapEntityStoreMixin.java        |  4 +-
 .../helpers/MapEntityStoreMixin.java            |  4 +-
 .../prefs/PreferencesEntityStoreMixin.java      |  4 +-
 .../entitystore/sql/SQLEntityStoreMixin.java    |  4 +-
 .../conversion/values/EntityToValue.java        |  3 +-
 .../conversion/values/ValueToEntityMixin.java   |  4 +-
 .../rest/server/api/ContextResource.java        |  5 +-
 .../zest/library/restlet/ZrestApplication.java  |  1 +
 .../repository/SmallCrudRepositoryMixin.java    |  4 +-
 .../conversion/EntityToDTOService.java          |  3 +-
 .../conversion/EntityToDTOService.java          |  3 +-
 .../project/restapp/DomainLayerWriter.java      |  1 +
 .../project/restapp/RestModuleWriter.java       |  1 +
 .../project/restapp/SecurityModuleWriter.java   |  1 +
 29 files changed, 195 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/api/src/main/java/org/apache/zest/api/composite/NoSuchCompositeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/NoSuchCompositeException.java b/core/api/src/main/java/org/apache/zest/api/composite/NoSuchCompositeException.java
index 3583322..61f6d60 100644
--- a/core/api/src/main/java/org/apache/zest/api/composite/NoSuchCompositeException.java
+++ b/core/api/src/main/java/org/apache/zest/api/composite/NoSuchCompositeException.java
@@ -25,13 +25,15 @@ public class NoSuchCompositeException
 
     private final String compositeType;
     private final String moduleName;
+    private final String visibleTypes;
 
-    protected NoSuchCompositeException( String metaType, String compositeType, String moduleName )
+    protected NoSuchCompositeException( String metaType, String compositeType, String moduleName, String visibleTypes )
     {
         super( "Could not find any visible " + metaType + " of type [" + compositeType + "] in module [" +
-               moduleName + "]." );
+               moduleName + "].\n" + visibleTypes );
         this.compositeType = compositeType;
         this.moduleName = moduleName;
+        this.visibleTypes = visibleTypes;
     }
 
     public String compositeType()
@@ -43,4 +45,9 @@ public class NoSuchCompositeException
     {
         return moduleName;
     }
+
+    public String visibleTypes()
+    {
+        return visibleTypes;
+    }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/api/src/main/java/org/apache/zest/api/composite/NoSuchTransientException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/NoSuchTransientException.java b/core/api/src/main/java/org/apache/zest/api/composite/NoSuchTransientException.java
index 5cd6046..697c182 100644
--- a/core/api/src/main/java/org/apache/zest/api/composite/NoSuchTransientException.java
+++ b/core/api/src/main/java/org/apache/zest/api/composite/NoSuchTransientException.java
@@ -16,13 +16,23 @@
 
 package org.apache.zest.api.composite;
 
+import java.util.stream.Collectors;
+import org.apache.zest.api.structure.TypeLookup;
+
 /**
  * This exception is thrown if client code tries to create a non-existing TransientComposite type.
  */
 public class NoSuchTransientException extends NoSuchCompositeException
 {
-    public NoSuchTransientException( String typeName, String moduleName )
+    public NoSuchTransientException( String typeName, String moduleName, TypeLookup typeLookup )
+    {
+        super( "TransientComposite", typeName, moduleName, formatVisibleTypes( typeLookup ) );
+    }
+
+    private static String formatVisibleTypes( TypeLookup typeLookup )
     {
-        super( "TransientComposite", typeName, moduleName );
+        return typeLookup.allTransients()
+            .map(descriptor -> descriptor.primaryType().getName())
+            .collect( Collectors.joining( "\n", "Visible transient types are:\n", "" ) );
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/api/src/main/java/org/apache/zest/api/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/configuration/Configuration.java b/core/api/src/main/java/org/apache/zest/api/configuration/Configuration.java
index cdcf0f3..6c16bd8 100644
--- a/core/api/src/main/java/org/apache/zest/api/configuration/Configuration.java
+++ b/core/api/src/main/java/org/apache/zest/api/configuration/Configuration.java
@@ -32,7 +32,7 @@ import org.apache.zest.api.service.ServiceDescriptor;
 import org.apache.zest.api.service.ServiceReference;
 import org.apache.zest.api.service.qualifier.ServiceTags;
 import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
@@ -237,7 +237,7 @@ public interface Configuration<T>
                 configuration = uow.get( serviceModel.<V>configurationType(), identity );
                 uow.pause();
             }
-            catch( NoSuchEntityException | EntityTypeNotFoundException e )
+            catch( NoSuchEntityException | NoSuchEntityTypeException e )
             {
                 return (V) initializeConfigurationInstance( serviceComposite, uow, serviceModel, identity );
             }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java b/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
index cee08a3..7df03d2 100644
--- a/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
+++ b/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
@@ -16,15 +16,26 @@
 
 package org.apache.zest.api.service;
 
+import java.util.stream.Collectors;
+import org.apache.zest.api.composite.CompositeDescriptor;
 import org.apache.zest.api.composite.NoSuchCompositeException;
+import org.apache.zest.api.structure.TypeLookup;
 
 /**
  * Thrown when no visible service of the requested type is found.
  */
 public class NoSuchServiceException extends NoSuchCompositeException
 {
-    public NoSuchServiceException( String typeName, String moduleName )
+    public NoSuchServiceException( String typeName, String moduleName, TypeLookup typeLookup )
     {
-        super( "ServiceComposite", typeName, moduleName );
+        super( "ServiceComposite", typeName, moduleName, formatVisibleTypes( typeLookup ) );
+    }
+
+    private static String formatVisibleTypes( TypeLookup typeLookup )
+    {
+        return typeLookup.allServices()
+            .map( descriptor -> ( CompositeDescriptor) descriptor )
+            .map(descriptor -> descriptor.primaryType().getName())
+            .collect( Collectors.joining( "\n", "Visible service types are:\n", "" ) );
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/api/src/main/java/org/apache/zest/api/structure/Module.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/Module.java b/core/api/src/main/java/org/apache/zest/api/structure/Module.java
index d60f1db..0d72985 100644
--- a/core/api/src/main/java/org/apache/zest/api/structure/Module.java
+++ b/core/api/src/main/java/org/apache/zest/api/structure/Module.java
@@ -60,4 +60,6 @@ public interface Module
 
 
     UnitOfWorkFactory unitOfWorkFactory();
+
+    TypeLookup typeLookup();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/api/src/main/java/org/apache/zest/api/unitofwork/EntityTypeNotFoundException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/EntityTypeNotFoundException.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/EntityTypeNotFoundException.java
deleted file mode 100644
index e35d1b3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/EntityTypeNotFoundException.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, Rickard Öberg. All Rights Reserved.
- * Copyright (c) 2007-2008, Niclas Hedhman. All Rights Reserved.
- * Copyright (c) 2007, Alin Dreghiciu. All Rights Reserved. 
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.zest.api.unitofwork;
-
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.structure.ModuleDescriptor;
-
-/**
- * Zest exception to be thrown in case that an entity composite
- * was not found during a lookup call.
- */
-public class EntityTypeNotFoundException
-    extends UnitOfWorkException
-{
-    private final String compositeType;
-
-    private EntityTypeNotFoundException( String entityType, String moduleName, Stream<String> visibility )
-    {
-        super( "Could not find an EntityComposite of type " + entityType + " in module [" + moduleName + "].\n" +
-               "\tThe following entity types are visible:\n" + visibility.collect( Collectors.joining( "\n" ) ) );
-        this.compositeType = entityType;
-    }
-
-    public String compositeType()
-    {
-        return compositeType;
-    }
-
-    public static EntityTypeNotFoundException create( String type, ModuleDescriptor module )
-    {
-        return new EntityTypeNotFoundException( type,
-                                                module.name(),
-                                                module.findVisibleEntityTypes()
-                                                    .map( item -> item.types()
-                                                                      .iterator()
-                                                                      .next()
-                                                                      .getName() + "[" + item.module()
-                                                                      .name() + "]" )
-        );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/api/src/main/java/org/apache/zest/api/unitofwork/NoSuchEntityTypeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/NoSuchEntityTypeException.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/NoSuchEntityTypeException.java
new file mode 100644
index 0000000..585b4be
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/unitofwork/NoSuchEntityTypeException.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2007, Rickard Öberg. All Rights Reserved.
+ * Copyright (c) 2007-2008, Niclas Hedhman. All Rights Reserved.
+ * Copyright (c) 2007, Alin Dreghiciu. All Rights Reserved. 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.zest.api.unitofwork;
+
+import java.util.stream.Collectors;
+import org.apache.zest.api.composite.NoSuchCompositeException;
+import org.apache.zest.api.structure.TypeLookup;
+
+/**
+ * Zest exception to be thrown in case that an entity composite
+ * was not found during a lookup call.
+ */
+public class NoSuchEntityTypeException
+    extends NoSuchCompositeException
+{
+    public NoSuchEntityTypeException( String typeName, String moduleName, TypeLookup typeLookup )
+    {
+        super( "EntityComposite", typeName, moduleName, formatVisibleTypes( typeLookup ) );
+    }
+
+    private static String formatVisibleTypes( TypeLookup typeLookup )
+    {
+        return typeLookup.allEntities()
+            .map( descriptor -> descriptor.primaryType().getName() )
+            .collect( Collectors.joining( "\n", "Visible entity types are:\n", "" ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java
index 2a66379..1de5e99 100644
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java
+++ b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java
@@ -127,12 +127,12 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
      *
      * @return a new Entity
      *
-     * @throws EntityTypeNotFoundException if no EntityComposite type of the given mixin type has been registered
+     * @throws NoSuchEntityTypeException if no EntityComposite type of the given mixin type has been registered
      * @throws AmbiguousTypeException      If several mixins implement the given type
      * @throws LifecycleException          if the entity cannot be created
      */
     <T> T newEntity( Class<T> type )
-        throws EntityTypeNotFoundException, AmbiguousTypeException, LifecycleException;
+        throws NoSuchEntityTypeException, AmbiguousTypeException, LifecycleException;
 
     /**
      * Create a new Entity which implements the given mixin type. An EntityComposite
@@ -145,12 +145,12 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
      *
      * @return a new Entity
      *
-     * @throws EntityTypeNotFoundException if no EntityComposite type of the given mixin type has been registered
+     * @throws NoSuchEntityTypeException if no EntityComposite type of the given mixin type has been registered
      * @throws AmbiguousTypeException      If several mixins implement the given type
      * @throws LifecycleException          if the entity cannot be created
      */
     <T> T newEntity( Class<T> type, @Optional String identity )
-        throws EntityTypeNotFoundException, AmbiguousTypeException, LifecycleException;
+        throws NoSuchEntityTypeException, AmbiguousTypeException, LifecycleException;
 
     /**
      * Create a new EntityBuilder for an EntityComposite which implements the given mixin type. An EntityComposite
@@ -162,11 +162,11 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
      *
      * @return a new EntityBuilder
      *
-     * @throws EntityTypeNotFoundException if no EntityComposite type of the given mixin type has been registered
+     * @throws NoSuchEntityTypeException if no EntityComposite type of the given mixin type has been registered
      * @throws AmbiguousTypeException      If several mixins implement the given type
      */
     <T> EntityBuilder<T> newEntityBuilder( Class<T> type )
-        throws EntityTypeNotFoundException, AmbiguousTypeException;
+        throws NoSuchEntityTypeException, AmbiguousTypeException;
 
     /**
      * Create a new EntityBuilder for an EntityComposite which implements the given mixin type. An EntityComposite
@@ -179,11 +179,11 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
      *
      * @return a new EntityBuilder
      *
-     * @throws EntityTypeNotFoundException if no EntityComposite type of the given mixin type has been registered
+     * @throws NoSuchEntityTypeException if no EntityComposite type of the given mixin type has been registered
      * @throws AmbiguousTypeException      If several mixins implement the given type
      */
     <T> EntityBuilder<T> newEntityBuilder( Class<T> type, @Optional String identity )
-        throws EntityTypeNotFoundException, AmbiguousTypeException;
+        throws NoSuchEntityTypeException, AmbiguousTypeException;
 
     /**
      * Create a new EntityBuilder for an EntityComposite wich implements the given mixin type starting with the given
@@ -201,7 +201,7 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
      *
      * @return a new EntityBuilder starting with the given state
      *
-     * @throws EntityTypeNotFoundException if no EntityComposite type of the given mixin type has been registered
+     * @throws NoSuchEntityTypeException if no EntityComposite type of the given mixin type has been registered
      * @throws AmbiguousTypeException      If several mixins implement the given type
      */
     <T> EntityBuilder<T> newEntityBuilderWithState( Class<T> type,
@@ -210,7 +210,7 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
                                                     Function<AssociationDescriptor, Iterable<EntityReference>> manyAssociationFunction,
                                                     Function<AssociationDescriptor, Map<String, EntityReference>> namedAssociationFunction
     )
-        throws EntityTypeNotFoundException, AmbiguousTypeException;
+        throws NoSuchEntityTypeException, AmbiguousTypeException;
 
     /**
      * Create a new EntityBuilder for an EntityComposite wich implements the given mixin type starting with the given
@@ -229,7 +229,7 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
      *
      * @return a new EntityBuilder starting with the given state
      *
-     * @throws EntityTypeNotFoundException If no mixins implements the given type
+     * @throws NoSuchEntityTypeException If no mixins implements the given type
      * @throws AmbiguousTypeException      If several mixins implement the given type
      */
     <T> EntityBuilder<T> newEntityBuilderWithState( Class<T> type, @Optional String identity,
@@ -238,7 +238,7 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
                                                     Function<AssociationDescriptor, Iterable<EntityReference>> manyAssociationFunction,
                                                     Function<AssociationDescriptor, Map<String, EntityReference>> namedAssociationFunction
     )
-        throws EntityTypeNotFoundException, AmbiguousTypeException;
+        throws NoSuchEntityTypeException, AmbiguousTypeException;
 
     /**
      * Find an Entity of the given mixin type with the give identity. This
@@ -249,11 +249,11 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
      *
      * @return the entity
      *
-     * @throws EntityTypeNotFoundException if no entity type could be found
+     * @throws NoSuchEntityTypeException if no entity type could be found
      * @throws NoSuchEntityException       if the entity could not be found
      */
     <T> T get( Class<T> type, String identity )
-        throws EntityTypeNotFoundException, NoSuchEntityException;
+        throws NoSuchEntityTypeException, NoSuchEntityException;
 
     /**
      * If you have a reference to an Entity from another
@@ -264,10 +264,10 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
      *
      * @return an Entity from this UnitOfWork
      *
-     * @throws EntityTypeNotFoundException if no entity type could be found
+     * @throws NoSuchEntityTypeException if no entity type could be found
      */
     <T> T get( T entity )
-        throws EntityTypeNotFoundException;
+        throws NoSuchEntityTypeException;
 
     /**
      * Remove the given Entity.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/api/src/main/java/org/apache/zest/api/value/NoSuchValueException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/NoSuchValueException.java b/core/api/src/main/java/org/apache/zest/api/value/NoSuchValueException.java
index 754768a..3758022 100644
--- a/core/api/src/main/java/org/apache/zest/api/value/NoSuchValueException.java
+++ b/core/api/src/main/java/org/apache/zest/api/value/NoSuchValueException.java
@@ -13,7 +13,9 @@
  */
 package org.apache.zest.api.value;
 
+import java.util.stream.Collectors;
 import org.apache.zest.api.composite.NoSuchCompositeException;
+import org.apache.zest.api.structure.TypeLookup;
 
 /**
  * Thrown when no visible value of the requested type is found.
@@ -21,8 +23,15 @@ import org.apache.zest.api.composite.NoSuchCompositeException;
 public class NoSuchValueException
     extends NoSuchCompositeException
 {
-    public NoSuchValueException( String valueType, String moduleName )
+    public NoSuchValueException( String valueType, String moduleName, TypeLookup typeLookup )
     {
-        super( "ValueComposite", valueType, moduleName );
+        super( "ValueComposite", valueType, moduleName, formatVisibleTypes(typeLookup) );
+    }
+
+    private static String formatVisibleTypes( TypeLookup typeLookup )
+    {
+        return typeLookup.allValues()
+            .map(descriptor -> descriptor.primaryType().getName())
+            .collect( Collectors.joining( "\n", "Visible value types are:\n", "" ) );
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/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 54500e5..8d8deb7 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
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.function.Function;
+import java.util.stream.Collector;
 import java.util.stream.Collectors;
 import org.apache.zest.api.activation.Activation;
 import org.apache.zest.api.activation.ActivationEventListener;
@@ -199,7 +200,7 @@ public class ModuleInstance
 
         if( model == null )
         {
-            throw new NoSuchTransientException( mixinType.getName(), name() );
+            throw new NoSuchTransientException( mixinType.getName(), name(), typeLookup );
         }
 
         Map<AccessibleObject, Property<?>> properties = new HashMap<>();
@@ -240,7 +241,7 @@ public class ModuleInstance
 
         if( compositeModelModule == null )
         {
-            throw new NoSuchValueException( mixinType.getName(), name() );
+            throw new NoSuchValueException( mixinType.getName(), name(), typeLookup );
         }
 
         StateResolver stateResolver = new InitialStateResolver( compositeModelModule.module() );
@@ -264,7 +265,7 @@ public class ModuleInstance
 
         if( compositeModelModule == null )
         {
-            throw new NoSuchValueException( mixinType.getName(), name() );
+            throw new NoSuchValueException( mixinType.getName(), name(), typeLookup );
         }
 
         StateResolver stateResolver = new FunctionStateResolver(
@@ -321,7 +322,7 @@ public class ModuleInstance
 
         if( model == null )
         {
-            throw new NoSuchValueException( valueType.getName(), name() );
+            throw new NoSuchValueException( valueType.getName(), name(), typeLookup );
         }
 
         return new ValueBuilderWithPrototype<>( model, this, prototype );
@@ -336,7 +337,7 @@ public class ModuleInstance
 
         if( model == null )
         {
-            throw new NoSuchValueException( mixinType.getName(), name() );
+            throw new NoSuchValueException( mixinType.getName(), name(), typeLookup );
         }
 
         try
@@ -369,7 +370,7 @@ public class ModuleInstance
         ModelDescriptor serviceModel = typeLookup.lookupServiceModel( serviceType );
         if( serviceModel == null )
         {
-            throw new NoSuchServiceException( serviceType.getTypeName(), name() );
+            throw new NoSuchServiceException( serviceType.getTypeName(), name(),typeLookup );
         }
         return findServiceReferenceInstance( serviceModel );
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java
index 8d5f011..2a22aa1 100755
--- a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java
@@ -50,8 +50,8 @@ import org.apache.zest.api.query.grammar.OrderBy;
 import org.apache.zest.api.service.NoSuchServiceException;
 import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.unitofwork.ConcurrentEntityModificationException;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkCallback;
 import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
@@ -161,45 +161,47 @@ public class ModuleUnitOfWork
 
     @Override
     public <T> T newEntity( Class<T> type )
-        throws EntityTypeNotFoundException, LifecycleException
+        throws NoSuchEntityTypeException, LifecycleException
     {
         return newEntity( type, null );
     }
 
     @Override
     public <T> T newEntity( Class<T> type, String identity )
-        throws EntityTypeNotFoundException, LifecycleException
+        throws NoSuchEntityTypeException, LifecycleException
     {
         return newEntityBuilder( type, identity ).newInstance();
     }
 
     @Override
     public <T> EntityBuilder<T> newEntityBuilder( Class<T> type )
-        throws EntityTypeNotFoundException
+        throws NoSuchEntityTypeException
     {
         return newEntityBuilder( type, null );
     }
 
     @Override
     public <T> EntityBuilder<T> newEntityBuilder( Class<T> type, String identity )
-        throws EntityTypeNotFoundException
+        throws NoSuchEntityTypeException
     {
         EntityDescriptor model = module.typeLookup().lookupEntityModel( type );
 
         if( model == null )
         {
-            throw EntityTypeNotFoundException.create( type.getName(), module );
+            throw new NoSuchEntityTypeException( type.getName(), module.name(), module.typeLookup() );
         }
 
-        EntityStore entityStore = ( (ModuleSpi) model.module().instance() ).entityStore();
+        ModuleDescriptor modelModule = model.module();
+        EntityStore entityStore = ( (ModuleSpi) modelModule.instance() ).entityStore();
 
         // Generate id if necessary
         if( identity == null )
         {
-            IdentityGenerator idGen = ( (ModuleSpi) model.module().instance() ).identityGenerator();
+            IdentityGenerator idGen = ( (ModuleSpi) modelModule.instance() ).identityGenerator();
             if( idGen == null )
             {
-                throw new NoSuchServiceException( IdentityGenerator.class.getName(), model.module().name() );
+                throw new NoSuchServiceException( IdentityGenerator.class.getName(), modelModule
+                    .name(), modelModule.typeLookup() );
             }
             identity = idGen.generate( model.types().findFirst().orElse( null ) );
         }
@@ -220,7 +222,7 @@ public class ModuleUnitOfWork
         Function<AssociationDescriptor, Iterable<EntityReference>> manyAssociationFunction,
         Function<AssociationDescriptor, Map<String, EntityReference>> namedAssociationFunction
     )
-        throws EntityTypeNotFoundException
+        throws NoSuchEntityTypeException
     {
         return newEntityBuilderWithState( type, null,
                                           propertyFunction,
@@ -237,7 +239,7 @@ public class ModuleUnitOfWork
         Function<AssociationDescriptor, Iterable<EntityReference>> manyAssociationFunction,
         Function<AssociationDescriptor, Map<String, EntityReference>> namedAssociationFunction
     )
-        throws EntityTypeNotFoundException
+        throws NoSuchEntityTypeException
     {
         NullArgumentException.validateNotNull( "propertyFunction", propertyFunction );
         NullArgumentException.validateNotNull( "associationFunction", associationFunction );
@@ -248,10 +250,11 @@ public class ModuleUnitOfWork
 
         if( model == null )
         {
-            throw EntityTypeNotFoundException.create( type.getName(), module );
+            throw new NoSuchEntityTypeException( type.getName(), module.name(), module.typeLookup() );
         }
 
-        ModuleSpi moduleSpi = (ModuleSpi) model.module().instance();
+        ModuleDescriptor modelModule = model.module();
+        ModuleSpi moduleSpi = (ModuleSpi) modelModule.instance();
         EntityStore entityStore = moduleSpi.entityStore();
 
         FunctionStateResolver stateResolver = new FunctionStateResolver(
@@ -271,7 +274,8 @@ public class ModuleUnitOfWork
                 IdentityGenerator idGen = moduleSpi.identityGenerator();
                 if( idGen == null )
                 {
-                    throw new NoSuchServiceException( IdentityGenerator.class.getName(), model.module().name() );
+                    String typeName = IdentityGenerator.class.getName();
+                    throw new NoSuchServiceException( typeName, modelModule.name(), modelModule.typeLookup() );
                 }
                 identity = idGen.generate( model.types().findFirst().orElse( null ) );
             }
@@ -286,13 +290,13 @@ public class ModuleUnitOfWork
 
     @Override
     public <T> T get( Class<T> type, String identity )
-        throws EntityTypeNotFoundException, NoSuchEntityException
+        throws NoSuchEntityTypeException, NoSuchEntityException
     {
         Iterable<? extends EntityDescriptor> models = module.typeLookup().lookupEntityModels( type );
 
         if( !models.iterator().hasNext() )
         {
-            throw EntityTypeNotFoundException.create( type.getName(), module );
+            throw new NoSuchEntityTypeException( type.getName(), module.name(), module.typeLookup() );
         }
 
         return uow.get( parseEntityReference( identity ), this, models, type );
@@ -301,7 +305,7 @@ public class ModuleUnitOfWork
     @Override
     @SuppressWarnings( "unchecked" )
     public <T> T get( T entity )
-        throws EntityTypeNotFoundException
+        throws NoSuchEntityTypeException
     {
         EntityComposite entityComposite = (EntityComposite) entity;
         EntityInstance compositeInstance = EntityInstance.entityInstanceOf( entityComposite );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
index 4ba3c55..baa0726 100755
--- a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
@@ -39,7 +39,7 @@ import org.apache.zest.api.metrics.MetricsTimerFactory;
 import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.type.HasTypes;
 import org.apache.zest.api.unitofwork.ConcurrentEntityModificationException;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkCallback;
@@ -132,7 +132,7 @@ public final class UnitOfWorkInstance
                       Iterable<? extends EntityDescriptor> potentialModels,
                       Class<T> mixinType
     )
-        throws EntityTypeNotFoundException, NoSuchEntityException
+        throws NoSuchEntityTypeException, NoSuchEntityException
     {
         checkOpen();
 
@@ -173,7 +173,7 @@ public final class UnitOfWorkInstance
                 }
                 else
                 {
-                    throw EntityTypeNotFoundException.create( mixinType.getName(), module );
+                    throw new NoSuchEntityTypeException( mixinType.getName(), module.name(), module.typeLookup() );
                 }
             }
             // Create instance

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/runtime/src/main/java/org/apache/zest/runtime/value/ValueBuilderInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/value/ValueBuilderInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/value/ValueBuilderInstance.java
index ae438c5..0e860d5 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/value/ValueBuilderInstance.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/value/ValueBuilderInstance.java
@@ -13,6 +13,7 @@
  */
 package org.apache.zest.runtime.value;
 
+import java.util.stream.Collectors;
 import org.apache.zest.api.association.AssociationStateHolder;
 import org.apache.zest.api.common.ConstructionException;
 import org.apache.zest.api.composite.Composite;
@@ -73,7 +74,7 @@ public final class ValueBuilderInstance<T>
 
         if( valueModel == null )
         {
-            throw new NoSuchValueException( valueType.getName(), currentModule.name() );
+            throw new NoSuchValueException( valueType.getName(), currentModule.name(), currentModule.typeLookup() );
         }
         return new ValueBuilderWithPrototype<>( valueModel, currentModule, prototype() ).newInstance();
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java
index 0d0e6f1..b9df70f 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java
@@ -29,7 +29,7 @@ import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.service.ServiceComposite;
 import org.apache.zest.api.structure.Application;
 import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.value.ValueComposite;
 import org.apache.zest.bootstrap.ApplicationAssemblerAdapter;
@@ -124,7 +124,7 @@ public class EntityVisibilityTest
         service.besideLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromServiceWhenAccessingBesideModuleVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
@@ -138,35 +138,35 @@ public class EntityVisibilityTest
         service.belowApplicationVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromServiceWhenAccessingBelowLayerVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
         service.belowLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromServiceWhenAccessingBelowModuleVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
         service.belowModuleVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromServiceWhenAccessingAboveApplicationVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
         service.aboveApplicationVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromServiceWhenAccessingAboveLayerVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
         service.aboveLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromServiceWhenAccessingAboveModuleVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
@@ -263,7 +263,7 @@ public class EntityVisibilityTest
         }
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromEntityWhenAccessingBesideModuleVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -299,7 +299,7 @@ public class EntityVisibilityTest
         }
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromEntityWhenAccessingBelowLayerVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -317,7 +317,7 @@ public class EntityVisibilityTest
         }
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromEntityWhenAccessingBelowModuleVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -335,7 +335,7 @@ public class EntityVisibilityTest
         }
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromEntityWhenAccessingAboveApplicationVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -353,7 +353,7 @@ public class EntityVisibilityTest
         }
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromEntityWhenAccessingAboveLayerVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -371,7 +371,7 @@ public class EntityVisibilityTest
         }
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromEntityWhenAccessingAboveModuleVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -424,7 +424,7 @@ public class EntityVisibilityTest
         value.besideLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromValueWhenAccessingBesideModuleVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
@@ -438,35 +438,35 @@ public class EntityVisibilityTest
         value.belowApplicationVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromValueWhenAccessingBelowLayerVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
         value.belowLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromValueWhenAccessingBelowModuleVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
         value.belowModuleVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromValueWhenAccessingAboveApplicationVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
         value.aboveApplicationVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromValueWhenAccessingAboveLayerVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
         value.aboveLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromValueWhenAccessingAboveModuleVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
@@ -508,7 +508,7 @@ public class EntityVisibilityTest
         transientt.besideLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromTransientWhenAccessingBesideModuleVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
@@ -522,35 +522,35 @@ public class EntityVisibilityTest
         transientt.belowApplicationVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromTransientWhenAccessingBelowLayerVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
         transientt.belowLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromTransientWhenAccessingBelowModuleVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
         transientt.belowModuleVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromTransientWhenAccessingAboveApplicationVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
         transientt.aboveApplicationVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromTransientWhenAccessingAboveLayerVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
         transientt.aboveLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromTransientWhenAccessingAboveModuleVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
@@ -592,7 +592,7 @@ public class EntityVisibilityTest
         object.besideLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromObjectWhenAccessingBesideModuleVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
@@ -606,35 +606,35 @@ public class EntityVisibilityTest
         object.belowApplicationVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromObjectWhenAccessingBelowLayerVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
         object.belowLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromObjectWhenAccessingBelowModuleVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
         object.belowModuleVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromObjectWhenAccessingAboveApplicationVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
         object.aboveApplicationVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromObjectWhenAccessingAboveLayerVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
         object.aboveLayerVisible();
     }
 
-    @Test( expected = EntityTypeNotFoundException.class )
+    @Test( expected = NoSuchEntityTypeException.class )
     public void givenFromObjectWhenAccessingAboveModuleVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java
index 1d81f68..c28795a 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java
@@ -24,7 +24,7 @@ import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.api.structure.Application;
 import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.value.ValueBuilder;
@@ -89,7 +89,7 @@ public class PrivateEntityUnitOfWorkTest
             unitOfWork.newEntity( ProductEntity.class );
             fail( "Should not be able to create product here" );
         }
-        catch( EntityTypeNotFoundException e )
+        catch( NoSuchEntityTypeException e )
         {
             // Ok
             ProductCatalog catalog = unitOfWork.newEntity( ProductCatalog.class, "1" );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
index a963118..1e2ca69 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
@@ -40,7 +40,7 @@ import org.apache.zest.api.service.ServiceDescriptor;
 import org.apache.zest.api.service.qualifier.Tagged;
 import org.apache.zest.api.structure.Application;
 import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.value.ValueSerialization;
 import org.apache.zest.io.Input;
@@ -462,7 +462,7 @@ public class JSONMapEntityStoreMixin
             EntityDescriptor entityDescriptor = module.entityDescriptor( type );
             if( entityDescriptor == null )
             {
-                throw EntityTypeNotFoundException.create( type, module );
+                throw new NoSuchEntityTypeException( type, module.name(), module.typeLookup() );
             }
 
             return new JSONEntityState( module,

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
index 55830d8..12a4014 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
@@ -39,7 +39,7 @@ import org.apache.zest.api.service.qualifier.Tagged;
 import org.apache.zest.api.structure.Application;
 import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.type.ValueType;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.value.ValueSerialization;
 import org.apache.zest.api.value.ValueSerializationException;
@@ -412,7 +412,7 @@ public class MapEntityStoreMixin
             EntityDescriptor entityDescriptor = module.entityDescriptor( type );
             if( entityDescriptor == null )
             {
-                throw EntityTypeNotFoundException.create( type, module );
+                throw new NoSuchEntityTypeException( type, module.name(), module.typeLookup() );
             }
 
             Map<QualifiedName, Object> properties = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java b/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java
index 5ee9f81..58c2b6b 100755
--- a/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java
@@ -48,7 +48,7 @@ import org.apache.zest.api.type.EnumType;
 import org.apache.zest.api.type.MapType;
 import org.apache.zest.api.type.ValueCompositeType;
 import org.apache.zest.api.type.ValueType;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.usecase.UsecaseBuilder;
@@ -243,7 +243,7 @@ public class PreferencesEntityStoreMixin
             EntityDescriptor entityDescriptor = module.entityDescriptor( type );
             if( entityDescriptor == null )
             {
-                throw EntityTypeNotFoundException.create( type, module );
+                throw new NoSuchEntityTypeException( type, module.name(), module.typeLookup() );
             }
 
             Map<QualifiedName, Object> properties = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java
index 0442a5c..c256466 100755
--- a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java
@@ -42,7 +42,7 @@ import org.apache.zest.api.service.qualifier.Tagged;
 import org.apache.zest.api.structure.Application;
 import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.type.ValueType;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.value.ValueSerialization;
 import org.apache.zest.entitystore.sql.internal.DatabaseSQLService;
@@ -382,7 +382,7 @@ public class SQLEntityStoreMixin
             EntityDescriptor entityDescriptor = module.entityDescriptor( type );
             if( entityDescriptor == null )
             {
-                throw EntityTypeNotFoundException.create( type, module );
+                throw new NoSuchEntityTypeException( type, module.name(), module.typeLookup() );
             }
 
             Map<QualifiedName, Object> properties = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/EntityToValue.java
----------------------------------------------------------------------
diff --git a/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/EntityToValue.java b/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/EntityToValue.java
index 530efe7..1fe9aa4 100644
--- a/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/EntityToValue.java
+++ b/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/EntityToValue.java
@@ -26,6 +26,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
+import java.util.stream.Collectors;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.association.AssociationDescriptor;
 import org.apache.zest.api.association.AssociationStateDescriptor;
@@ -155,7 +156,7 @@ public interface EntityToValue
             ValueDescriptor valueDescriptor = module.descriptor().valueDescriptor( valueType.getName() );
             if( valueDescriptor == null )
             {
-                throw new NoSuchValueException( valueType.getName(), module.name() );
+                throw new NoSuchValueException( valueType.getName(), module.name(), module.typeLookup() );
             }
             Unqualified unqualified = valueDescriptor.metaInfo( Unqualified.class );
 //            Iterable<? extends PropertyDescriptor> properties = valueDescriptor.state().properties();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/ValueToEntityMixin.java
----------------------------------------------------------------------
diff --git a/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/ValueToEntityMixin.java b/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/ValueToEntityMixin.java
index 9ba478e..9ab9f9f 100644
--- a/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/ValueToEntityMixin.java
+++ b/libraries/conversion/src/main/java/org/apache/zest/library/conversion/values/ValueToEntityMixin.java
@@ -38,7 +38,7 @@ import org.apache.zest.api.entity.Identity;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.property.PropertyDescriptor;
 import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.value.ValueComposite;
@@ -186,7 +186,7 @@ public class ValueToEntityMixin
         EntityDescriptor eDesc = module.entityDescriptor( entityType.getName() );
         if( eDesc == null )
         {
-            throw EntityTypeNotFoundException.create( entityType.getName(), module );
+            throw new NoSuchEntityTypeException( entityType.getName(), module.name(), module.typeLookup() );
         }
 
         ValueComposite vComposite = (ValueComposite) value;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java
index eb99a46..1fa8845 100644
--- a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java
+++ b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java
@@ -37,8 +37,7 @@ import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.Uses;
 import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.value.ValueBuilder;
@@ -210,7 +209,7 @@ public class ContextResource
             current().select( composite );
             return composite;
         }
-        catch( EntityTypeNotFoundException | NoSuchEntityException e )
+        catch( NoSuchEntityTypeException | NoSuchEntityException e )
         {
             throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND );
         }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZrestApplication.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZrestApplication.java b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZrestApplication.java
index 296c0a2..f20cfd5 100644
--- a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZrestApplication.java
+++ b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZrestApplication.java
@@ -81,6 +81,7 @@ public abstract class ZrestApplication extends org.restlet.Application
     public synchronized void start()
         throws Exception
     {
+        System.err.println( "HABBA!!!!!" );
         Series<Parameter> parameters = getContext().getParameters();
         String mode = parameters.getFirstValue( "org.sensorsink.kooda.mode" );
         createApplication( mode );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java
index 00162f4..3c4d10c 100644
--- a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java
+++ b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java
@@ -31,7 +31,7 @@ import org.apache.zest.api.query.Query;
 import org.apache.zest.api.query.QueryBuilder;
 import org.apache.zest.api.query.QueryBuilderFactory;
 import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
@@ -92,7 +92,7 @@ public class SmallCrudRepositoryMixin<T extends Identity>
             T entity = uow.get( entityType, id );
             uow.remove( entity );
         }
-        catch( NoSuchEntityException | EntityTypeNotFoundException e )
+        catch( NoSuchEntityException | NoSuchEntityTypeException e )
         {
             throw new IllegalArgumentException( "Entity  '" + idOrName + "' doesn't exist." );
         }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
index bc7d3a6..9f0e4cb 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
@@ -22,6 +22,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
+import java.util.stream.Collectors;
 import org.apache.zest.api.association.AssociationDescriptor;
 import org.apache.zest.api.association.AssociationStateHolder;
 import org.apache.zest.api.association.ManyAssociation;
@@ -76,7 +77,7 @@ public interface EntityToDTOService
             ValueDescriptor valueDescriptor = module.valueDescriptor( valueType.getName() );
             if( valueDescriptor == null )
             {
-                throw new NoSuchValueException( valueType.getName(), module.name() );
+                throw new NoSuchValueException( valueType.getName(), module.name(), module.typeLookup() );
             }
             Unqualified unqualified = valueDescriptor.metaInfo( Unqualified.class );
             final EntityComposite composite = (EntityComposite) entity;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java
index 98cbbf4..9aecf4e 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java
@@ -22,6 +22,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
+import java.util.stream.Collectors;
 import org.apache.zest.api.association.AssociationDescriptor;
 import org.apache.zest.api.association.AssociationStateHolder;
 import org.apache.zest.api.association.ManyAssociation;
@@ -76,7 +77,7 @@ public interface EntityToDTOService
             ValueDescriptor valueDescriptor = module.valueDescriptor( valueType.getName() );
             if( valueDescriptor == null )
             {
-                throw new NoSuchValueException( valueType.getName(), module.name() );
+                throw new NoSuchValueException( valueType.getName(), module.name(), module.typeLookup() );
             }
             Unqualified unqualified = valueDescriptor.metaInfo( Unqualified.class );
             final EntityComposite composite = (EntityComposite) entity;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/DomainLayerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/DomainLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/DomainLayerWriter.java
index 2e97765..883c902 100644
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/DomainLayerWriter.java
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/DomainLayerWriter.java
@@ -38,6 +38,7 @@ public class DomainLayerWriter
                 "    {\n" +
                 "        createModule( layer, CrudModule.class );\n" +
                 "        createModule( layer, OrderModule.class );   // This is a simple sample that you typically remove.\n" +
+                "        createModule( layer, SecurityModule.class );   // This is a simple sample that you typically remove.\n" +
                 "        return layer;\n" +
                 "    }\n" +
                 "\n" +

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/RestModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/RestModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/RestModuleWriter.java
index 4a80205..6727692 100644
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/RestModuleWriter.java
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/RestModuleWriter.java
@@ -46,6 +46,7 @@ public class RestModuleWriter
                 "        module.objects( SimpleVerifier.class, SimpleEnroler.class);\n" +
                 "\n" +
                 "        new RestletCrudConnectivityAssembler().assemble( module );\n" +
+                "        module.values( EntryPoint.class );\n" +
                 "        module.values( /* add value types */   );\n" +
                 "        module.services(  /* add services */  );\n" +
                 "        return module;\n" +

http://git-wip-us.apache.org/repos/asf/zest-java/blob/def7765f/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityModuleWriter.java
index 7150df8..428e9d7 100644
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityModuleWriter.java
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityModuleWriter.java
@@ -44,6 +44,7 @@ public class SecurityModuleWriter
                 "    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
                 "        throws AssemblyException\n" +
                 "    {\n" +
+                "        module.withDefaultUnitOfWorkFactory();\n" +
                 "        module.services( SecurityRepository.class )\n" +
                 "            .withMixins( HardcodedSecurityRepositoryMixin.class )\n" +
                 "            .visibleIn( Visibility.application )\n" +


Mime
View raw message